Skip to content

Commit

Permalink
Merge pull request #8219 from terraform-providers/t-aws_secretsmanage…
Browse files Browse the repository at this point in the history
…r_secret_version-InvalidRequestException

service/secretsmanager: Handle additional scheduled/marked for deletion error messages
  • Loading branch information
bflad authored Apr 10, 2019
2 parents be842e7 + cfdf4a0 commit 03487bb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion aws/resource_aws_secretsmanager_secret.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,10 @@ func resourceAwsSecretsManagerSecretCreate(d *schema.ResourceData, meta interfac
err := resource.Retry(2*time.Minute, func() *resource.RetryError {
var err error
output, err = conn.CreateSecret(input)
// Temporarily retry on these errors to support immediate secret recreation:
// 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") {
return resource.RetryableError(err)
}
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion aws/resource_aws_secretsmanager_secret_version_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ func testAccCheckAwsSecretsManagerSecretVersionDestroy(s *terraform.State) error
if isAWSErr(err, secretsmanager.ErrCodeResourceNotFoundException, "") {
return nil
}
if isAWSErr(err, secretsmanager.ErrCodeInvalidRequestException, "You can’t perform this operation on the secret because it was deleted") {
if isAWSErr(err, secretsmanager.ErrCodeInvalidRequestException, "was deleted") || isAWSErr(err, secretsmanager.ErrCodeInvalidRequestException, "was marked for deletion") {
return nil
}
return err
Expand Down

0 comments on commit 03487bb

Please sign in to comment.