Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
When a Terraform provider has one of its parameters marked as required, it seems that even if the said parameter is injected via modules this doesn't seem to work.
For example, with a module "implementing" the Cloudflare provider and exposing the ability to create DNS records, like so:
And then a module which implements that:
Why is that?
I noticed that with other Terraform providers whose parameters are optional (such as i.e. the Google or K8s providers) this doesn't happen.
Is it a case that this is not working at all and the fact that the other providers have the parameters optional is masking this making me believe this is working when in reality it's not?
Hi @walterdolce !
I'm sorry you are experiencing an issue here. I copied the files you provided and was not able to reproduce your issue. Do my environment and directory structure match yours?
At the moment there are two things I can think of that might cause an issue like what you're seeing:
Is there anything else in the directory that contains your
If none of this applies, perhaps you could run
Since the input prompt is talking about
Our general recommendation for most cases is for only root modules to contain
Yep. That matches it. The only difference is I have a few more modules and
Nope. That's it. Those are the only Cloudflare records. Everything else is about GCP and K8s stuff.
Hmm I checked and double checked. No invalid syntax anywhere and no overrides (which I wasn't even aware of them until now!!).
Nope. There isn't. And to make it work, I have to declare the
And this makes perfect sense to me. And it also relieves me from the "burden" of having to expose the provider-specific variables via
As far as I'm concerned, this is no longer an issue for me but I'll leave it to you to decide whether this is still worth investigating and so keep this open or close it.
Thank you both!
Thanks for following up @walterdolce, and sorry we didn't respond here sooner.
From re-reading the discussion here, I think Terraform was working as expected but wasn't explaining itself well. The relevant messaging has changed somewhat in Terraform 0.12, so hopefully things are slightly better now. If not, we'll wait to see feedback about the new 0.12-style messages and work from there, and so I'm going to close this one out now. Thanks again!
I'm going to lock this issue because it has been closed for 30 days
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.