Skip to content

Commit

Permalink
fix: Ignore changes to root_password (#279)
Browse files Browse the repository at this point in the history
root_password can only be set by the provider when
the instance is provisioned and it seems that even if
the provider could read the password then one would not
wish to destroy and recreate the instance because the
password did not match what was in Terraform.

This is specifically relevant to emergency maintenance
where somebody might have to re-import a cloned version
of the SQL server into state in a cleanup exercise. The
imported server has a null root_password because that is
what the provider has to set it to on import. The password
currently present in the state in this scenario will force
a destroy and create of the instance because of this
change.

The way to avoid this is to ignore changes for root_password

Co-authored-by: Andy Smith <iamasmith.home@gmail.com>
  • Loading branch information
iamasmith and iamasmith committed Feb 18, 2022
1 parent ab8c768 commit d8c9959
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion modules/mssql/main.tf
Expand Up @@ -118,7 +118,8 @@ resource "google_sql_database_instance" "default" {

lifecycle {
ignore_changes = [
settings[0].disk_size
settings[0].disk_size,
root_password
]
}

Expand Down

0 comments on commit d8c9959

Please sign in to comment.