How can I represent the following SDKv2 schema attribute in the plugin framework:
DefaultFunc: schema.EnvDefaultFunc("USERNAME", nil),
My (flaved) migration currently is:
DefaultValueFromEnvironment is a simple modification of the
DefaultValue attribute plan modifier.
The problem is that I can’t mark the attribute as required (as in either set in the resource, or from the environment variable), since required seems to be checked a long time before the attribute plan modifiers are ran.
Hi Magne, I got the same issue here… I wonder whether you were able to find a solution or workaround for this.
Sorry, but I never found a solution. There seems to be little progress on the new API, and even less interest in supporting and answering early adopters.
Not sure if it is a solution, cause I’m currently struggling with “defaults” myself, but might be worth a shot.
Core Framework v1.2.0 introduces default values.
So it might be possible to simply set the default to the
Don’t forget to add.
I apologize for the delay. Is the
username attribute defined in a Provider schema? And is it a top-level attribute or defined within a
In general, we don’t allow the
Required field to be defined with the
Default fields for Resources in the Framework to prevent the Provider from overwriting any user configuration. In either of those cases the attribute would need to be marked
If this is an attribute in a Provider schema, then since newer versions of the Framework no longer allow
PlanModifiers to be set in Provider schemas (there’s no concept of “planning” at the Provider level), you would move the logic of your
DefaultValueFromEnvironment() function to the Provider level
Configure() method instead.