-
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
Terraform 0.14 destroy provisioner issues: Invalid value for "inputMap" parameter: argument must not be null. #28065
Comments
Update: removing the |
Ah, OK, this looks like a bug with resource "aws_acm_certificate" "cert" {
# ... (various params) ...
tags = {
foo = "bar"
}
provisioner "local-exec" {
when = destroy
command = "echo 'tags = ${jsonencode(self.tags)}'"
}
} Note how
This is as expected. But now, let's hard-code resource "aws_acm_certificate" "cert" {
# ... (various params) ...
tags = {}
provisioner "local-exec" {
when = destroy
command = "echo 'tags = ${jsonencode(self.tags)}'"
}
} Now when I run
So |
I believe the workaround is to check for command = (
self.tags != null
? tobool(lookup(self.tags, "foo", false)) ? "${path.module}/script.sh ${self.arn}" : "true"
: "true"
) |
Hi @brikis98, Thanks for the followup! Looking a little more closely, the cause of the behavior seen here is due to the provider itself, or more specifically the legacy SDK used by most providers. The logs from applying the resource will contain a line like:
The provider here is returning a null value rather than the configured empty map, which is what is ultimately passed to the provisioner. Because the legacy SDK cannot readily differentiate between empty and null values, it's a shortcoming we have to accept for the time being. I am going to close this out however, since there is nothing we can do to mitigate this in Terraform itself. Thanks! |
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
Expected Behavior
terraform destroy
runs successfully.Actual Behavior
When running
destroy
, we get the error:Note: there is no file or line number in the error, so it took us a long time to figure out that it was the
destroy
provisioner! So at the very least, is there a way to improve this error message?Steps to Reproduce
terraform init
terraform apply
terraform destroy
Additional Context
We are looking up data in
self.tags
as a workaround fordestroy
provisioners not being able to reference any other resources as of 0.13. This code worked fine with 0.13, but it seems that as of 0.14,destroy
provisioners are even more restricted in some way? I'm not sure, as the error message is vague, and doesn't provide any detail of what's actually wrong.The text was updated successfully, but these errors were encountered: