Skip to content

Commit

Permalink
Merge pull request #32133 from trc-ikeskin/b-data-aws_vpc_ipam_pools-…
Browse files Browse the repository at this point in the history
…missing_ids

fix: add missing 'id' values in pool map (#32106)
  • Loading branch information
ewbankkit authored Oct 30, 2023
2 parents d755ad2 + 5181fd0 commit ca39f8a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
3 changes: 3 additions & 0 deletions .changelog/32133.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
data_source/aws_vpc_ipam_pools: Add `id` attribute for individual IPAM pools
```
8 changes: 2 additions & 6 deletions internal/service/ec2/ipam_pools_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func DataSourceIPAMPools() *schema.Resource {
},
"id": {
Type: schema.TypeString,
Optional: true,
Computed: true,
},
"ipam_scope_id": {
Type: schema.TypeString,
Expand All @@ -73,10 +73,6 @@ func DataSourceIPAMPools() *schema.Resource {
Type: schema.TypeString,
Computed: true,
},
"ipam_pool_id": {
Type: schema.TypeString,
Computed: true,
},
"locale": {
Type: schema.TypeString,
Computed: true,
Expand Down Expand Up @@ -152,14 +148,14 @@ func flattenIPAMPool(ctx context.Context, p *ec2.IpamPool, ignoreTagsConfig *tft
pool["auto_import"] = aws.BoolValue(p.AutoImport)
pool["aws_service"] = aws.StringValue(p.AwsService)
pool["description"] = aws.StringValue(p.Description)
pool["id"] = aws.StringValue(p.IpamPoolId)
pool["ipam_scope_id"] = strings.Split(aws.StringValue(p.IpamScopeArn), "/")[1]
pool["ipam_scope_type"] = aws.StringValue(p.IpamScopeType)
pool["locale"] = aws.StringValue(p.Locale)
pool["pool_depth"] = aws.Int64Value(p.PoolDepth)
pool["publicly_advertisable"] = aws.BoolValue(p.PubliclyAdvertisable)
pool["source_ipam_pool_id"] = aws.StringValue(p.SourceIpamPoolId)
pool["state"] = aws.StringValue(p.State)

if v := p.Tags; v != nil {
pool["tags"] = KeyValueTags(ctx, v).IgnoreAWS().IgnoreConfig(ignoreTagsConfig).Map()
}
Expand Down
1 change: 1 addition & 0 deletions internal/service/ec2/ipam_pools_data_source_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ func TestAccIPAMPoolsDataSource_basic(t *testing.T) {
resource.TestCheckResourceAttrPair(dataSourceNameTwo, "ipam_pools.0.auto_import", resourceName, "auto_import"),
resource.TestCheckResourceAttrPair(dataSourceNameTwo, "ipam_pools.0.description", resourceName, "description"),
resource.TestCheckResourceAttrPair(dataSourceNameTwo, "ipam_pools.0.aws_service", resourceName, "aws_service"),
resource.TestCheckResourceAttrPair(dataSourceNameTwo, "ipam_pools.0.id", resourceName, "id"),
resource.TestCheckResourceAttrPair(dataSourceNameTwo, "ipam_pools.0.ipam_scope_id", resourceName, "ipam_scope_id"),
resource.TestCheckResourceAttrPair(dataSourceNameTwo, "ipam_pools.0.ipam_scope_type", resourceName, "ipam_scope_type"),
resource.TestCheckResourceAttrPair(dataSourceNameTwo, "ipam_pools.0.locale", resourceName, "locale"),
Expand Down

0 comments on commit ca39f8a

Please sign in to comment.