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

Better unknown value handling in Configure or PrepareProviderConfig #331

Closed
jbardin opened this issue Feb 20, 2020 · 5 comments
Closed

Better unknown value handling in Configure or PrepareProviderConfig #331

jbardin opened this issue Feb 20, 2020 · 5 comments
Labels
enhancement New feature or request terraform-plugin-framework Resolved in terraform-plugin-framework

Comments

@jbardin
Copy link
Member

jbardin commented Feb 20, 2020

Terraform core allows providers to be configured referencing values that won't be known until apply, since in some cases providers don't need a complete configuration to create a plan. This provides some utility for providers expecting it, but the current SDK does not expose that a value is unknown, so defaults are often applied instead. This usually results in confusing errors from the provider, or even the provider being used with the incorrect configuration.

The SDK could assist in the validation of unknown config values. The current protocol provides 2 calls that both may need to handle this situation:

  • PrepareProviderConfig is where the configuration defaults are inserted and the entire config is validated (akin to a "plan" for provider configuration). Unknown values currently pass through PrepareProviderConfig untouched.
  • Configure is where the configuration is applied to the provider, and this is where the "unknown" status of configuration values is lost.
@jbardin jbardin added the enhancement New feature or request label Feb 20, 2020
@paultyng
Copy link
Contributor

Related to #261

@apparentlymart
Copy link
Contributor

There is some background discussion on this in hashicorp/terraform#24164, including a real example of an existing provider (mysql) attempting to operate in a partially-configured state.

@hazcod
Copy link

hazcod commented Feb 26, 2020

Additionally, I have the case where my kubernetes provider is using output values from scaleway provider. During plan & apply, the kubernetes provider will error out because of missing config..

@paddycarver
Copy link
Contributor

With the release of terraform-plugin-go, this is now supported through that library. It is not supported through helper/schema yet, and I don't know that it ever will be, or even could be. Given that, I'm going to close this issue out, but people should feel free to comment here if this solution is unworkable for some reason.

@ghost
Copy link

ghost commented Dec 11, 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 as resolved and limited conversation to collaborators Dec 11, 2020
@bflad bflad added terraform-plugin-framework Resolved in terraform-plugin-framework and removed project/hcl2-native-sdk labels Mar 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request terraform-plugin-framework Resolved in terraform-plugin-framework
Projects
None yet
Development

No branches or pull requests

6 participants