From 3da7baab40f0f2251403b5f4c0f3cc7ff84d8fee Mon Sep 17 00:00:00 2001 From: sanzalb Date: Wed, 20 May 2020 09:18:41 +0200 Subject: [PATCH 1/5] Added CIDR block set to datasource VPC peering --- aws/data_source_aws_vpc_peering_connection.go | 46 +++++++++++++++++++ ..._source_aws_vpc_peering_connection_test.go | 38 ++++++++++++++- 2 files changed, 83 insertions(+), 1 deletion(-) diff --git a/aws/data_source_aws_vpc_peering_connection.go b/aws/data_source_aws_vpc_peering_connection.go index 4e58eab1e8c4..871dd5c74d15 100644 --- a/aws/data_source_aws_vpc_peering_connection.go +++ b/aws/data_source_aws_vpc_peering_connection.go @@ -40,6 +40,19 @@ func dataSourceAwsVpcPeeringConnection() *schema.Resource { Optional: true, Computed: true, }, + "cidr_block_set": { + Type: schema.TypeList, + Optional: true, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "cidr_block": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, "region": { Type: schema.TypeString, Optional: true, @@ -60,6 +73,19 @@ func dataSourceAwsVpcPeeringConnection() *schema.Resource { Optional: true, Computed: true, }, + "peer_cidr_block_set": { + Type: schema.TypeList, + Optional: true, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "cidr_block": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, "peer_region": { Type: schema.TypeString, Optional: true, @@ -138,10 +164,30 @@ func dataSourceAwsVpcPeeringConnectionRead(d *schema.ResourceData, meta interfac d.Set("vpc_id", pcx.RequesterVpcInfo.VpcId) d.Set("owner_id", pcx.RequesterVpcInfo.OwnerId) d.Set("cidr_block", pcx.RequesterVpcInfo.CidrBlock) + cidrBlockSet := []interface{}{} + for _, associationSet := range pcx.RequesterVpcInfo.CidrBlockSet { + association := map[string]interface{}{ + "cidr_block": aws.StringValue(associationSet.CidrBlock), + } + cidrBlockSet = append(cidrBlockSet, association) + } + if err := d.Set("cidr_block_set", cidrBlockSet); err != nil { + return fmt.Errorf("error setting cidr_block_set: %s", err) + } d.Set("region", pcx.RequesterVpcInfo.Region) d.Set("peer_vpc_id", pcx.AccepterVpcInfo.VpcId) d.Set("peer_owner_id", pcx.AccepterVpcInfo.OwnerId) d.Set("peer_cidr_block", pcx.AccepterVpcInfo.CidrBlock) + peerCidrBlockSet := []interface{}{} + for _, associationSet := range pcx.AccepterVpcInfo.CidrBlockSet { + association := map[string]interface{}{ + "cidr_block": aws.StringValue(associationSet.CidrBlock), + } + peerCidrBlockSet = append(peerCidrBlockSet, association) + } + if err := d.Set("peer_cidr_block_set", peerCidrBlockSet); err != nil { + return fmt.Errorf("error setting peer_cidr_block_set: %s", err) + } d.Set("peer_region", pcx.AccepterVpcInfo.Region) if err := d.Set("tags", keyvaluetags.Ec2KeyValueTags(pcx.Tags).IgnoreAws().IgnoreConfig(ignoreTagsConfig).Map()); err != nil { return fmt.Errorf("error setting tags: %s", err) diff --git a/aws/data_source_aws_vpc_peering_connection_test.go b/aws/data_source_aws_vpc_peering_connection_test.go index 56911c680eb7..7596824e6e18 100644 --- a/aws/data_source_aws_vpc_peering_connection_test.go +++ b/aws/data_source_aws_vpc_peering_connection_test.go @@ -19,21 +19,45 @@ func TestAccDataSourceAwsVpcPeeringConnection_basic(t *testing.T) { testAccDataSourceAwsVpcPeeringConnectionCheck("data.aws_vpc_peering_connection.test_by_id"), resource.TestCheckResourceAttrSet("data.aws_vpc_peering_connection.test_by_id", "id"), resource.TestCheckResourceAttrSet("data.aws_vpc_peering_connection.test_by_id", "cidr_block"), + resource.TestCheckResourceAttrSet("data.aws_vpc_peering_connection.test_by_id", "cidr_block_set.0.cidr_block"), + resource.TestCheckResourceAttrSet("data.aws_vpc_peering_connection.test_by_id", "cidr_block_set.1.cidr_block"), + resource.TestCheckResourceAttrSet("data.aws_vpc_peering_connection.test_by_id", "cidr_block_set.0.cidr_block"), + resource.TestCheckResourceAttrSet("data.aws_vpc_peering_connection.test_by_id", "peer_cidr_block_set.1.cidr_block"), testAccDataSourceAwsVpcPeeringConnectionCheck("data.aws_vpc_peering_connection.test_by_requester_vpc_id"), resource.TestCheckResourceAttrSet("data.aws_vpc_peering_connection.test_by_requester_vpc_id", "id"), resource.TestCheckResourceAttrSet("data.aws_vpc_peering_connection.test_by_requester_vpc_id", "cidr_block"), + resource.TestCheckResourceAttrSet("data.aws_vpc_peering_connection.test_by_requester_vpc_id", "cidr_block_set.0.cidr_block"), + resource.TestCheckResourceAttrSet("data.aws_vpc_peering_connection.test_by_requester_vpc_id", "cidr_block_set.1.cidr_block"), + resource.TestCheckResourceAttrSet("data.aws_vpc_peering_connection.test_by_requester_vpc_id", "cidr_block_set.0.cidr_block"), + resource.TestCheckResourceAttrSet("data.aws_vpc_peering_connection.test_by_requester_vpc_id", "peer_cidr_block_set.1.cidr_block"), testAccDataSourceAwsVpcPeeringConnectionCheck("data.aws_vpc_peering_connection.test_by_accepter_vpc_id"), resource.TestCheckResourceAttrSet("data.aws_vpc_peering_connection.test_by_accepter_vpc_id", "id"), resource.TestCheckResourceAttrSet("data.aws_vpc_peering_connection.test_by_accepter_vpc_id", "cidr_block"), + resource.TestCheckResourceAttrSet("data.aws_vpc_peering_connection.test_by_accepter_vpc_id", "cidr_block_set.0.cidr_block"), + resource.TestCheckResourceAttrSet("data.aws_vpc_peering_connection.test_by_accepter_vpc_id", "cidr_block_set.1.cidr_block"), + resource.TestCheckResourceAttrSet("data.aws_vpc_peering_connection.test_by_accepter_vpc_id", "cidr_block_set.0.cidr_block"), + resource.TestCheckResourceAttrSet("data.aws_vpc_peering_connection.test_by_accepter_vpc_id", "peer_cidr_block_set.1.cidr_block"), testAccDataSourceAwsVpcPeeringConnectionCheck("data.aws_vpc_peering_connection.test_by_requester_cidr_block"), resource.TestCheckResourceAttrSet("data.aws_vpc_peering_connection.test_by_requester_cidr_block", "id"), resource.TestCheckResourceAttrSet("data.aws_vpc_peering_connection.test_by_requester_cidr_block", "cidr_block"), + resource.TestCheckResourceAttrSet("data.aws_vpc_peering_connection.test_by_requester_cidr_block", "cidr_block_set.0.cidr_block"), + resource.TestCheckResourceAttrSet("data.aws_vpc_peering_connection.test_by_requester_cidr_block", "cidr_block_set.1.cidr_block"), + resource.TestCheckResourceAttrSet("data.aws_vpc_peering_connection.test_by_requester_cidr_block", "cidr_block_set.0.cidr_block"), + resource.TestCheckResourceAttrSet("data.aws_vpc_peering_connection.test_by_requester_cidr_block", "peer_cidr_block_set.1.cidr_block"), testAccDataSourceAwsVpcPeeringConnectionCheck("data.aws_vpc_peering_connection.test_by_accepter_cidr_block"), resource.TestCheckResourceAttrSet("data.aws_vpc_peering_connection.test_by_accepter_cidr_block", "id"), resource.TestCheckResourceAttrSet("data.aws_vpc_peering_connection.test_by_accepter_cidr_block", "cidr_block"), + resource.TestCheckResourceAttrSet("data.aws_vpc_peering_connection.test_by_accepter_cidr_block", "cidr_block_set.0.cidr_block"), + resource.TestCheckResourceAttrSet("data.aws_vpc_peering_connection.test_by_accepter_cidr_block", "cidr_block_set.1.cidr_block"), + resource.TestCheckResourceAttrSet("data.aws_vpc_peering_connection.test_by_accepter_cidr_block", "cidr_block_set.0.cidr_block"), + resource.TestCheckResourceAttrSet("data.aws_vpc_peering_connection.test_by_accepter_cidr_block", "peer_cidr_block_set.1.cidr_block"), testAccDataSourceAwsVpcPeeringConnectionCheck("data.aws_vpc_peering_connection.test_by_owner_ids"), resource.TestCheckResourceAttrSet("data.aws_vpc_peering_connection.test_by_owner_ids", "id"), resource.TestCheckResourceAttrSet("data.aws_vpc_peering_connection.test_by_owner_ids", "cidr_block"), + resource.TestCheckResourceAttrSet("data.aws_vpc_peering_connection.test_by_owner_ids", "cidr_block_set.0.cidr_block"), + resource.TestCheckResourceAttrSet("data.aws_vpc_peering_connection.test_by_owner_ids", "cidr_block_set.1.cidr_block"), + resource.TestCheckResourceAttrSet("data.aws_vpc_peering_connection.test_by_owner_ids", "cidr_block_set.0.cidr_block"), + resource.TestCheckResourceAttrSet("data.aws_vpc_peering_connection.test_by_owner_ids", "peer_cidr_block_set.1.cidr_block"), ), ExpectNonEmptyPlan: true, }, @@ -76,6 +100,11 @@ resource "aws_vpc" "foo" { } } +resource "aws_vpc_ipv4_cidr_block_association" "foo_secondary_cidr" { + vpc_id = "${aws_vpc.foo.id}" + cidr_block = "10.4.0.0/16" +} + resource "aws_vpc" "bar" { cidr_block = "10.2.0.0/16" @@ -84,6 +113,11 @@ resource "aws_vpc" "bar" { } } +resource "aws_vpc_ipv4_cidr_block_association" "bar_secondary_cidr" { + vpc_id = "${aws_vpc.bar.id}" + cidr_block = "10.8.0.0/16" +} + resource "aws_vpc_peering_connection" "test" { vpc_id = "${aws_vpc.foo.id}" peer_vpc_id = "${aws_vpc.bar.id}" @@ -91,7 +125,9 @@ resource "aws_vpc_peering_connection" "test" { tags = { Name = "terraform-testacc-vpc-peering-connection-data-source-foo-to-bar" - } + } + + depends_on = ["aws_vpc_ipv4_cidr_block_association.foo_secondary_cidr", "aws_vpc_ipv4_cidr_block_association.bar_secondary_cidr"] } data "aws_caller_identity" "current" {} From 46c6b0e3a99eca7540f794ebba339dab4505e1ef Mon Sep 17 00:00:00 2001 From: sanzalb Date: Wed, 20 May 2020 15:53:10 +0200 Subject: [PATCH 2/5] Moved CIDR block set checks to another test --- ..._source_aws_vpc_peering_connection_test.go | 101 +++++++++++------- 1 file changed, 64 insertions(+), 37 deletions(-) diff --git a/aws/data_source_aws_vpc_peering_connection_test.go b/aws/data_source_aws_vpc_peering_connection_test.go index 7596824e6e18..0d3360acda29 100644 --- a/aws/data_source_aws_vpc_peering_connection_test.go +++ b/aws/data_source_aws_vpc_peering_connection_test.go @@ -19,45 +19,21 @@ func TestAccDataSourceAwsVpcPeeringConnection_basic(t *testing.T) { testAccDataSourceAwsVpcPeeringConnectionCheck("data.aws_vpc_peering_connection.test_by_id"), resource.TestCheckResourceAttrSet("data.aws_vpc_peering_connection.test_by_id", "id"), resource.TestCheckResourceAttrSet("data.aws_vpc_peering_connection.test_by_id", "cidr_block"), - resource.TestCheckResourceAttrSet("data.aws_vpc_peering_connection.test_by_id", "cidr_block_set.0.cidr_block"), - resource.TestCheckResourceAttrSet("data.aws_vpc_peering_connection.test_by_id", "cidr_block_set.1.cidr_block"), - resource.TestCheckResourceAttrSet("data.aws_vpc_peering_connection.test_by_id", "cidr_block_set.0.cidr_block"), - resource.TestCheckResourceAttrSet("data.aws_vpc_peering_connection.test_by_id", "peer_cidr_block_set.1.cidr_block"), testAccDataSourceAwsVpcPeeringConnectionCheck("data.aws_vpc_peering_connection.test_by_requester_vpc_id"), resource.TestCheckResourceAttrSet("data.aws_vpc_peering_connection.test_by_requester_vpc_id", "id"), resource.TestCheckResourceAttrSet("data.aws_vpc_peering_connection.test_by_requester_vpc_id", "cidr_block"), - resource.TestCheckResourceAttrSet("data.aws_vpc_peering_connection.test_by_requester_vpc_id", "cidr_block_set.0.cidr_block"), - resource.TestCheckResourceAttrSet("data.aws_vpc_peering_connection.test_by_requester_vpc_id", "cidr_block_set.1.cidr_block"), - resource.TestCheckResourceAttrSet("data.aws_vpc_peering_connection.test_by_requester_vpc_id", "cidr_block_set.0.cidr_block"), - resource.TestCheckResourceAttrSet("data.aws_vpc_peering_connection.test_by_requester_vpc_id", "peer_cidr_block_set.1.cidr_block"), testAccDataSourceAwsVpcPeeringConnectionCheck("data.aws_vpc_peering_connection.test_by_accepter_vpc_id"), resource.TestCheckResourceAttrSet("data.aws_vpc_peering_connection.test_by_accepter_vpc_id", "id"), resource.TestCheckResourceAttrSet("data.aws_vpc_peering_connection.test_by_accepter_vpc_id", "cidr_block"), - resource.TestCheckResourceAttrSet("data.aws_vpc_peering_connection.test_by_accepter_vpc_id", "cidr_block_set.0.cidr_block"), - resource.TestCheckResourceAttrSet("data.aws_vpc_peering_connection.test_by_accepter_vpc_id", "cidr_block_set.1.cidr_block"), - resource.TestCheckResourceAttrSet("data.aws_vpc_peering_connection.test_by_accepter_vpc_id", "cidr_block_set.0.cidr_block"), - resource.TestCheckResourceAttrSet("data.aws_vpc_peering_connection.test_by_accepter_vpc_id", "peer_cidr_block_set.1.cidr_block"), testAccDataSourceAwsVpcPeeringConnectionCheck("data.aws_vpc_peering_connection.test_by_requester_cidr_block"), resource.TestCheckResourceAttrSet("data.aws_vpc_peering_connection.test_by_requester_cidr_block", "id"), resource.TestCheckResourceAttrSet("data.aws_vpc_peering_connection.test_by_requester_cidr_block", "cidr_block"), - resource.TestCheckResourceAttrSet("data.aws_vpc_peering_connection.test_by_requester_cidr_block", "cidr_block_set.0.cidr_block"), - resource.TestCheckResourceAttrSet("data.aws_vpc_peering_connection.test_by_requester_cidr_block", "cidr_block_set.1.cidr_block"), - resource.TestCheckResourceAttrSet("data.aws_vpc_peering_connection.test_by_requester_cidr_block", "cidr_block_set.0.cidr_block"), - resource.TestCheckResourceAttrSet("data.aws_vpc_peering_connection.test_by_requester_cidr_block", "peer_cidr_block_set.1.cidr_block"), testAccDataSourceAwsVpcPeeringConnectionCheck("data.aws_vpc_peering_connection.test_by_accepter_cidr_block"), resource.TestCheckResourceAttrSet("data.aws_vpc_peering_connection.test_by_accepter_cidr_block", "id"), resource.TestCheckResourceAttrSet("data.aws_vpc_peering_connection.test_by_accepter_cidr_block", "cidr_block"), - resource.TestCheckResourceAttrSet("data.aws_vpc_peering_connection.test_by_accepter_cidr_block", "cidr_block_set.0.cidr_block"), - resource.TestCheckResourceAttrSet("data.aws_vpc_peering_connection.test_by_accepter_cidr_block", "cidr_block_set.1.cidr_block"), - resource.TestCheckResourceAttrSet("data.aws_vpc_peering_connection.test_by_accepter_cidr_block", "cidr_block_set.0.cidr_block"), - resource.TestCheckResourceAttrSet("data.aws_vpc_peering_connection.test_by_accepter_cidr_block", "peer_cidr_block_set.1.cidr_block"), testAccDataSourceAwsVpcPeeringConnectionCheck("data.aws_vpc_peering_connection.test_by_owner_ids"), resource.TestCheckResourceAttrSet("data.aws_vpc_peering_connection.test_by_owner_ids", "id"), resource.TestCheckResourceAttrSet("data.aws_vpc_peering_connection.test_by_owner_ids", "cidr_block"), - resource.TestCheckResourceAttrSet("data.aws_vpc_peering_connection.test_by_owner_ids", "cidr_block_set.0.cidr_block"), - resource.TestCheckResourceAttrSet("data.aws_vpc_peering_connection.test_by_owner_ids", "cidr_block_set.1.cidr_block"), - resource.TestCheckResourceAttrSet("data.aws_vpc_peering_connection.test_by_owner_ids", "cidr_block_set.0.cidr_block"), - resource.TestCheckResourceAttrSet("data.aws_vpc_peering_connection.test_by_owner_ids", "peer_cidr_block_set.1.cidr_block"), ), ExpectNonEmptyPlan: true, }, @@ -65,6 +41,25 @@ func TestAccDataSourceAwsVpcPeeringConnection_basic(t *testing.T) { }) } +func TestAccDataSourceAwsVpcPeeringConnection_cidBlockSets(t *testing.T) { + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + Steps: []resource.TestStep{ + { + Config: testAccDataSourceAwsVpcPeeringConnectionCidrBlockSetConfig, + Check: resource.ComposeTestCheckFunc( + testAccDataSourceAwsVpcPeeringConnectionCheck("data.aws_vpc_peering_connection.test_by_id"), + resource.TestCheckResourceAttrSet("data.aws_vpc_peering_connection.test_by_id", "cidr_block_set.0.cidr_block"), + resource.TestCheckResourceAttrSet("data.aws_vpc_peering_connection.test_by_id", "cidr_block_set.1.cidr_block"), + resource.TestCheckResourceAttrSet("data.aws_vpc_peering_connection.test_by_id", "peer_cidr_block_set.0.cidr_block"), + resource.TestCheckResourceAttrSet("data.aws_vpc_peering_connection.test_by_id", "peer_cidr_block_set.1.cidr_block"), + ), + }, + }, + }) +} + func testAccDataSourceAwsVpcPeeringConnectionCheck(name string) resource.TestCheckFunc { return func(s *terraform.State) error { rs, ok := s.RootModule().Resources[name] @@ -100,11 +95,6 @@ resource "aws_vpc" "foo" { } } -resource "aws_vpc_ipv4_cidr_block_association" "foo_secondary_cidr" { - vpc_id = "${aws_vpc.foo.id}" - cidr_block = "10.4.0.0/16" -} - resource "aws_vpc" "bar" { cidr_block = "10.2.0.0/16" @@ -113,11 +103,6 @@ resource "aws_vpc" "bar" { } } -resource "aws_vpc_ipv4_cidr_block_association" "bar_secondary_cidr" { - vpc_id = "${aws_vpc.bar.id}" - cidr_block = "10.8.0.0/16" -} - resource "aws_vpc_peering_connection" "test" { vpc_id = "${aws_vpc.foo.id}" peer_vpc_id = "${aws_vpc.bar.id}" @@ -125,9 +110,7 @@ resource "aws_vpc_peering_connection" "test" { tags = { Name = "terraform-testacc-vpc-peering-connection-data-source-foo-to-bar" - } - - depends_on = ["aws_vpc_ipv4_cidr_block_association.foo_secondary_cidr", "aws_vpc_ipv4_cidr_block_association.bar_secondary_cidr"] + } } data "aws_caller_identity" "current" {} @@ -170,3 +153,47 @@ data "aws_vpc_peering_connection" "test_by_owner_ids" { depends_on = ["aws_vpc_peering_connection.test"] } ` + +const testAccDataSourceAwsVpcPeeringConnectionCidrBlockSetConfig = ` +resource "aws_vpc" "foo" { + cidr_block = "10.4.0.0/16" + + tags = { + Name = "terraform-testacc-vpc-peering-connection-data-source-foo-cidr-block-set" + } +} + +resource "aws_vpc_ipv4_cidr_block_association" "foo_secondary_cidr" { + vpc_id = "${aws_vpc.foo.id}" + cidr_block = "10.5.0.0/16" +} + +resource "aws_vpc" "bar" { + cidr_block = "10.6.0.0/16" + + tags = { + Name = "terraform-testacc-vpc-peering-connection-data-source-bar-cidr-block-set" + } +} + +resource "aws_vpc_ipv4_cidr_block_association" "bar_secondary_cidr" { + vpc_id = "${aws_vpc.bar.id}" + cidr_block = "10.7.0.0/16" +} + +resource "aws_vpc_peering_connection" "test" { + vpc_id = "${aws_vpc.foo.id}" + peer_vpc_id = "${aws_vpc.bar.id}" + auto_accept = true + + tags = { + Name = "terraform-testacc-vpc-peering-connection-data-source-foo-to-bar-cidr-block-set" + } + + depends_on = ["aws_vpc_ipv4_cidr_block_association.foo_secondary_cidr", "aws_vpc_ipv4_cidr_block_association.bar_secondary_cidr"] +} + +data "aws_vpc_peering_connection" "test_by_id" { + id = "${aws_vpc_peering_connection.test.id}" +} +` From 9cdcec2dd2e9536c1603f7860a2eb659c70f7bb8 Mon Sep 17 00:00:00 2001 From: sanzalb Date: Wed, 20 May 2020 15:53:18 +0200 Subject: [PATCH 3/5] Updated docs --- website/docs/d/vpc_peering_connection.html.markdown | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/website/docs/d/vpc_peering_connection.html.markdown b/website/docs/d/vpc_peering_connection.html.markdown index 324f1ab570f5..c92abb590a7c 100644 --- a/website/docs/d/vpc_peering_connection.html.markdown +++ b/website/docs/d/vpc_peering_connection.html.markdown @@ -46,7 +46,7 @@ The given filters must match exactly one VPC peering connection whose data will * `owner_id` - (Optional) The AWS account ID of the owner of the requester VPC of the specific VPC Peering Connection to retrieve. -* `cidr_block` - (Optional) The CIDR block of the requester VPC of the specific VPC Peering Connection to retrieve. +* `cidr_block` - (Optional) The primary CIDR block of the requester VPC of the specific VPC Peering Connection to retrieve. * `region` - (Optional) The region of the requester VPC of the specific VPC Peering Connection to retrieve. @@ -54,7 +54,7 @@ The given filters must match exactly one VPC peering connection whose data will * `peer_owner_id` - (Optional) The AWS account ID of the owner of the accepter VPC of the specific VPC Peering Connection to retrieve. -* `peer_cidr_block` - (Optional) The CIDR block of the accepter VPC of the specific VPC Peering Connection to retrieve. +* `peer_cidr_block` - (Optional) The primary CIDR block of the accepter VPC of the specific VPC Peering Connection to retrieve. * `peer_region` - (Optional) The region of the accepter VPC of the specific VPC Peering Connection to retrieve. @@ -82,6 +82,10 @@ All of the argument attributes except `filter` are also exported as result attri * `requester` - A configuration block that describes [VPC Peering Connection] (http://docs.aws.amazon.com/AmazonVPC/latest/PeeringGuide) options set for the requester VPC. +* `cidr_block_set` - (Optional) The list of all CIDR blocks of the requester VPC of the specific VPC Peering Connection to retrieve. + +* `peer_cidr_block_set` - (Optional) The list of all CIDR blocks of the accepter VPC of the specific VPC Peering Connection to retrieve. + #### Accepter and Requester Attributes Reference * `allow_remote_vpc_dns_resolution` - Indicates whether a local VPC can resolve public DNS hostnames to @@ -92,3 +96,7 @@ with the peer VPC over the VPC peering connection. * `allow_vpc_to_remote_classic_link` - Indicates whether a local VPC can communicate with a ClassicLink connection in the peer VPC over the VPC peering connection. + +#### CIDR block set Attributes Reference + +* `cidr_block` - A CIDR block associated to the VPC of the specific VPC Peering Connection. From b6f983bdb5206ee3baec70dc61e778bf71291a44 Mon Sep 17 00:00:00 2001 From: sanzalb Date: Fri, 22 May 2020 08:18:58 +0200 Subject: [PATCH 4/5] Fix typo --- aws/data_source_aws_vpc_peering_connection_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aws/data_source_aws_vpc_peering_connection_test.go b/aws/data_source_aws_vpc_peering_connection_test.go index 0d3360acda29..7a43cf9bea9d 100644 --- a/aws/data_source_aws_vpc_peering_connection_test.go +++ b/aws/data_source_aws_vpc_peering_connection_test.go @@ -41,7 +41,7 @@ func TestAccDataSourceAwsVpcPeeringConnection_basic(t *testing.T) { }) } -func TestAccDataSourceAwsVpcPeeringConnection_cidBlockSets(t *testing.T) { +func TestAccDataSourceAwsVpcPeeringConnection_cidrBlockSets(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, From 550b9714341952915b36a952d327b8f9b2a5f015 Mon Sep 17 00:00:00 2001 From: sanzalb Date: Wed, 12 Aug 2020 10:53:39 +0200 Subject: [PATCH 5/5] Updated to Terraform 0.12 syntax --- ..._source_aws_vpc_peering_connection_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/aws/data_source_aws_vpc_peering_connection_test.go b/aws/data_source_aws_vpc_peering_connection_test.go index 7a43cf9bea9d..68fef0e46269 100644 --- a/aws/data_source_aws_vpc_peering_connection_test.go +++ b/aws/data_source_aws_vpc_peering_connection_test.go @@ -104,8 +104,8 @@ resource "aws_vpc" "bar" { } resource "aws_vpc_peering_connection" "test" { - vpc_id = "${aws_vpc.foo.id}" - peer_vpc_id = "${aws_vpc.bar.id}" + vpc_id = aws_vpc.foo.id + peer_vpc_id = aws_vpc.bar.id auto_accept = true tags = { @@ -116,17 +116,17 @@ resource "aws_vpc_peering_connection" "test" { data "aws_caller_identity" "current" {} data "aws_vpc_peering_connection" "test_by_id" { - id = "${aws_vpc_peering_connection.test.id}" + id = aws_vpc_peering_connection.test.id } data "aws_vpc_peering_connection" "test_by_requester_vpc_id" { - vpc_id = "${aws_vpc.foo.id}" + vpc_id = aws_vpc.foo.id depends_on = ["aws_vpc_peering_connection.test"] } data "aws_vpc_peering_connection" "test_by_accepter_vpc_id" { - peer_vpc_id = "${aws_vpc.bar.id}" + peer_vpc_id = aws_vpc.bar.id depends_on = ["aws_vpc_peering_connection.test"] } @@ -146,8 +146,8 @@ data "aws_vpc_peering_connection" "test_by_accepter_cidr_block" { } data "aws_vpc_peering_connection" "test_by_owner_ids" { - owner_id = "${data.aws_caller_identity.current.account_id}" - peer_owner_id = "${data.aws_caller_identity.current.account_id}" + owner_id = data.aws_caller_identity.current.account_id + peer_owner_id = data.aws_caller_identity.current.account_id status = "active" depends_on = ["aws_vpc_peering_connection.test"] @@ -164,7 +164,7 @@ resource "aws_vpc" "foo" { } resource "aws_vpc_ipv4_cidr_block_association" "foo_secondary_cidr" { - vpc_id = "${aws_vpc.foo.id}" + vpc_id = aws_vpc.foo.id cidr_block = "10.5.0.0/16" } @@ -177,13 +177,13 @@ resource "aws_vpc" "bar" { } resource "aws_vpc_ipv4_cidr_block_association" "bar_secondary_cidr" { - vpc_id = "${aws_vpc.bar.id}" + vpc_id = aws_vpc.bar.id cidr_block = "10.7.0.0/16" } resource "aws_vpc_peering_connection" "test" { - vpc_id = "${aws_vpc.foo.id}" - peer_vpc_id = "${aws_vpc.bar.id}" + vpc_id = aws_vpc.foo.id + peer_vpc_id = aws_vpc.bar.id auto_accept = true tags = { @@ -194,6 +194,6 @@ resource "aws_vpc_peering_connection" "test" { } data "aws_vpc_peering_connection" "test_by_id" { - id = "${aws_vpc_peering_connection.test.id}" + id = aws_vpc_peering_connection.test.id } `