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

when no code change, revalidation_function should not result in terraform state change #23

Closed
jackykwan-eventx opened this issue Mar 20, 2024 · 4 comments · Fixed by #36

Comments

@jackykwan-eventx
Copy link

jackykwan-eventx commented Mar 20, 2024

Technical Details

  • OS: ubuntu 20.04
  • Terraform Version: 1.7.5
  • Provider Version hashicorp/aws 5.34.0
  • Module Version >= 2.0.0, < 3.0.0
  • Module Affected: tf-aws-open-next-zone
  • Deployment Model: Single zone

Describe the bug

When no code change and do terraform plan again, the module.revalidation_function.aws_lambda_function.lambda_function will be updated in-place

Steps to Reproduce

Steps to reproduce the behaviour:

  1. deploy any nextjs project
  2. keep no code change / build change
  3. run terraform plan
  4. it will show
  ~ resource "aws_lambda_function" "lambda_function" {
        id                             = "dummy"
      ~ qualified_arn                  = "arn:aws:lambda:region:accountId:function:prefix-revalidation-function:1" -> (known after apply)
      ~ qualified_invoke_arn           = "arn:aws:apigateway:region:lambda:path/2015-03-31/functions/arn:aws:lambda:region:accountId:function:prefix-revalidation-function:1/invocations" -> (known after apply)
        tags                           = {}
      ~ version                        = "1" -> (known after apply)
        # (19 unchanged attributes hidden)

        # (4 unchanged blocks hidden)
    }

  # module.moduleName.module.revalidation_function.terraform_data.update_alias[0] must be replaced
-/+ resource "terraform_data" "update_alias" {
      ~ id               = "dummy" -> (known after apply)
      ~ triggers_replace = [
          - "1",
          + (known after apply),
            "stable",
        ]
    }

Plan: 1 to add, 1 to change, 1 to destroy.

Expected behaviour

Should be no state update

@RJPearson94
Copy link
Owner

RJPearson94 commented Mar 20, 2024

Hey @jackykwan-eventx,

I have been able to replicate this issue although I have no clue why this happens, as the logic is the same as the other functions.
I need to dig a little deeper into this to see if the issue is with module/ terraform or there is something unusual with that function in particular as it appears the server and image optimisation functions don’t have the same behaviour.

Kind Regards
Rob

@jackykwan-eventx
Copy link
Author

@RJPearson94 thank you so much

@RJPearson94
Copy link
Owner

I may not be able to resolve this.

As it appears, there are some quirks around timestamps and permissions on the zip files. Reading the following comments:

Although I am confused about why it only affects the revalidation function, the other two are fine.
I will continue investigating to see if the is a fix for this

@RJPearson94
Copy link
Owner

It looks like this issue is still present in open next v3

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

Successfully merging a pull request may close this issue.

2 participants