Skip to content
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

Providers can be configured with unknown values #24131

Closed
hazcod opened this issue Feb 17, 2020 · 7 comments
Closed

Providers can be configured with unknown values #24131

hazcod opened this issue Feb 17, 2020 · 7 comments
Assignees

Comments

@hazcod
Copy link

hazcod commented Feb 17, 2020

Terraform Version

Latest

Terraform Configuration Files

https://github.com/ironPeakServices/infrastructure/tree/debug/submodulevars

Debug Output

https://github.com/ironPeakServices/infrastructure/pull/19/checks?check_run_id=450132650#step:9:655

Expected Behavior

Submodules using the specified variables.
In my case, I pass my submodule arguments via the submodule variables.

Actual Behavior

Kubernetes (or any other) provider is not using the passed variables.
A workaround is needed by specifying the provider variables in the root module (here commented for the sake of this issue): https://github.com/ironPeakServices/infrastructure/blob/debug/submodulevars/versions.tf#L7

Steps to Reproduce

terraform plan .

Additional Context

Possibly related/causing hashicorp/terraform-provider-kubernetes#708

References

hashicorp/terraform-provider-kubernetes#708

@jbardin
Copy link
Member

jbardin commented Feb 17, 2020

Hi @hazcod,

Thanks for filing the issue. The problem here is that you are attempting to configure a provider using computed values from resources not yet created. A provider cannot refer to anything unknown before it's configured, (see Provider Configuration), and the kubernetes provider in your configuration is being configured using the values from scaleway_k8s_cluster_beta.ironpeakbe-main-cluster which does not exist on the first apply.

So the configuration you have is passing the data as expected, and using those values with resources would work as expected, but the provider itself is ignoring the unknown values. This should be better validated during plan, so that providers aren't accidentally configured with incorrect values.

@jbardin jbardin changed the title Submodules not receiving variables Providers can be configured with unknown values Feb 17, 2020
@jbardin jbardin self-assigned this Feb 17, 2020
@hazcod
Copy link
Author

hazcod commented Feb 18, 2020

Thanks for confirming @jbardin , this was slowly driving me mad. :-)

@hazcod
Copy link
Author

hazcod commented Feb 20, 2020

@jbardin : just to be sure, is the problem here that plan should ignore this provider dependency and this should work during apply?
If not, I don't see how scaleway+kubernetes providers could ever work for a fresh start?

@jbardin
Copy link
Member

jbardin commented Feb 20, 2020

@hazcod, This cannot work if the provider needs to use that configuration during plan or refresh which is often the case. The linked PR would only serve to make this fail more quickly with an error directly referring to the unknown values in the config, rather than risking the provider being configured incorrectly. Unfortunately it's been pointed out that some providers rely on this behavior, and it can be useful in a few cases. We still need more safety here, but that is better handled by the provider SDK than in core.

@jbardin
Copy link
Member

jbardin commented Feb 26, 2020

Closing this is preference for hashicorp/terraform-plugin-sdk#331

@jbardin jbardin closed this as completed Feb 26, 2020
@ghost
Copy link

ghost commented Mar 31, 2020

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.

1 similar comment
@ghost
Copy link

ghost commented Apr 1, 2020

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.

@ghost ghost locked and limited conversation to collaborators Apr 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants