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

Provider produced inconsistent result after apply: aws_secretsmanager_secret #16482

Closed
mkielar opened this issue Nov 30, 2020 · 4 comments · Fixed by #18462
Closed

Provider produced inconsistent result after apply: aws_secretsmanager_secret #16482

mkielar opened this issue Nov 30, 2020 · 4 comments · Fixed by #18462
Assignees
Labels
bug Addresses a defect in current functionality. service/secretsmanager Issues and PRs that pertain to the secretsmanager service.
Milestone

Comments

@mkielar
Copy link
Contributor

mkielar commented Nov 30, 2020

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform CLI and Terraform AWS Provider Version

Terraform v0.13.3
- Using hashicorp/tls v3.0.0 from the shared cache directory
- Using hashicorp/random v2.3.1 from the shared cache directory
- Using hashicorp/aws v3.18.0 from the shared cache directory
- Using hashicorp/external v1.2.0 from the shared cache directory
- Using hashicorp/local v1.4.0 from the shared cache directory
- Using hashicorp/null v2.1.2 from the shared cache directory

Affected Resource(s)

  • aws_secretsmanager_secret

Terraform Configuration Files

locals {
  name = "${var.environment}-${var.name}"
}

resource "aws_secretsmanager_secret" "secret" {

  # Use prefixes to workaround destroy-then-recreate issues.
  name_prefix = "${local.name}-"
  lifecycle {
    create_before_destroy = true
  }

  description             = var.description
  kms_key_id              = var.kms_key_arn
  recovery_window_in_days = var.recovery_window_in_days

  tags = merge(var.tags, {
    "Name"                  = local.name
  })
}

Debug Output

N/A

Panic Output

N/A

Expected Behavior

The resource should be created.

Actual Behavior

Creating aws_secretsmanager_secret fails with:

Error: Provider produced inconsistent result after apply
When applying changes to
module.st_service_template.module.ingress_nlb.aws_secretsmanager_secret.ingress_nlb_ca_certificate_secret[0],
provider "registry.terraform.io/hashicorp/aws" produced an unexpected new
value: Root resource was present, but now absent.
This is a bug in the provider, which should be reported in the provider's own
issue tracker.

Steps to Reproduce

  1. terraform apply

Important Factoids

References

There's plenty of those already for other resources. Looks like a generic solution for this would be a good idea.

@ghost ghost added the service/secretsmanager Issues and PRs that pertain to the secretsmanager service. label Nov 30, 2020
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Nov 30, 2020
@sivamca127
Copy link

I'm also facing the same issue since 2 days onwards during azure resource deployment. can we get fix for this ?

@david-b8-ncsc
Copy link

Same issue TF 0.12.29
Error: Provider produced inconsistent result after apply
When applying changes to
aws_secretsmanager_secret.a-secret, provider
"registry.terraform.io/-/aws" produced an unexpected new value for was
present, but now absent.
This is a bug in the provider, which should be reported in the provider's own
issue tracker.

@bflad bflad added bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels Mar 29, 2021
bflad added a commit that referenced this issue Mar 29, 2021
… in resources

Reference: #16482
Reference: #16796

Output from acceptance testing in AWS Commercial:

```
--- FAIL: TestAccAwsSecretsManagerSecret_policy (40.13s) # #18461
--- PASS: TestAccAwsSecretsManagerSecret_basic (19.14s)
--- PASS: TestAccAwsSecretsManagerSecret_Description (28.90s)
--- PASS: TestAccAwsSecretsManagerSecret_KmsKeyID (36.04s)
--- PASS: TestAccAwsSecretsManagerSecret_RecoveryWindowInDays_Recreate (27.96s)
--- PASS: TestAccAwsSecretsManagerSecret_RotationLambdaARN (103.44s)
--- PASS: TestAccAwsSecretsManagerSecret_RotationRules (55.08s)
--- PASS: TestAccAwsSecretsManagerSecret_Tags (48.81s)
--- PASS: TestAccAwsSecretsManagerSecret_withNamePrefix (19.14s)

--- PASS: TestAccAwsSecretsManagerSecretPolicy_basic (46.93s)
--- PASS: TestAccAwsSecretsManagerSecretPolicy_blockPublicPolicy (49.17s)
--- PASS: TestAccAwsSecretsManagerSecretPolicy_disappears (27.04s)

--- PASS: TestAccAwsSecretsManagerSecretRotation_basic (54.74s)

--- PASS: TestAccAwsSecretsManagerSecretVersion_Base64Binary (20.22s)
--- PASS: TestAccAwsSecretsManagerSecretVersion_BasicString (19.64s)
--- PASS: TestAccAwsSecretsManagerSecretVersion_VersionStages (42.20s)
```

Output from acceptance testing in AWS GovCloud (US):

