-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
null_resource trigger with interpolated value used as an output fails #17641
Comments
Hi @tomelliff, Thanks for filing this! I've been able to reproduce the issue with triggers here, and will look into it. If you need to work around the problem at the moment, you can set |
I've also run into that issue, and it also seems to affect data null_data inputs. |
I've also run into this issue and described my setup in detail in poseidon/typhoon#224. I noticed that it's not the presence of interpolations that causes this error, but specifically interpolations that are asynchronous and happen in the apply phase instead of during a plan. In the original example |
Isn't this particular case because the trigger is either static (works) or referencing a resource with count without actually referencing a particular element? was changed into |
Got the same behavior
TF_WARN_OUTPUT_ERRORS=1 terraform plan
|
Hi all! One minor change was required:
|
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. |
I'm finally getting around to moving from 0.10.8 to 0.11+ but am having issues with outputting the value of a trigger that is interpolated from another resource. I have an
aws_ecs_task_definition
that I pass to anaws_ecs_service
resource and then I use a null resource with a local exec provisioner to wait for the deployment to finish using the AWS CLI (I need this until hashicorp/terraform-provider-aws#3485 is merged) so I know that the deployment is complete.This is all wrapped in a shared module that we use for all of our ECS services but we also have a web facing service that has Cloudfront in front of it where we invalidate the cache after the deployment so the ECS service module needs to output something from the null resource so that I can have Terraform wait for the deploy to be complete before then running the Cloudfront cache invalidation.
It works fine as is (and has done for months of 0.10.8 usage now) but apparently it is failing the output interpolation check introduced in 0.10.8 (that quietly failed previously) and enforced in 0.11+. I'm not too sure why it seems to fail with triggers but specifically only interpolated ones and not statically defined trigger values (such as
triggers { foo = "bar" }}
. At first I thought Terraform was complaining because the null resource may not execute if there's no change to any of the triggers and so there's no guarantee that the null resource would be executed but I think that should also apply to statically defined trigger values. Am I misunderstanding something about the graph Terraform is building here or is this a bug one way or the other?I'm considering simply setting
TF_WARN_OUTPUT_ERRORS=1
in helper scripts for now and hoping that the above linked PR gets merged and released before 0.12 because I think this is the only case I need this but I'm curious as to the cause of this error before I suppress it.Terraform Version
Terraform Configuration Files
task-def.json:
This plans fine:
main.tf
Uncommenting the
task_definition
trigger and thenull_resource_task_definition
output and planning causes it to error:Running with
TF_WARN_OUTPUT_ERRORS=1 terraform plan
it plans okay but the above error message is written to the log.Checking 0.10.8 it also appears to be quietly erroring there as well (is there a way I can make warnings like this more visible when running much like the deprecation notices in resources? I've been sitting on this issue for a while apparently but didn't notice it in logs because I don't look at them unless something is broken) so it's not something new.
Expected Behavior
It should plan/apply fine
Actual Behavior
It fails
Steps to Reproduce
The text was updated successfully, but these errors were encountered: