We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Constraint changes or differences (see #344) causes units to be replaced and destroyed. This is scary for an environment hosting databases.
I can see use cases where we want to increase or scale up DB units. We do so by changing the constraints, adding new units, then cycling out the old.
Sadly, the current Juju Terraform provider sees constraint changes and causes replacements which means destroying units.
Casually reporting
0.15.0
v1.7.2-dev
3.5.3
locals { # Work around Juju `unexpected new value: .constraints: was cty.StringVal("... root-disk=20G"), but now cty.StringVal(" ... root-disk=20480M").` # https://github.com/juju/terraform-provider-juju/issues/344 postgresql_disk_gigabytes = var.disk_gigabytes * 1024 postgresql_charm_constraints = "arch=amd64 cores=${var.cores} mem=${var.mem_megabytes}M root-disk=${local.postgresql_disk_gigabytes}M" postgresql_root_disk_constraint = var.postgresql_use_local_storage ? " root-disk-source=local" : "" } resource "juju_application" "postgresql" { name = "postgresql" model = var.juju_model_name trust = true charm { name = "postgresql" channel = var.postgresql_charm_channel revision = var.postgresql_charm_revision base = var.postgresql_charm_base } expose {} units = var.postgresql_charm_units constraints = "${local.postgresql_charm_constraints}${local.postgresql_root_disk_constraint}" }
terraform init & terraform apply Update `postgresql_disk_gigabytes` to some other value terraform apply
# module.postgresql-database.juju_application.postgresql must be replaced -/+ resource "juju_application" "postgresql" { ~ constraints = "arch=amd64 cores=2 mem=4096M root-disk=20480M" -> "arch=amd64 cores=2 mem=4096M root-disk=30720M" # forces replacement ~ id = "stg-is-dbaas-testing:postgresql" -> (known after apply) name = "postgresql" ~ placement = "5,6,7" -> (known after apply) + principal = (known after apply) ~ storage = [ - { - count = 1 -> null - label = "pgdata-3" -> null - pool = "rootfs" -> null - size = "20G" -> null }, - { - count = 1 -> null - label = "pgdata-4" -> null - pool = "rootfs" -> null - size = "20G" -> null }, - { - count = 1 -> null - label = "pgdata-5" -> null - pool = "rootfs" -> null - size = "20G" -> null }, ] -> (known after apply) # (3 unchanged attributes hidden) ~ charm { name = "postgresql" ~ series = "jammy" -> (known after apply) # (3 unchanged attributes hidden) } # (1 unchanged block hidden) } Plan: 1 to add, 0 to change, 1 to destroy.
### Notes & References _No response_
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Description
Constraint changes or differences (see #344) causes units to be replaced and destroyed. This is scary for an environment hosting databases.
I can see use cases where we want to increase or scale up DB units. We do so by changing the constraints, adding new units, then cycling out the old.
Sadly, the current Juju Terraform provider sees constraint changes and causes replacements which means destroying units.
Urgency
Casually reporting
Terraform Juju Provider version
0.15.0
Terraform version
v1.7.2-dev
Juju version
3.5.3
Terraform Configuration(s)
Reproduce / Test
Debug/Panic Output
The text was updated successfully, but these errors were encountered: