Framework - Optional attribute with plan modifier


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 "" planned an invalid value
  for planned value cty.StringVal("example")
  for a non-computed attribute.


"with_default": {
	Type:          types.StringType,
	Optional:      true,
	PlanModifiers: tfsdk.AttributePlanModifiers{stringDefault("example")},


"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.

To prevent this type of error, the Attribute should also be marked with Computed: true to signal to Terraform CLI that the value may come from the provider, instead of just the configuration.

thanks @bflad I had seen the change to the docs to highlight this change from the previous SDKv2 style.