-
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
module output can not be interpolated in local-exec command #17337
Comments
I have a feeling that this is some kind of a security feature? |
Hey @matti can you give me more information about how the module Perhaps I'm mistaken, but I believed |
@catsby I did some additional testing and a clear repro repository (without that module) here: https://github.com/matti/terraform-repro-issue-17337 |
@jbardin this reminds me of the issue you were looking at recently where locals and outputs were not being handled properly in some situations, which led to you reworking how we build the graph nodes for these. Does it look like something similar to you, or am I off-base here? |
@apparentlymart just narrowed down the repro: this bug only happens on destroy and this the repro doesn't have locals at all |
Yes, it appears there are still some more edge cases in destroy. |
@matti Looks like James or Martin will be picking this up, thank you so much for the above and beyond digging and information providing 😄 |
Can I assume here that you're encountering the errors during destroy, though your example only mentions apply? (The reference is in a destroy provisioner, and I can't replicate this on apply). If that's the case, then the good news is it is already fixed in master! The less good news is that this hits the other destroy-time edge case I'm working on right now and Also, while it should not return an error, adding a "depends_on" to a data source isn't very useful right now, since it's always going to show a diff in the plan. |
Yes, only on destroy. |
The root cause here turns out to be the combined behavior of a destroy provisioner and a data source using #17034 Should take care of the bulk of this issue for us. There may be some additional details to consider, but we need to get the datasource lifecycle fixed up first. |
Hi all! Sorry for the long silence here, and thanks for sharing the reproduction cases. During the 0.12 cycle we (the Terraform team at HashiCorp) looked into the design and implementation of destroy-time provisioners and found that there were some irreconcilable flaws in the way they were conceived, and this issue is a symptom of those flaws. In order to retain as much of the functionality of destroy-time provisioners as possible while addressing the design flaws, one of the 0.12 minor releases began a deprecation cycle for referring to objects other than As a consequence of that, the example given in the original framing of this bug will no longer be considered valid in Terraform 0.13, because the destroy-time provisioner refers to resource "null_resource" "wat" {
triggers = {
message = local.thisdoesnt
}
provisioner "local-exec" {
when = "destroy"
command = "echo ${self.triggers.message}"
}
} For The 0.13 upgrade guide is not published on the main website yet because the release is still in beta as I write this, but we have a draft of the upgrade guide in a temporary location which includes a section Destroy-time provisioners may not refer to other resources that includes some additional details. (Similar content will appear in the main 0.13 upgrade guide after the 0.13.0 final release.) Since this broader change has now intentionally made the original reproduction case invalid, I'm going to close this issue. While these new restrictions are inconvenient, they are necessary to fix fundamental problems with how destroy-time provisioners were designed, and so various other issues around ordering of operations during destroy have either already been resolved for 0.13.0 or will be addressed by ongoing improvements in future releases. |
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. |
Terraform Version
Terraform Configuration Files
Debug Output
Expected Bahviour
String would be interpolated.
Actual Behaviour
* local-exec provisioner command must be a non-empty string
Steps to Reproduce
main.tf
terraform init
terraform apply
Also just directly interpolating module output won't work. Variable interpolation works.
The text was updated successfully, but these errors were encountered: