Hi,
I have been testing out the new framework and came across and issue with using a plan modifier to set a default value for an attribute. I believe these two examples should do the same however the framework one errors with:
Provider "registry.terraform.io/hashicorp/framework" planned an invalid value
for framework_user.foo.with_default: planned value cty.StringVal("example")
for a non-computed attribute.
Framework:
"with_default": {
Type: types.StringType,
Optional: true,
PlanModifiers: tfsdk.AttributePlanModifiers{stringDefault("example")},
},
SdkV2
"with_default": {
Type: schema.TypeString,
Optional: true,
Default: "example",
},
I added an example on the corner project - GitHub - iwarapter/terraform-provider-corner at issue-plan-modifier-on-optional showing the working sdkv2 and failing framework.