From 1846912f067575744974679d651d1a6e3c76560d Mon Sep 17 00:00:00 2001 From: Paras Prajapati Date: Thu, 8 Sep 2022 13:56:40 -0400 Subject: [PATCH 1/4] replace readcontext with reacwithouttimeout --- internal/provider/data_source_azure_peering_connection.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/provider/data_source_azure_peering_connection.go b/internal/provider/data_source_azure_peering_connection.go index 6d622cd84..9da921ef6 100644 --- a/internal/provider/data_source_azure_peering_connection.go +++ b/internal/provider/data_source_azure_peering_connection.go @@ -13,8 +13,8 @@ import ( func dataSourceAzurePeeringConnection() *schema.Resource { return &schema.Resource{ - Description: "The Azure peering connection data source provides information about a peering connection between an HVN and a peer Azure VNet.", - ReadContext: dataSourceAzurePeeringConnectionRead, + Description: "The Azure peering connection data source provides information about a peering connection between an HVN and a peer Azure VNet.", + ReadWithoutTimeout: dataSourceAzurePeeringConnectionRead, Timeouts: &schema.ResourceTimeout{ Read: &peeringCreateTimeout, }, From f740030b575b1c09e852572c4d87f84155658a4b Mon Sep 17 00:00:00 2001 From: Brenna Hewer-Darroch <21015366+bcmdarroch@users.noreply.github.com> Date: Thu, 8 Sep 2022 14:56:12 -0400 Subject: [PATCH 2/4] replace ReadContext with ReadWithoutTimeout in AWS peering data source --- internal/provider/data_source_aws_network_peering.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/provider/data_source_aws_network_peering.go b/internal/provider/data_source_aws_network_peering.go index bdcf8a5cf..24d4ca174 100644 --- a/internal/provider/data_source_aws_network_peering.go +++ b/internal/provider/data_source_aws_network_peering.go @@ -13,8 +13,8 @@ import ( func dataSourceAwsNetworkPeering() *schema.Resource { return &schema.Resource{ - Description: "The AWS network peering data source provides information about an existing network peering between an HVN and a peer AWS VPC.", - ReadContext: dataSourceAwsNetworkPeeringRead, + Description: "The AWS network peering data source provides information about an existing network peering between an HVN and a peer AWS VPC.", + ReadWithoutTimeout: dataSourceAwsNetworkPeeringRead, Timeouts: &schema.ResourceTimeout{ Read: &peeringCreateTimeout, }, From 1ff64e588a34ba57ff9c7263d993bce33242045e Mon Sep 17 00:00:00 2001 From: Brenna Hewer-Darroch <21015366+bcmdarroch@users.noreply.github.com> Date: Thu, 8 Sep 2022 18:28:50 -0400 Subject: [PATCH 3/4] drop azure_peering_id assertion and add clarifying comment --- internal/provider/resource_azure_peering_connection_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/provider/resource_azure_peering_connection_test.go b/internal/provider/resource_azure_peering_connection_test.go index d47e736e9..008da779e 100644 --- a/internal/provider/resource_azure_peering_connection_test.go +++ b/internal/provider/resource_azure_peering_connection_test.go @@ -122,13 +122,13 @@ func TestAccAzurePeeringConnection(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "peer_tenant_id", tenantID), resource.TestCheckResourceAttr(resourceName, "peer_vnet_name", uniqueAzurePeeringTestID), resource.TestCheckResourceAttrSet(resourceName, "peer_vnet_region"), - resource.TestCheckResourceAttrSet(resourceName, "azure_peering_id"), resource.TestCheckResourceAttrSet(resourceName, "organization_id"), resource.TestCheckResourceAttrSet(resourceName, "project_id"), resource.TestCheckResourceAttrSet(resourceName, "created_at"), resource.TestCheckResourceAttrSet(resourceName, "expires_at"), resource.TestCheckResourceAttrSet(resourceName, "state"), testLink(resourceName, "self_link", uniqueAzurePeeringTestID, PeeringResourceType, "hcp_hvn.test"), + // Note: azure_peering_id is not set until the peering is accepted after creation. ), }, // Tests import From 64e864b631245a8db762ab1bc96d24b98bb79775 Mon Sep 17 00:00:00 2001 From: Brenna Hewer-Darroch <21015366+bcmdarroch@users.noreply.github.com> Date: Thu, 8 Sep 2022 20:12:58 -0400 Subject: [PATCH 4/4] use timeout constant directly instead of schema timeout --- internal/provider/data_source_aws_network_peering.go | 2 +- internal/provider/data_source_azure_peering_connection.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/provider/data_source_aws_network_peering.go b/internal/provider/data_source_aws_network_peering.go index 24d4ca174..248eb2c30 100644 --- a/internal/provider/data_source_aws_network_peering.go +++ b/internal/provider/data_source_aws_network_peering.go @@ -114,7 +114,7 @@ func dataSourceAwsNetworkPeeringRead(ctx context.Context, d *schema.ResourceData } if waitForActive && peering.State != networkmodels.HashicorpCloudNetwork20200907PeeringStateACTIVE { - peering, err = clients.WaitForPeeringToBeActive(ctx, client, peering.ID, hvnID, loc, d.Timeout(schema.TimeoutRead)) + peering, err = clients.WaitForPeeringToBeActive(ctx, client, peering.ID, hvnID, loc, peeringCreateTimeout) if err != nil { return diag.FromErr(err) } diff --git a/internal/provider/data_source_azure_peering_connection.go b/internal/provider/data_source_azure_peering_connection.go index 9da921ef6..cb985a436 100644 --- a/internal/provider/data_source_azure_peering_connection.go +++ b/internal/provider/data_source_azure_peering_connection.go @@ -129,7 +129,7 @@ func dataSourceAzurePeeringConnectionRead(ctx context.Context, d *schema.Resourc } if waitForActive && peering.State != networkmodels.HashicorpCloudNetwork20200907PeeringStateACTIVE { - peering, err = clients.WaitForPeeringToBeActive(ctx, client, peering.ID, hvnLink.ID, loc, d.Timeout(schema.TimeoutRead)) + peering, err = clients.WaitForPeeringToBeActive(ctx, client, peering.ID, hvnLink.ID, loc, peeringCreateTimeout) if err != nil { return diag.FromErr(err) }