Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#9209] Fix dx gateway association proposal so it works even if expired #12221

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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