From aa9ea2e0e736ea1830441452bfe1c51eef7d228d Mon Sep 17 00:00:00 2001 From: Jakub Kania Date: Mon, 2 Mar 2020 02:16:35 +0100 Subject: [PATCH] [#9209] Fix dx gateway association proposal so it works even if expired --- aws/resource_aws_dx_gateway_association_proposal.go | 9 ++++++--- .../docs/r/dx_gateway_association_proposal.html.markdown | 2 ++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_dx_gateway_association_proposal.go b/aws/resource_aws_dx_gateway_association_proposal.go index 26b463a579b..93df7684e1f 100644 --- a/aws/resource_aws_dx_gateway_association_proposal.go +++ b/aws/resource_aws_dx_gateway_association_proposal.go @@ -31,7 +31,11 @@ func resourceAwsDxGatewayAssociationProposal() *schema.Resource { return false } - return proposal != nil && aws.StringValue(proposal.ProposalState) == directconnect.GatewayAssociationProposalStateRequested + if proposal == nil { + return true + } + + return aws.StringValue(proposal.ProposalState) == directconnect.GatewayAssociationProposalStateRequested }), ), @@ -122,8 +126,7 @@ func resourceAwsDxGatewayAssociationProposalRead(d *schema.ResourceData, meta in } if proposal == nil { - log.Printf("[WARN] Direct Connect Gateway Association Proposal (%s) not found, removing from state", d.Id()) - d.SetId("") + //The resource may have expired, return the last known state return nil } diff --git a/website/docs/r/dx_gateway_association_proposal.html.markdown b/website/docs/r/dx_gateway_association_proposal.html.markdown index 630ab642302..8123892aee7 100644 --- a/website/docs/r/dx_gateway_association_proposal.html.markdown +++ b/website/docs/r/dx_gateway_association_proposal.html.markdown @@ -10,6 +10,8 @@ description: |- Manages a Direct Connect Gateway Association Proposal, typically for enabling cross-account associations. For single account associations, see the [`aws_dx_gateway_association` resource](/docs/providers/aws/r/dx_gateway_association.html). +~> **NOTE:** The proposal expires after some time so the resource keeps returning the last known state. If you need to create it again you have to taint it. + ## Example Usage ```hcl