```
--- FAIL: TestAccAwsSecretsManagerSecret_policy (41.26s) # #18461
--- PASS: TestAccAwsSecretsManagerSecret_basic (25.60s)
--- PASS: TestAccAwsSecretsManagerSecret_Description (37.53s)
--- PASS: TestAccAwsSecretsManagerSecret_KmsKeyID (45.10s)
--- PASS: TestAccAwsSecretsManagerSecret_RecoveryWindowInDays_Recreate (37.67s)
--- PASS: TestAccAwsSecretsManagerSecret_RotationLambdaARN (70.43s)
--- PASS: TestAccAwsSecretsManagerSecret_RotationRules (58.87s)
--- PASS: TestAccAwsSecretsManagerSecret_Tags (64.49s)
--- PASS: TestAccAwsSecretsManagerSecret_withNamePrefix (23.75s)

--- PASS: TestAccAwsSecretsManagerSecretPolicy_basic (49.66s)
--- PASS: TestAccAwsSecretsManagerSecretPolicy_blockPublicPolicy (64.81s)
--- PASS: TestAccAwsSecretsManagerSecretPolicy_disappears (29.34s)

--- PASS: TestAccAwsSecretsManagerSecretRotation_basic (68.89s)

--- PASS: TestAccAwsSecretsManagerSecretVersion_Base64Binary (21.89s)
--- PASS: TestAccAwsSecretsManagerSecretVersion_BasicString (24.62s)
--- PASS: TestAccAwsSecretsManagerSecretVersion_VersionStages (54.57s)
```
@bflad bflad self-assigned this Mar 29, 2021
bflad added a commit that referenced this issue Apr 2, 2021
… in resources (#18462)

Reference: #16482
Reference: #16796

Output from acceptance testing in AWS Commercial:

```
--- FAIL: TestAccAwsSecretsManagerSecret_policy (40.13s) # #18461
--- PASS: TestAccAwsSecretsManagerSecret_basic (19.14s)
--- PASS: TestAccAwsSecretsManagerSecret_Description (28.90s)
--- PASS: TestAccAwsSecretsManagerSecret_KmsKeyID (36.04s)
--- PASS: TestAccAwsSecretsManagerSecret_RecoveryWindowInDays_Recreate (27.96s)
--- PASS: TestAccAwsSecretsManagerSecret_RotationLambdaARN (103.44s)
--- PASS: TestAccAwsSecretsManagerSecret_RotationRules (55.08s)
--- PASS: TestAccAwsSecretsManagerSecret_Tags (48.81s)
--- PASS: TestAccAwsSecretsManagerSecret_withNamePrefix (19.14s)

--- PASS: TestAccAwsSecretsManagerSecretPolicy_basic (46.93s)
--- PASS: TestAccAwsSecretsManagerSecretPolicy_blockPublicPolicy (49.17s)
--- PASS: TestAccAwsSecretsManagerSecretPolicy_disappears (27.04s)

--- PASS: TestAccAwsSecretsManagerSecretRotation_basic (54.74s)

--- PASS: TestAccAwsSecretsManagerSecretVersion_Base64Binary (20.22s)
--- PASS: TestAccAwsSecretsManagerSecretVersion_BasicString (19.64s)
--- PASS: TestAccAwsSecretsManagerSecretVersion_VersionStages (42.20s)
```

Output from acceptance testing in AWS GovCloud (US):

```
--- FAIL: TestAccAwsSecretsManagerSecret_policy (41.26s) # #18461
--- PASS: TestAccAwsSecretsManagerSecret_basic (25.60s)
--- PASS: TestAccAwsSecretsManagerSecret_Description (37.53s)
--- PASS: TestAccAwsSecretsManagerSecret_KmsKeyID (45.10s)
--- PASS: TestAccAwsSecretsManagerSecret_RecoveryWindowInDays_Recreate (37.67s)
--- PASS: TestAccAwsSecretsManagerSecret_RotationLambdaARN (70.43s)
--- PASS: TestAccAwsSecretsManagerSecret_RotationRules (58.87s)
--- PASS: TestAccAwsSecretsManagerSecret_Tags (64.49s)
--- PASS: TestAccAwsSecretsManagerSecret_withNamePrefix (23.75s)

--- PASS: TestAccAwsSecretsManagerSecretPolicy_basic (49.66s)
--- PASS: TestAccAwsSecretsManagerSecretPolicy_blockPublicPolicy (64.81s)
--- PASS: TestAccAwsSecretsManagerSecretPolicy_disappears (29.34s)

--- PASS: TestAccAwsSecretsManagerSecretRotation_basic (68.89s)

--- PASS: TestAccAwsSecretsManagerSecretVersion_Base64Binary (21.89s)
--- PASS: TestAccAwsSecretsManagerSecretVersion_BasicString (24.62s)
--- PASS: TestAccAwsSecretsManagerSecretVersion_VersionStages (54.57s)
```
@github-actions github-actions bot added this to the v3.36.0 milestone Apr 2, 2021
@ghost
Copy link

ghost commented Apr 9, 2021

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

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template for triage. Thanks!

@ghost
Copy link

ghost commented May 3, 2021

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 as resolved and limited conversation to collaborators May 3, 2021
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/secretsmanager Issues and PRs that pertain to the secretsmanager service.
Projects
None yet
4 participants