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 final plan for source_code_hash #663

Open
djakielski opened this issue Feb 5, 2025 · 1 comment
Open

Comments

@djakielski
Copy link

Description

I had an issue with changes and deployment of lambda function when using auto build. Maybe this is more a provoder bug?

Versions

  • Module version: 7.20.1

  • Terraform version:

Terraform v1.10.3
on darwin_arm64
+ provider registry.terraform.io/hashicorp/aws v5.84.0
+ provider registry.terraform.io/hashicorp/external v2.3.4
+ provider registry.terraform.io/hashicorp/http v3.4.0
+ provider registry.terraform.io/hashicorp/local v2.5.2
+ provider registry.terraform.io/hashicorp/null v3.2.3
+ provider registry.terraform.io/hashicorp/random v3.6.0
+ provider registry.terraform.io/hashicorp/tls v4.0.4
+ provider registry.terraform.io/jianyuan/sentry v0.13.1
  • Provider version(s):
    Providers required by configuration:
.
├── provider[registry.terraform.io/hashicorp/random] 3.6.0
├── provider[registry.terraform.io/hashicorp/http] 3.4.0
├── provider[registry.terraform.io/hashicorp/tls] 4.0.4
├── provider[registry.terraform.io/jianyuan/sentry] 0.13.1
├── provider[registry.terraform.io/hashicorp/aws] ~> 5.0

Reproduction Code

module "cdn_function_reisemagazin_rewrite" {
  source  = "terraform-aws-modules/lambda/aws"
  version = "7.20.1"

  function_name                = "cdn-reisemagazin-rewrite"
  description                  = "Rewrite headers"
  handler                      = "dist/main.handler"
  runtime                      = "nodejs22.x"
  trigger_on_package_timestamp = false
  recreate_missing_package     = false

  publish        = true
  lambda_at_edge = true
  source_path = [
    {
      path = "cdn-functions/reisemagazin-rewrite"
      commands = [
        "npm ci",
        "npm run build",
        "npm prune --production",
        ":zip"
      ]
      prefix_in_zip = "dist"
    }
  ]

  providers = {
    aws = aws.us-east-1
  }
  tags = local.holidayguruAllTags
}

Steps to reproduce the behavior:

terraform apply

Expected behavior

Should be deployed.

Actual behavior

Deployment fails. After two retries, it works fine.

Terminal Output Screenshot(s)

│ Error: Provider produced inconsistent final plan

│ When expanding the plan for
│ module.cdn_function_reisemagazin_rewrite.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("pL+RtsVm8jioo3I9uYiR4yPfc0hfbKtBz1zkSqbuMWk="), but now
│ cty.StringVal("Gli5ygJZc6siVv3F42MWnJnROrQcNfTgVgzScmsw2CY=").

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

@mmerickel
Copy link

I'm encountering this on a similar example. I ran into it specifically (so far) when I changed from true to false on trigger_on_package_timestamp and recreate_missing_package settings. I haven't tested it enough to know if it was only a one-time mishap when changing the settings but it happened consistently on every environment (like 5 times so far) where I changed the settings - had to re-run apply again and then it went through successfully.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants