Skip to content

Inconsistent Terraform Plan vs. State for mssql_database Resource #131

@srinathgvelly

Description

@srinathgvelly

Current Behavior:
When running terraform plan, the output indicates that the mssql_database.database resource will be updated in-place. Specifically, it shows a change in the name attribute from "another_database_name" to "same_database_name". However, upon inspection of the Terraform state, it shows that the name attribute is already "same_database_name".

Expected Behavior:
The terraform plan output should reflect the actual state in the Terraform state file. If the name attribute is already set to "same_database_name" in the state, it should not be flagged for update.

Steps to Reproduce:

Ensure that the Terraform state is as described in the provided state snippet.
Execute terraform plan in the project directory.
Observe the plan output for the mssql_database.database resource.

Additional Information:

Terraform Version: 1.5.7
Provider: registry.terraform.io/pgssoft/mssql - v0.6.0
There are more than 20 databases in the same state file, and this behavior is happening for 4 of them.

Terraform plan:

# mssql_database.database will be updated in-place
  ~ resource "mssql_database" "database" {
        id        = "21"
      ~ name      = "another_database_name" -> "same_database_name"
        # (1 unchanged attribute hidden)
    }

Terraform state

{
  "mode": "managed",
  "type": "mssql_database",
  "name": "database",
  "provider": "provider[\"registry.terraform.io/pgssoft/mssql\"]",
  "instances": [
    {
      "schema_version": 0,
      "attributes": {
        "collation": "Latin1_General_CI_AS",
        "id": "21",
        "name": "same_database_name"
      },
      "sensitive_attributes": []
    }
  ]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions