Skip to content

Commit

Permalink
Merge pull request #17046 from sumitmenaria/master
Browse files Browse the repository at this point in the history
PoolArn attribute support in Data Source: aws_ec2_coip_pool
  • Loading branch information
ewbankkit authored Aug 3, 2021
2 parents e31620b + 01dc4d5 commit a3c59d2
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .changelog/17046.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
data-source/aws_ec2_coip_pool: Add `arn` attribute
```
6 changes: 6 additions & 0 deletions aws/data_source_aws_ec2_coip_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ func dataSourceAwsEc2CoipPool() *schema.Resource {
Computed: true,
},

"arn": {
Type: schema.TypeString,
Computed: true,
},

"tags": tagsSchemaComputed(),

"filter": ec2CustomFiltersSchema(),
Expand Down Expand Up @@ -90,6 +95,7 @@ func dataSourceAwsEc2CoipPoolRead(d *schema.ResourceData, meta interface{}) erro
d.SetId(aws.StringValue(coip.PoolId))

d.Set("local_gateway_route_table_id", coip.LocalGatewayRouteTableId)
d.Set("arn", coip.PoolArn)

if err := d.Set("pool_cidrs", aws.StringValueSlice(coip.PoolCidrs)); err != nil {
return fmt.Errorf("error setting pool_cidrs: %w", err)
Expand Down
1 change: 1 addition & 0 deletions aws/data_source_aws_ec2_coip_pool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ func TestAccDataSourceAwsEc2CoipPool_Id(t *testing.T) {
Check: resource.ComposeTestCheckFunc(
resource.TestMatchResourceAttr(dataSourceName, "local_gateway_route_table_id", regexp.MustCompile(`^lgw-rtb-`)),
resource.TestMatchResourceAttr(dataSourceName, "pool_id", regexp.MustCompile(`^ipv4pool-coip-`)),
testAccMatchResourceAttrRegionalARN(dataSourceName, "arn", "ec2", regexp.MustCompile(`coip-pool/ipv4pool-coip-.+$`)),
testCheckResourceAttrGreaterThanValue(dataSourceName, "pool_cidrs.#", "0"),
),
},
Expand Down
3 changes: 2 additions & 1 deletion website/docs/d/ec2_coip_pool.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ result attributes. This data source will complete the data by populating
any fields that are not included in the configuration with the data for
the selected COIP Pool.

The following attribute is additionally exported:
In addition, the following attributes are exported:

* `arn` - ARN of the COIP pool
* `pool_cidrs` - Set of CIDR blocks in pool

0 comments on commit a3c59d2

Please sign in to comment.