From 8e144465114613fe176f967dfeb4e32a97997edd Mon Sep 17 00:00:00 2001 From: Paras Prajapati <15036233+paraspraj@users.noreply.github.com> Date: Fri, 9 Sep 2022 14:37:07 -0400 Subject: [PATCH] Replace ReadContext with ReadWithoutTimeout (#389) * replace readcontext with reacwithouttimeout * replace ReadContext with ReadWithoutTimeout in AWS peering data source * drop azure_peering_id assertion and add clarifying comment * use timeout constant directly instead of schema timeout Co-authored-by: Brenna Hewer-Darroch <21015366+bcmdarroch@users.noreply.github.com> --- internal/provider/data_source_aws_network_peering.go | 6 +++--- internal/provider/data_source_azure_peering_connection.go | 6 +++--- internal/provider/resource_azure_peering_connection_test.go | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/internal/provider/data_source_aws_network_peering.go b/internal/provider/data_source_aws_network_peering.go index bdcf8a5cf..248eb2c30 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, }, @@ -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 6d622cd84..cb985a436 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, }, @@ -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) } 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