-
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
Variables used only in provider blocks are reported as missing #14940
Comments
I'm seeing this with pagerduty provider as well, so i don't think it's related specifically to the postgresql provider. |
I've the same issue
|
I'm hitting this issue as well with
The problem seems to be if a variable is only used within a provider and module section, then it will throw the unknown variable error; However, if you slap that variable as an output, it fixes the problem. |
That sounds like a good clue, @Chili-Man! Thanks for noting that detail. It sounds like the bug is that Terraform's graph builder is doing some "pruning" here and not detecting that the variables are in fact being used in the provider block. I'll update the summary to cover that detail. |
@Chili-Man At what level did you make it an output? I tried at the module level where the variable/provider are declared but still got the same error. |
with v0.10.8 and when running import (the resource to import is an ECS repository), this module raised similar error:
it seems default values in module are required and will be used by the "import" command line, which is unexpected. |
For me if i put the provider on my main.tf and not on my module, this work good. |
When adding the variable to the output my error does not go away. |
seeing the same, how are you guys getting around this? |
Hi all, Thanks for all of the additional context here, and sorry for the long silence. Looking at this issue again after some time away, I notice that many of you are talking about For Given that this seems to be the same issue, I'm going to close this one just to consolidate the discussion over in #13018. @s2504s as far as I can tell you are the only one in this thread having a problem with |
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. |
Thanks for any help you might be able to provide. This looks very similar to #10711 (which I mention in references, below -- I didn't know if I should be continuing that closed/merged issue conversation or starting a new one).
Terraform Version
0.9.4, 0.9.6
Affected Resource(s)
Appears when defining
postgresql
provider
inside a module. Works as expected if provider is defined in main tf file.Terraform Configuration Files
In main tf file:
In module variables:
In module:
Debug Output
Command run
Output
The reported unknown variable changes each time, but is one of the ones referenced in the
provider
block.Expected Behavior
I would expect to be able to
import
just as well if the provider is defined in the module.Actual Behavior
I cannot import unless I've defined the
provider
inline (theresource
can remain in the module and refer to theprovider
defined outside of the module).Steps to Reproduce
Command (see above):
Important Factoids
I've tried this both with
-var-file
and without, and it doesn't appear to make any difference.References
The text was updated successfully, but these errors were encountered: