Customer Provider: Infer values for optional attributes from other attributes

Hi there,

I’m writing a custom provider.

And for some attributes in the resource, I want to set their values from other attributes if the value is not provided.

For example,

map[string]*schema.Schema{
			"name": {
				Type:     schema.TypeString,
                Required: true
			},
			"nickname": {
				Type:     schema.TypeString,
                Optional: true
			},
     ....
}

In the above example, the user can set the nickname attribute or I’ll set it the same as name if it’s not provided.

Is it doable in terraform?