Open soenkeliebau opened 4 years ago
Hi @soenkeliebau,
I guess, the null
comes from accessing the not existing nic
list. I could also reproduce the error.
However, there's no need to workaround. You just have to use
${nat.primary_ip}
in the template file.
FYI the versions I used:
Terraform v0.12.25
+ provider.local v1.4.0
+ provider.profitbricks v1.5.5
Hi there,
Thank you for opening an issue. Please note that we try to keep the Terraform issue tracker reserved for bug reports and feature requests. For general usage questions, please see: https://www.terraform.io/community.html.
Terraform Version
Terraform v0.12.28
Affected Resource(s)
The issue turned up in the combination of the following two resources:
Terraform Configuration Files
main.tf
hosts.tpl
Debug Output
https://gist.github.com/soenkeliebau/2e7d4a3f0d91ec5a3d4ae42f4e7c30f8
Expected Behavior
I expected terraform to provision the resources and then fill the template with proper values after the apply finished.
Actual Behavior
Terraform errored out during the plan phase with the following error message:
If I remove this expression from the hosts.tpl file when starting terraform and insert it again, before the command is finished, the proper value is inserted into the template.
To me this looks a bit like the provisioner is setting
null
instead ofunknown
as value for some properties during the plan phase, which causes the templatefile to evaluate these and create the error shown.Replacing
${nat.nic[0].ip}
with${nat.nic[0].ip == null ? "null" : nat.nic[0].ip}
solves the issue as well, but seems to me like a workaround rather than a fix.Steps to Reproduce
Please list the steps required to reproduce the issue, for example:
terraform apply