-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
TerraForm is not flagging changes to computed values of aws_lambda_function #2915
Comments
I understand now, the computed values in the resource schema are only updated on create. There is a ComputedWhen attribute that can be added, but it is broken/not implemented. It seems that the CustomizeDiff option might be the way to go here. Adding this to resource_aws_lambda_function.go could fix this issue. |
I just pushed a PR up that should address this issue. I've been running with a patched version of the provider today and it fixes this problem for me. |
I did not see you PR and just added my own #3043. There are two other attributes that need to be SetNewComputed:
|
Thanks to @mdlavin the fix for this has been merged into master and will be released in v1.10.0 of the AWS provider, likely later today or Monday. 🎉 |
This has been released in version 1.10.0 of the AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. |
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! |
This issue was originally opened by @ChristopherGAndrews as hashicorp/terraform#17070. It was migrated here as a result of the provider split. The original body of the issue is below.
I have a module that contains a AWS Lambda function so that it is easy to apply this function to different AWS Accounts. I have the module configured to publish a new version every time the zip is updated. There is an aws_lambda_alias called "production" that is associated with this latest version of of the Lamda, so that a CloudWatch Event can target that specific version. We do not want to target$LATEST, because that can be edited. We do not want to have to track the version numbers of the Lambda function across all of the accounts, so we tie it to the last version. When I update the local ZIP file with a new version of the Lambda function, Terraform will update the code in AWS , increment the version at AWS, record these changes in the TerraForm state, and the values of qualified_arn and version, but all resources dependent on the qualified_arn and version changing do not see the change and so do not update . Everything that is set to use "$ {aws_lambda_function.main.version}" fails to update until you run TerraForm a second time.
Terraform Version
Terraform v0.11.1
Terraform Configuration Files
Tags and environment variables removed to reduce clutter:
Even running this through a null data source does not help.
Moving the alias out of the module does not help either:
Debug Output
The Lambda function was at version = 4 when
terraform plan-out terraform.out
was run. You can see the new version and qualified arn coming back to TerraForm during theterraform apply terraform.out
The state output section after the run, is now set to 5, like it should be:
The Lambda Alias is still stuck at 4
Crash Output
NA
Expected Behavior
You should run TerraForm once to update the Lambda function and alias
terraform plan -out terraform.plan
terraform apply terraform.plan
Actual Behavior/Steps to Reproduce
You have to run terraform twice to update the alias
terraform plan -out terraform.plan
terraform apply terraform.plan
terraform plan -out terraform.plan
terraform apply terraform.plan
Additional Context
The Lambda function and all of its related objects:
are in side of a TerraForm module.
References
The text was updated successfully, but these errors were encountered: