How can I represent the following SDKv2 schema attribute in the plugin framework:
"username": {
Type: schema.TypeString,
Required: true,
DefaultFunc: schema.EnvDefaultFunc("USERNAME", nil),
}
My (flaved) migration currently is:
"username": {
Optional: true,
Type: types.StringType,
PlanModifiers: tfsdk.AttributePlanModifiers{
DefaultValueFromEnvironment("USERNAME"),
},
},
where 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.