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

resource/aws_dx_connection_association: Retry disassociation #3212

Merged
merged 1 commit into from
Feb 1, 2018

Conversation

radeksimko
Copy link
Member

This is to address the following test failure:

=== RUN   TestAccAwsDxConnectionAssociation_multiConns
--- FAIL: TestAccAwsDxConnectionAssociation_multiConns (6.83s)
    testing.go:573: Error destroying resource! WARNING: Dangling resources
        may exist. The full state and error is shown below.
        
        Error: Error applying: 2 error(s) occurred:
        
        * aws_dx_connection_association.test1 (destroy): 1 error(s) occurred:
        
        * aws_dx_connection_association.test1: DirectConnectClientException: Connection dxcon-fh9yptf2 is in a transitioning state.
            status code: 400, request id: 8c7f1f03-0323-11e8-9b6e-1bcbdac10921
        * aws_dx_connection_association.test2 (destroy): 1 error(s) occurred:
        
        * aws_dx_connection_association.test2: DirectConnectClientException: Connection dxcon-ffrm1ruk is in a transitioning state.
            status code: 400, request id: 8c7dbfec-0323-11e8-85d8-6f8df7343bdd

I first thought it was because we don't wait for any particular state after connection creation, but the doesn't seem to matter as the connection has reached requested state (as it usually does) per debug log:

2018/01/27 05:33:00 [DEBUG] [aws-sdk-go] DEBUG: Response directconnect/CreateConnection Details:
---[ RESPONSE ]--------------------------------------
HTTP/1.1 200 OK
Connection: close
Content-Length: 189
Content-Type: application/x-amz-json-1.1
Date: Sat, 27 Jan 2018 05:33:00 GMT
X-Amzn-Requestid: 89c68f20-0323-11e8-85d8-6f8df7343bdd

{"bandwidth":"1Gbps","connectionId":"dxcon-ffrm1ruk","connectionName":"tf-dxconn2-lw1ro","connectionState":"requested","location":"EqSe2","ownerAccount":"187416307283","region":"us-west-2"}
-----------------------------------------------------

2018/01/27 05:33:00 [DEBUG] [aws-sdk-go] DEBUG: Response directconnect/DescribeConnections Details:
---[ RESPONSE ]--------------------------------------
HTTP/1.1 200 OK
Connection: close
Content-Length: 207
Content-Type: application/x-amz-json-1.1
Date: Sat, 27 Jan 2018 05:33:00 GMT
X-Amzn-Requestid: 89d0eee6-0323-11e8-9b6e-1bcbdac10921

{"connections":[{"bandwidth":"1Gbps","connectionId":"dxcon-ffrm1ruk","connectionName":"tf-dxconn2-lw1ro","connectionState":"requested","location":"EqSe2","ownerAccount":"187416307283","region":"us-west-2"}]}
-----------------------------------------------------

...

2018/01/27 05:33:00 [DEBUG] [aws-sdk-go] DEBUG: Response directconnect/AssociateConnectionWithLag Details:
---[ RESPONSE ]--------------------------------------
HTTP/1.1 200 OK
Connection: close
Content-Length: 214
Content-Type: application/x-amz-json-1.1
Date: Sat, 27 Jan 2018 05:33:00 GMT
X-Amzn-Requestid: 89ecb449-0323-11e8-9b6e-1bcbdac10921

{"bandwidth":"1Gbps","connectionId":"dxcon-ffrm1ruk","connectionName":"tf-dxconn2-lw1ro","connectionState":"requested","lagId":"dxlag-fhajzgnj","location":"EqSe2","ownerAccount":"187416307283","region":"us-west-2"}
-----------------------------------------------------

and suddenly (out of the blue sky?) went into pending state.

-----------------------------------------------------
2018/01/27 05:33:03 [DEBUG] [aws-sdk-go] DEBUG: Response directconnect/DescribeConnections Details:
---[ RESPONSE ]--------------------------------------
HTTP/1.1 200 OK
Connection: close
Content-Length: 263
Content-Type: application/x-amz-json-1.1
Date: Sat, 27 Jan 2018 05:33:04 GMT
X-Amzn-Requestid: 8bea0ae7-0323-11e8-8c5d-25997eea8ee0

{"connections":[{"awsDevice":"EqSe2-w5xt2666tvp0","bandwidth":"1Gbps","connectionId":"dxcon-ffrm1ruk","connectionName":"tf-dxconn2-lw1ro","connectionState":"pending","lagId":"dxlag-fhajzgnj","location":"EqSe2","ownerAccount":"187416307283","region":"us-west-2"}]}
-----------------------------------------------------

...

2018/01/27 05:33:04 [DEBUG] [aws-sdk-go] DEBUG: Response directconnect/DisassociateConnectionFromLag Details:
---[ RESPONSE ]--------------------------------------
HTTP/1.1 400 Bad Request
Connection: close
Content-Length: 108
Content-Type: application/x-amz-json-1.1
Date: Sat, 27 Jan 2018 05:33:05 GMT
X-Amzn-Requestid: 8c7f1f03-0323-11e8-9b6e-1bcbdac10921

{"__type":"DirectConnectClientException","message":"Connection dxcon-fh9yptf2 is in a transitioning state."}
-----------------------------------------------------

States are documented here:
https://docs.aws.amazon.com/directconnect/latest/APIReference/API_Connection.html#DX-Type-Connection-connectionState

Test results

=== RUN   TestAccAwsDxConnection_basic
--- PASS: TestAccAwsDxConnection_basic (16.47s)
=== RUN   TestAccAwsDxConnectionAssociation_multiConns
--- PASS: TestAccAwsDxConnectionAssociation_multiConns (17.19s)
=== RUN   TestAccAwsDxLag_basic
--- PASS: TestAccAwsDxLag_basic (17.20s)
=== RUN   TestAccAwsDxConnectionAssociation_basic
--- PASS: TestAccAwsDxConnectionAssociation_basic (17.24s)

As far as I understand the connection should never enter this state in our case as we don't really have any physical connection ready and/or pre-approved anywhere, so I'm not sure what's going on there, but this seems to be a harmless workaround?

@radeksimko radeksimko added bug Addresses a defect in current functionality. service/directconnect Issues and PRs that pertain to the directconnect service. labels Jan 31, 2018
@ghost ghost added the size/S Managed by automation to categorize the size of a PR. label Jan 31, 2018
@radeksimko radeksimko requested a review from bflad January 31, 2018 14:14
Copy link
Contributor

@bflad bflad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After some digging of my own and discussing with you out of band, this seems like the right action here! Seems like we really hit some strange DX API bug as there is no way we downloaded the LOA, sent it to a network provider to setup the connection, then gotten it approved in the time (seconds!) of this acceptance test. 😄 🚀

@radeksimko radeksimko merged commit 3ade9b1 into master Feb 1, 2018
@radeksimko radeksimko deleted the b-retry-dx-disassoc branch February 1, 2018 07:26
@bflad bflad added this to the v1.9.0 milestone Feb 9, 2018
@bflad
Copy link
Contributor

bflad commented Feb 9, 2018

This has been released in terraform-provider-aws version 1.9.0. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

@ghost
Copy link

ghost commented Apr 8, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked and limited conversation to collaborators Apr 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/directconnect Issues and PRs that pertain to the directconnect service. size/S Managed by automation to categorize the size of a PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants