Skip to content

Commit

Permalink
[hashicorp#9209] Fix dx gateway association proposal so it works even…
Browse files Browse the repository at this point in the history
… if expired
  • Loading branch information
blckct authored and Omarimcblack committed Sep 28, 2020
1 parent 01995c1 commit aa9ea2e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 6 additions & 3 deletions aws/resource_aws_dx_gateway_association_proposal.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}),
),

Expand Down Expand Up @@ -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
}

Expand Down
2 changes: 2 additions & 0 deletions website/docs/r/dx_gateway_association_proposal.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit aa9ea2e

Please sign in to comment.