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_config_delivery_channel: Retry deletion #2910

Merged
merged 1 commit into from
Jan 10, 2018

Conversation

radeksimko
Copy link
Member

This is to address the following test failure:

        --- FAIL: TestAccAWSConfig/ConfigurationRecorderStatus/importBasic (47.21s)
            testing.go:563: Error destroying resource! WARNING: Dangling resources
                may exist. The full state and error is shown below.
                
                Error: Error applying: 1 error(s) occurred:
                
                * aws_config_delivery_channel.foo (destroy): 1 error(s) occurred:
                
                * aws_config_delivery_channel.foo: Unable to delete delivery channel: LastDeliveryChannelDeleteFailedException: Failed to delete last specified delivery channel with name 'tf-acc-test-awsconfig-6670192826583674632', because there is a running configuration recorder.
                    status code: 400, request id: 40ddcaf5-df0f-11e7-aa42-c989f54ca168
                ...

I also double checked the debug log to verify that it's actually eventual consistency, not a missing/wrong dependency:

2017/12/12 07:37:05 [DEBUG] [aws-sdk-go] DEBUG: Request config/StopConfigurationRecorder Details:
---[ REQUEST POST-SIGN ]-----------------------------
POST / HTTP/1.1
Host: config.us-west-2.amazonaws.com
User-Agent: aws-sdk-go/1.12.44 (go1.9; linux; amd64) APN/1.0 HashiCorp/1.0 Terraform/0.11.0-beta1
Content-Length: 63
Authorization: AWS4-HMAC-SHA256 Credential=*REDACTED*/20171212/us-west-2/config/aws4_request, SignedHeaders=content-length;content-type;host;x-amz-date;x-amz-target, Signature=*REDACTED*
Content-Type: application/x-amz-json-1.1
X-Amz-Date: 20171212T073705Z
X-Amz-Target: StarlingDoveService.StopConfigurationRecorder
Accept-Encoding: gzip

{"ConfigurationRecorderName":"tf-acc-test-6670192826583674632"}
-----------------------------------------------------
2017/12/12 07:37:05 [DEBUG] [aws-sdk-go] DEBUG: Response config/StopConfigurationRecorder Details:
---[ RESPONSE ]--------------------------------------
HTTP/1.1 200 OK
Connection: close
Content-Length: 0
Content-Type: application/x-amz-json-1.1
Date: Tue, 12 Dec 2017 07:37:06 GMT
X-Amzn-Requestid: 40c53951-df0f-11e7-b9d0-ed903b6f8a82


-----------------------------------------------------

...

2017/12/12 07:37:05 [DEBUG] [aws-sdk-go] DEBUG: Request config/DeleteDeliveryChannel Details:
---[ REQUEST POST-SIGN ]-----------------------------
POST / HTTP/1.1
Host: config.us-west-2.amazonaws.com
User-Agent: aws-sdk-go/1.12.44 (go1.9; linux; amd64) APN/1.0 HashiCorp/1.0 Terraform/0.11.0-beta1
Content-Length: 67
Authorization: AWS4-HMAC-SHA256 Credential=*REDACTED*/20171212/us-west-2/config/aws4_request, SignedHeaders=content-length;content-type;host;x-amz-date;x-amz-target, Signature=*REDACTED*
Content-Type: application/x-amz-json-1.1
X-Amz-Date: 20171212T073705Z
X-Amz-Target: StarlingDoveService.DeleteDeliveryChannel
Accept-Encoding: gzip

{"DeliveryChannelName":"tf-acc-test-awsconfig-6670192826583674632"}
-----------------------------------------------------
2017/12/12 07:37:05 [DEBUG] [aws-sdk-go] DEBUG: Request config/DeleteConfigurationRecorder Details:
---[ REQUEST POST-SIGN ]-----------------------------
POST / HTTP/1.1
Host: config.us-west-2.amazonaws.com
User-Agent: aws-sdk-go/1.12.44 (go1.9; linux; amd64) APN/1.0 HashiCorp/1.0 Terraform/0.11.0-beta1
Content-Length: 63
Authorization: AWS4-HMAC-SHA256 Credential=*REDACTED*/20171212/us-west-2/config/aws4_request, SignedHeaders=content-length;content-type;host;x-amz-date;x-amz-target, Signature=*REDACTED*
Content-Type: application/x-amz-json-1.1
X-Amz-Date: 20171212T073705Z
X-Amz-Target: StarlingDoveService.DeleteConfigurationRecorder
Accept-Encoding: gzip

{"ConfigurationRecorderName":"tf-acc-test-6670192826583674632"}
-----------------------------------------------------
2017/12/12 07:37:05 [DEBUG] [aws-sdk-go] DEBUG: Response config/DeleteDeliveryChannel Details:
---[ RESPONSE ]--------------------------------------
HTTP/1.1 400 Bad Request
Connection: close
Content-Length: 220
Content-Type: application/x-amz-json-1.1
Date: Tue, 12 Dec 2017 07:37:06 GMT
X-Amzn-Requestid: 40ddcaf5-df0f-11e7-aa42-c989f54ca168


{"__type":"LastDeliveryChannelDeleteFailedException","message":"Failed to delete last specified delivery channel with name 'tf-acc-test-awsconfig-6670192826583674632', because there is a running configuration recorder."}
-----------------------------------------------------

Test results

=== RUN   TestAccAWSConfig
=== RUN   TestAccAWSConfig/Config
=== RUN   TestAccAWSConfig/Config/importAws
=== RUN   TestAccAWSConfig/Config/importLambda
=== RUN   TestAccAWSConfig/Config/basic
=== RUN   TestAccAWSConfig/Config/ownerAws
=== RUN   TestAccAWSConfig/Config/customlambda
=== RUN   TestAccAWSConfig/ConfigurationRecorderStatus
=== RUN   TestAccAWSConfig/ConfigurationRecorderStatus/importBasic
=== RUN   TestAccAWSConfig/ConfigurationRecorderStatus/basic
=== RUN   TestAccAWSConfig/ConfigurationRecorderStatus/startEnabled
=== RUN   TestAccAWSConfig/ConfigurationRecorder
=== RUN   TestAccAWSConfig/ConfigurationRecorder/basic
=== RUN   TestAccAWSConfig/ConfigurationRecorder/allParams
=== RUN   TestAccAWSConfig/ConfigurationRecorder/importBasic
=== RUN   TestAccAWSConfig/DeliveryChannel
=== RUN   TestAccAWSConfig/DeliveryChannel/basic
=== RUN   TestAccAWSConfig/DeliveryChannel/allParams
=== RUN   TestAccAWSConfig/DeliveryChannel/importBasic
--- PASS: TestAccAWSConfig (738.46s)
    --- PASS: TestAccAWSConfig/Config (472.55s)
        --- PASS: TestAccAWSConfig/Config/importAws (89.94s)
        --- PASS: TestAccAWSConfig/Config/importLambda (103.66s)
        --- PASS: TestAccAWSConfig/Config/basic (88.20s)
        --- PASS: TestAccAWSConfig/Config/ownerAws (88.32s)
        --- PASS: TestAccAWSConfig/Config/customlambda (102.44s)
    --- PASS: TestAccAWSConfig/ConfigurationRecorderStatus (98.34s)
        --- PASS: TestAccAWSConfig/ConfigurationRecorderStatus/importBasic (28.20s)
        --- PASS: TestAccAWSConfig/ConfigurationRecorderStatus/basic (29.65s)
        --- PASS: TestAccAWSConfig/ConfigurationRecorderStatus/startEnabled (40.50s)
    --- PASS: TestAccAWSConfig/ConfigurationRecorder (82.45s)
        --- PASS: TestAccAWSConfig/ConfigurationRecorder/basic (26.80s)
        --- PASS: TestAccAWSConfig/ConfigurationRecorder/allParams (28.06s)
        --- PASS: TestAccAWSConfig/ConfigurationRecorder/importBasic (27.60s)
    --- PASS: TestAccAWSConfig/DeliveryChannel (85.12s)
        --- PASS: TestAccAWSConfig/DeliveryChannel/basic (28.35s)
        --- PASS: TestAccAWSConfig/DeliveryChannel/allParams (27.95s)
        --- PASS: TestAccAWSConfig/DeliveryChannel/importBasic (28.82s)
PASS

