Computed Attribute Disappearance Desired Behaviour

Hi

What is a desired behaviour for the computed attribute, which disappears from the configuration?

  • Return the actual current state of resource attribute retrieved from the upstream API
  • Reset to the initial state before provising any configuration

Example

Here is attribute scheme definition:

func resourceAwsWorkspacesDirectory() *schema.Resource {
...
    Schema: map[string]*schema.Schema{
        "default_ou": {
            Type:     schema.TypeString,
            Computed: true,
...

Here is configuration excerpt:

resource "aws_workspaces_directory" "test" {
  directory_id = "d-906704be40"
}

When I don’t specify default_ou attribute in the configuration, provider saves some default value returned by upstream API, for example "ABC", to the state.

resource "aws_workspaces_directory" "test" {
  directory_id = "d-906704be40"

  default_ou = "OU=Tf,DC=Acctest,DC=Test,DC=com"
}

When I specify default_ou attribute in the configuration, provider returns and saves the specified value returned by upstream API – "OU=Tf,DC=Acctest,DC=Test,DC=com" to the state.

resource "aws_workspaces_directory" "test" {
  directory_id = "d-906704be40"
}

When I remove default_ou attribute from the configuration (returning back to the initial setup), what should I expect to get in the state – "", "ABC" or OU=Tf,DC=Acctest,DC=Test,DC=com"?