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

Add DefaultFunc / Default field for provider configuration #837

Closed
BBBmau opened this issue Sep 7, 2023 · 2 comments
Closed

Add DefaultFunc / Default field for provider configuration #837

BBBmau opened this issue Sep 7, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@BBBmau
Copy link

BBBmau commented Sep 7, 2023

When working on the integration for helm, I found that plugin-framework does not support default values within provider configurations.

This is a requirement as helm uses Default values that are often obtained from Environment variables. An example of how this is implemented in SDKv2 can be seen below.

// Provider returns the provider schema to Terraform.
func Provider() *schema.Provider {
	p := &schema.Provider{
		Schema: map[string]*schema.Schema{
			"debug": {
				Type:        schema.TypeBool,
				Optional:    true,
				Description: "Debug indicates whether or not Helm is running in Debug mode.",
				DefaultFunc: schema.EnvDefaultFunc("HELM_DEBUG", false),
			},
			"plugins_path": {
				Type:        schema.TypeString,
				Optional:    true,
				Description: "The path to the helm plugins directory",
				DefaultFunc: schema.EnvDefaultFunc("HELM_PLUGINS", helmpath.DataPath("plugins")),
			},
			"registry_config_path": {
				Type:        schema.TypeString,
				Optional:    true,
				Description: "The path to the registry config file",
				DefaultFunc: schema.EnvDefaultFunc("HELM_REGISTRY_CONFIG", helmpath.ConfigPath("registry.json")),
			},
...

Currently I am unable to complete the provider configuration for helm without the fields.

Proposal

It seems like the same logic from other attributes can be applied for the Provider to contain this field also. I am also assuming that theirs already an ability to grab Environment variables that is similar to that found in SDKv2

References

https://github.com/hashicorp/terraform-plugin-framework/blob/main/provider/schema/schema.go
https://github.com/hashicorp/terraform-plugin-framework/blob/main/resource/schema/string_attribute.go

@BBBmau BBBmau added the enhancement New feature or request label Sep 7, 2023
@BBBmau
Copy link
Author

BBBmau commented Sep 7, 2023

Closing this issue since its a duplicate of #539

@BBBmau BBBmau closed this as completed Sep 7, 2023
@github-actions
Copy link

github-actions bot commented Oct 7, 2023

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant