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

service/secretsmanager: Handle additional scheduled/marked for deletion error messages #8219

Merged

Conversation

bflad
Copy link
Contributor

@bflad bflad commented Apr 5, 2019

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment to help the community and maintainers prioritize this request
  • Please do not leave "+1" comments, they generate extra noise for pull request followers and do not help prioritize the request

It seems the Secrets Manager service now delineates the pending deletion state with different error messages. Presumably the old messages could still be returned depending on timing.

Previous output from acceptance testing:

--- FAIL: TestAccAwsSecretsManagerSecret_RecoveryWindowInDays_Recreate (6.87s)
    testing.go:538: Step 1 error: Error applying: 1 error occurred:
          * aws_secretsmanager_secret.test: 1 error occurred:
          * aws_secretsmanager_secret.test: error creating Secrets Manager Secret: InvalidRequestException: You can't create this secret because a secret with this name is already scheduled for deletion.

--- FAIL: TestAccAwsSecretsManagerSecretVersion_Base64Binary (7.05s)
    testing.go:599: Error destroying resource! WARNING: Dangling resources
        may exist. The full state and error is shown below.
        
        Error: Check failed: InvalidRequestException: You can’t perform this operation on the secret because it was marked for deletion.

--- FAIL: TestAccAwsSecretsManagerSecretVersion_BasicString (6.82s)
    testing.go:599: Error destroying resource! WARNING: Dangling resources
        may exist. The full state and error is shown below.
        
        Error: Check failed: InvalidRequestException: You can’t perform this operation on the secret because it was marked for deletion.

--- FAIL: TestAccAwsSecretsManagerSecretVersion_VersionStages (16.18s)
    testing.go:599: Error destroying resource! WARNING: Dangling resources
        may exist. The full state and error is shown below.
        
        Error: Check failed: InvalidRequestException: You can’t perform this operation on the secret because it was marked for deletion.

Output from acceptance testing:

--- PASS: TestAccAwsSecretsManagerSecret_policy (10.63s)
--- PASS: TestAccAwsSecretsManagerSecret_Basic (11.18s)
--- PASS: TestAccAwsSecretsManagerSecret_withNamePrefix (11.23s)
--- PASS: TestAccAwsSecretsManagerSecret_Description (19.12s)
--- PASS: TestAccAwsSecretsManagerSecret_Tags (33.62s)
--- PASS: TestAccAwsSecretsManagerSecret_RecoveryWindowInDays_Recreate (45.49s)
--- PASS: TestAccAwsSecretsManagerSecret_RotationLambdaARN (46.06s)
--- PASS: TestAccAwsSecretsManagerSecret_RotationRules (48.05s)
--- PASS: TestAccAwsSecretsManagerSecret_KmsKeyID (50.75s)

--- PASS: TestAccAwsSecretsManagerSecretVersion_BasicString (11.80s)
--- PASS: TestAccAwsSecretsManagerSecretVersion_Base64Binary (11.81s)
--- PASS: TestAccAwsSecretsManagerSecretVersion_VersionStages (25.33s)

…eletion InvalidRequestException error during immediate recreation

Previous output from acceptance testing:

```
--- FAIL: TestAccAwsSecretsManagerSecret_RecoveryWindowInDays_Recreate (6.87s)
    testing.go:538: Step 1 error: Error applying: 1 error occurred:
          * aws_secretsmanager_secret.test: 1 error occurred:
          * aws_secretsmanager_secret.test: error creating Secrets Manager Secret: InvalidRequestException: You can't create this secret because a secret with this name is already scheduled for deletion.
```

Output from acceptance testing:

```
--- PASS: TestAccAwsSecretsManagerSecret_policy (10.63s)
--- PASS: TestAccAwsSecretsManagerSecret_Basic (11.18s)
--- PASS: TestAccAwsSecretsManagerSecret_withNamePrefix (11.23s)
--- PASS: TestAccAwsSecretsManagerSecret_Description (19.12s)
--- PASS: TestAccAwsSecretsManagerSecret_Tags (33.62s)
--- PASS: TestAccAwsSecretsManagerSecret_RecoveryWindowInDays_Recreate (45.49s)
--- PASS: TestAccAwsSecretsManagerSecret_RotationLambdaARN (46.06s)
--- PASS: TestAccAwsSecretsManagerSecret_RotationRules (48.05s)
--- PASS: TestAccAwsSecretsManagerSecret_KmsKeyID (50.75s)
```
…arked for deletion InvalidRequestException error during CheckDestroy

Previous output from acceptance testing:

```
--- FAIL: TestAccAwsSecretsManagerSecretVersion_Base64Binary (7.05s)
    testing.go:599: Error destroying resource! WARNING: Dangling resources
        may exist. The full state and error is shown below.

        Error: Check failed: InvalidRequestException: You can’t perform this operation on the secret because it was marked for deletion.

--- FAIL: TestAccAwsSecretsManagerSecretVersion_BasicString (6.82s)
    testing.go:599: Error destroying resource! WARNING: Dangling resources
        may exist. The full state and error is shown below.

        Error: Check failed: InvalidRequestException: You can’t perform this operation on the secret because it was marked for deletion.

--- FAIL: TestAccAwsSecretsManagerSecretVersion_VersionStages (16.18s)
    testing.go:599: Error destroying resource! WARNING: Dangling resources
        may exist. The full state and error is shown below.

        Error: Check failed: InvalidRequestException: You can’t perform this operation on the secret because it was marked for deletion.
```

Output from acceptance testing:

```
--- PASS: TestAccAwsSecretsManagerSecretVersion_BasicString (11.80s)
--- PASS: TestAccAwsSecretsManagerSecretVersion_Base64Binary (11.81s)
--- PASS: TestAccAwsSecretsManagerSecretVersion_VersionStages (25.33s)
```
@bflad bflad added the service/secretsmanager Issues and PRs that pertain to the secretsmanager service. label Apr 5, 2019
@bflad bflad requested a review from a team April 5, 2019 20:00
@ghost ghost added size/XS Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. labels Apr 5, 2019
// InvalidRequestException: You can’t perform this operation on the secret because it was deleted.
if isAWSErr(err, secretsmanager.ErrCodeInvalidRequestException, "You can’t perform this operation on the secret because it was deleted") {
// InvalidRequestException: You can't create this secret because a secret with this name is already scheduled for deletion.
if isAWSErr(err, secretsmanager.ErrCodeInvalidRequestException, "scheduled for deletion") || isAWSErr(err, secretsmanager.ErrCodeInvalidRequestException, "was deleted") {
Copy link
Contributor

Choose a reason for hiding this comment

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

Did you encounter while running acceptance tests or was this documented in the SDK?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Acceptance testing:

--- FAIL: TestAccAwsSecretsManagerSecret_RecoveryWindowInDays_Recreate (6.87s)
    testing.go:538: Step 1 error: Error applying: 1 error occurred:
          * aws_secretsmanager_secret.test: 1 error occurred:
          * aws_secretsmanager_secret.test: error creating Secrets Manager Secret: InvalidRequestException: You can't create this secret because a secret with this name is already scheduled for deletion.

Copy link
Contributor

@nywilken nywilken left a comment

Choose a reason for hiding this comment

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

LGTM 👍

I left a question more for my curiosity.

@bflad bflad added this to the v2.6.0 milestone Apr 10, 2019
@bflad bflad merged commit 03487bb into master Apr 10, 2019
@bflad bflad deleted the t-aws_secretsmanager_secret_version-InvalidRequestException branch April 10, 2019 16:53
bflad added a commit that referenced this pull request Apr 10, 2019
@bflad
Copy link
Contributor Author

bflad commented Apr 11, 2019

This has been released in version 2.6.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

@ghost
Copy link

ghost commented Mar 30, 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 Mar 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
service/secretsmanager Issues and PRs that pertain to the secretsmanager service. size/XS Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants