Skip to content

Commit ce547f0

Browse files
committed
fix: ec2:ipam-pool to ec2:ipam
resourcegroupstaggingapi.GetResources doesn't contain ec2:ipam-pool and only ec2:ipam
1 parent 6b7a641 commit ce547f0

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

pkg/config/services.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,10 +1022,10 @@ var SupportedServices = serviceConfigs{
10221022
Namespace: "AWS/IPAM",
10231023
Alias: "ipam",
10241024
ResourceFilters: []*string{
1025-
aws.String("ec2:ipam-pool"),
1025+
aws.String("ec2:ipam"),
10261026
},
10271027
DimensionRegexps: []*regexp.Regexp{
1028-
regexp.MustCompile(":ipam-pool/(?P<IpamPoolId>[^/]+)$"),
1028+
regexp.MustCompile(":ipam/(?P<IpamId>[^/]+)$"),
10291029
},
10301030
},
10311031
{

pkg/job/maxdimassociator/associator_ipam_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ import (
2222
"github.com/prometheus-community/yet-another-cloudwatch-exporter/pkg/model"
2323
)
2424

25-
var ec2IpamPool = &model.TaggedResource{
26-
ARN: "arn:aws:ec2::123456789012:ipam-pool/ipam-pool-1ff5e4e9ad2c28b7b",
25+
var ec2Ipam = &model.TaggedResource{
26+
ARN: "arn:aws:ec2::123456789012:ipam/ipam-1ff5e4e9ad2c28b7b",
2727
Namespace: "AWS/IPAM",
2828
}
2929

3030
var ipamResources = []*model.TaggedResource{
31-
ec2IpamPool,
31+
ec2Ipam,
3232
}
3333

3434
func TestAssociatorIpam(t *testing.T) {
@@ -47,31 +47,31 @@ func TestAssociatorIpam(t *testing.T) {
4747

4848
testcases := []testCase{
4949
{
50-
name: "should match with IpamPoolId dimension",
50+
name: "should match with IpamId dimension",
5151
args: args{
5252
dimensionRegexps: config.SupportedServices.GetService("AWS/IPAM").ToModelDimensionsRegexp(),
5353
resources: ipamResources,
5454
metric: &model.Metric{
5555
MetricName: "VpcIPUsage",
5656
Namespace: "AWS/IPAM",
5757
Dimensions: []model.Dimension{
58-
{Name: "IpamPoolId", Value: "ipam-pool-1ff5e4e9ad2c28b7b"},
58+
{Name: "IpamId", Value: "ipam-1ff5e4e9ad2c28b7b"},
5959
},
6060
},
6161
},
6262
expectedSkip: false,
63-
expectedResource: ec2IpamPool,
63+
expectedResource: ec2Ipam,
6464
},
6565
{
66-
name: "should skip with unmatched IpamPoolId dimension",
66+
name: "should skip with unmatched IpamId dimension",
6767
args: args{
6868
dimensionRegexps: config.SupportedServices.GetService("AWS/IPAM").ToModelDimensionsRegexp(),
6969
resources: ipamResources,
7070
metric: &model.Metric{
7171
MetricName: "VpcIPUsage",
7272
Namespace: "AWS/IPAM",
7373
Dimensions: []model.Dimension{
74-
{Name: "IpamPoolId", Value: "ipam-pool-blahblah"},
74+
{Name: "IpamId", Value: "ipam-blahblah"},
7575
},
7676
},
7777
},

0 commit comments

Comments
 (0)