hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.85k stars 9.2k forks source link

`aws_synthetics_canary`: Error: Provider produced inconsistent final plan (`delete_lambda` value was `cty.False`, but now `null`) #25879

Open theipster opened 2 years ago

theipster commented 2 years ago

Community Note

Terraform CLI and Terraform AWS Provider Version

Affected Resource(s)

Terraform Configuration Files

resource "aws_synthetics_canary" "foo" {
  artifact_s3_location = "s3://some-bucket/"
  execution_role_arn   = aws_iam_role.some-role.arn
  handler              = "index.handler"
  name                 = "some-canary"
  runtime_version      = "syn-python-selenium-1.2"
  start_canary         = true
  zip_file             = "test-fixtures/lambdatest.zip"

  schedule {
    expression = "rate(1 hour)"
  }
}

Debug Output

N/A

Panic Output

N/A

Expected Behavior

Apply is successful.

Actual Behavior

Error message:

Error: Provider produced inconsistent final plan

When expanding the plan for aws_synthetics_canary.foo to include new values learned so far during apply, provider "registry.terraform.io/hashicorp/aws" produced an invalid new value for .delete_lambda: was cty.False, but now null.

This is a bug in the provider, which should be reported in the provider's own issue tracker.

Steps to Reproduce

Deploy

  1. terraform apply

Important Factoids

This bug was discovered as part of our hashicorp/aws provider version upgrade; the exact same configuration was working fine under hashicorp/aws version v4.5.0, but started producing these errors under v4.22.0. The Terraform version has not changed.

Given that the delete_lambda argument was introduced in v4.20.0 (see #25284), and canary.go hasn't been changed since, I suspect that this bug has existed since v4.20.0.

References

stanislavlevitt commented 1 year ago

We are experiencing a similar issue. We recently upgraded our Terraform version from 1.4.0 to 1.5.6 and Provider (hashicorp/aws) version from 4.19.0 to 5.19.0. We then were able to successful update the aws_synthetics_canary to runtime_version = "syn-nodejs-puppeteer-6.0"

Now we want to update the runtime our aws_lambda_function(s) to node18 as well. When we apply a deployment we can't the same error as the ticket above.

Terraform CLI and Terraform AWS Provider Version Terraform version: 1.5.6 Provider (hashicorp/aws) version: v5.19.0

Affected Resource(s)

Terraform Configuration Files

resource "aws_synthetics_canary" "foo" {
  name                 = "some-canary"
  artifact_s3_location = "s3://some-bucket/"
  execution_role_arn   = aws_iam_role.some-role.arn
  handler              = "index.handler"
  zip_file             = data.archive_file.foo_canary.output_path

  runtime_version      = "syn-nodejs-puppeteer-6.0" 
  start_canary         = true

  run_config {
    timeout_in_seconds = 120
  }

  schedule {
    expression = local.schedule_expression
  }

  artifact_config {
    s3_encryption {
      encryption_mode = "SSE_S3"
    }
  }

  tags = var.tags
}

Error message:

 Error: Provider produced inconsistent final plan

When expanding the plan for module.monitoring.aws_synthetics_canary.foo to include new values learned so far during apply, provider "registry.terraform.io/hashicorp/aws"
produced an invalid new value for .delete_lambda: was cty.False, but now null.

This is a bug in the provider, which should be reported in the provider's own issue tracker.

Steps to Reproduce Deploy

  1. terraform apply