@radeksimko radeksimko added the bug Addresses a defect in current functionality. label Jan 9, 2018
@bflad bflad self-assigned this Jan 9, 2018
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.

LGTM. One minor nitpick for using the available constant.

make testacc TEST=./aws TESTARGS='-run=TestAccAWSConfig'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -run=TestAccAWSConfig -timeout 120m
=== RUN   TestAccAWSConfig
=== RUN   TestAccAWSConfig/Config
=== RUN   TestAccAWSConfig/Config/ownerAws
=== RUN   TestAccAWSConfig/Config/customlambda
=== RUN   TestAccAWSConfig/Config/importAws
=== RUN   TestAccAWSConfig/Config/importLambda
=== RUN   TestAccAWSConfig/Config/basic
=== RUN   TestAccAWSConfig/ConfigurationRecorderStatus
=== RUN   TestAccAWSConfig/ConfigurationRecorderStatus/basic
=== RUN   TestAccAWSConfig/ConfigurationRecorderStatus/startEnabled
=== RUN   TestAccAWSConfig/ConfigurationRecorderStatus/importBasic
=== RUN   TestAccAWSConfig/ConfigurationRecorder
=== RUN   TestAccAWSConfig/ConfigurationRecorder/basic
=== RUN   TestAccAWSConfig/ConfigurationRecorder/allParams
=== RUN   TestAccAWSConfig/ConfigurationRecorder/importBasic
=== RUN   TestAccAWSConfig/DeliveryChannel
=== RUN   TestAccAWSConfig/DeliveryChannel/importBasic
=== RUN   TestAccAWSConfig/DeliveryChannel/basic
=== RUN   TestAccAWSConfig/DeliveryChannel/allParams
--- PASS: TestAccAWSConfig (1005.33s)
    --- PASS: TestAccAWSConfig/Config (553.22s)
        --- PASS: TestAccAWSConfig/Config/ownerAws (100.84s)
        --- PASS: TestAccAWSConfig/Config/customlambda (124.19s)
        --- PASS: TestAccAWSConfig/Config/importAws (102.54s)
        --- PASS: TestAccAWSConfig/Config/importLambda (122.51s)
        --- PASS: TestAccAWSConfig/Config/basic (103.14s)
    --- PASS: TestAccAWSConfig/ConfigurationRecorderStatus (184.33s)
        --- PASS: TestAccAWSConfig/ConfigurationRecorderStatus/basic (50.03s)
        --- PASS: TestAccAWSConfig/ConfigurationRecorderStatus/startEnabled (89.26s)
        --- PASS: TestAccAWSConfig/ConfigurationRecorderStatus/importBasic (45.04s)
    --- PASS: TestAccAWSConfig/ConfigurationRecorder (134.64s)
        --- PASS: TestAccAWSConfig/ConfigurationRecorder/basic (43.43s)
        --- PASS: TestAccAWSConfig/ConfigurationRecorder/allParams (43.08s)
        --- PASS: TestAccAWSConfig/ConfigurationRecorder/importBasic (48.13s)
    --- PASS: TestAccAWSConfig/DeliveryChannel (133.14s)
        --- PASS: TestAccAWSConfig/DeliveryChannel/importBasic (47.21s)
        --- PASS: TestAccAWSConfig/DeliveryChannel/basic (42.18s)
        --- PASS: TestAccAWSConfig/DeliveryChannel/allParams (43.75s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	1005.371s

err := resource.Retry(30*time.Second, func() *resource.RetryError {
_, err := conn.DeleteDeliveryChannel(&input)
if err != nil {
if isAWSErr(err, "LastDeliveryChannelDeleteFailedException", "there is a running configuration recorder") {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpick: This is available as a constant: configservice.ErrCodeLastDeliveryChannelDeleteFailedException

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point, swapped.

@radeksimko radeksimko force-pushed the b-awsconfig-dc-retry-deletion branch from 2a86c76 to 6881578 Compare January 10, 2018 07:39
@radeksimko radeksimko merged commit 5839937 into master Jan 10, 2018
@radeksimko radeksimko deleted the b-awsconfig-dc-retry-deletion branch January 10, 2018 07:49
@bflad
Copy link
Contributor

bflad commented Jan 12, 2018

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

@bflad bflad added this to the v1.7.0 milestone Jan 12, 2018
@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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants