From 4476da363117d647ce76d60b006c05cfb85c6ede Mon Sep 17 00:00:00 2001 From: Arjun Raj Date: Tue, 16 Jun 2020 14:12:21 +1000 Subject: [PATCH 1/3] feat: added aws_vpc_connection_id property for vpc peering resources --- instaclustr/resource_vpc_peering.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/instaclustr/resource_vpc_peering.go b/instaclustr/resource_vpc_peering.go index a25da267..ceaaaf37 100644 --- a/instaclustr/resource_vpc_peering.go +++ b/instaclustr/resource_vpc_peering.go @@ -51,6 +51,11 @@ func resourceVpcPeering() *schema.Resource { Type: schema.TypeString, Optional: true, }, + + "aws_vpc_connection_id": { + Type: schema.TypeString, + Computed: true, + }, }, } } @@ -92,6 +97,14 @@ func resourceVpcPeeringCreate(d *schema.ResourceData, meta interface{}) error { d.SetId(id) d.Set("vpc_peering_id", id) d.Set("cdc_id", cdcID) + + vpcPeering, err := client.ReadVpcPeering(cdcID, id) + if err != nil { + return fmt.Errorf("[Error] Error reading VPC peering connection: %s", err) + } + + d.Set("aws_vpc_connection_id", vpcPeering.AWSVpcConnectionID) + log.Printf("[INFO] VPC peering request %s has been created.", id) return nil } @@ -116,6 +129,7 @@ func resourceVpcPeeringRead(d *schema.ResourceData, meta interface{}) error { d.Set("cdc_id", vpcPeering.ClusterDataCentre) d.Set("peer_vpc_id", vpcPeering.PeerVpcID) d.Set("peer_account_id", vpcPeering.PeerAccountID) + d.Set("aws_vpc_connection_id", vpcPeering.AWSVpcConnectionID) before, _ := d.GetChange("peer_subnet") d.Set("peer_subnet", before) From 3fa6f554438b338bb93c6f6cf90343caa2f22150 Mon Sep 17 00:00:00 2001 From: Arjun Raj Date: Tue, 16 Jun 2020 14:12:39 +1000 Subject: [PATCH 2/3] chore: Bumped up version to 1.2.0 --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 6731c7b8..3b3ec616 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ BIN_NAME="terraform-provider-instaclustr" -VERSION=v1.1.0 +VERSION=v1.2.0 .PHONY: install clean all build test testacc From 97ad3a7992c19c05fa06b2b0fa530e36df6c1ed3 Mon Sep 17 00:00:00 2001 From: Arjun Raj Date: Tue, 16 Jun 2020 14:20:40 +1000 Subject: [PATCH 3/3] docs: Added description for aws_vpc_connection_id to README --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 08249083..d6eb3acf 100644 --- a/README.md +++ b/README.md @@ -203,6 +203,7 @@ peer_vpc_id|The ID of the VPC with which you are creating the VPC peering connec peer_account_id|The account ID of the owner of the accepter VPC|Required peer_subnet|The subnet for the VPC|Required peer_region| The Region code for the accepter VPC, if the accepter VPC is located in a Region other than the Region in which you make the request. | Not Required +aws_vpc_connection_id| The ID of the VPC peering connection. | Computed #### Example