When new env variable is added, AWS provider produces inconsistent plan
Versions
- Module version: 3.3.1
- Terraform version: v1.2.4 on linux_amd64
- Provider version(s): -- provider registry.terraform.io/hashicorp/aws v4.22.0 -- provider registry.terraform.io/hashicorp/external v2.2.2 -- provider registry.terraform.io/hashicorp/local v2.2.3 -- provider registry.terraform.io/hashicorp/null v3.1.1
Reproduction Code
Steps to reproduce the behaviour:
- Do initial deployment of Lambda with env variables section:
module "my_lambda" {
source = "terraform-aws-modules/lambda/aws"
version = "3.3.1"
function_name = "my-lambda"
timeout = 900
memory_size = 128
runtime = "python3.9"
source_path = "lambda"
handler = "handler.run"
environment_variables = {
MY_VAR_1 = "value1"
MY_VAR_2 = "value2"
}
cloudwatch_logs_retention_in_days = 7
}
- Add new env variable:
...
environment_variables = {
...
MY_VAR_3 = "value3"
}
...
- Deploy Lambda again
Are you using workspaces? No
Have you cleared the local cache (see Notice section above)? Yes
Expected behaviour
terraform apply completes successfully.
Actual behaviour
terraform apply fails with error.
Terminal Output Screenshot(s)
β Error: Provider produced inconsistent final plan
β
β When expanding the plan for
β module.my_lambda.aws_lambda_function.this[0] to include new
β values learned so far during apply, provider
β "registry.terraform.io/hashicorp/aws" produced an invalid new value for
β .source_code_hash: was
β cty.StringVal("JV7yUMixOJCG7XuCa3mEnHoiXY1KdqjKNr5uUZw4WPU="), but now
β cty.StringVal("udLJogje0z3p3KZS2JZx6DuSeneGcACuNVzdnW5I3/A=").
β
β This is a bug in the provider, which should be reported in the provider's
β own issue tracker.
Workaround
Manually delete Lambda function and re-deploy again.
this is BTW not the "provider's own issue tracker"
For the aws-provider see: https://github.com/hashicorp/terraform-provider-aws
This issue has been automatically marked as stale because it has been open 30 days with no activity. Remove stale label or comment or this issue will be closed in 10 days
This issue was automatically closed because of stale in 10 days
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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.