Closed gtato closed 1 month ago
+1 on this terraform state should not hold unrelated storage details for application resource. I mentioned in this bug as well https://github.com/juju/terraform-provider-juju/issues/539
Hey @hemanthnakkina,
Failed to reproduce it; here is the result: https://paste.ubuntu.com/p/78zkhZG5kV/ (juju 3.5 + microk8s)
It looks like it's working. The only concern is that storage pgdata
was not deleted after plan update:
└─▪ juju status --storage
Model Controller Cloud/Region Version SLA Timestamp
test microk8s microk8s/localhost 3.5.3 unsupported 13:52:06+03:00
App Version Status Scale Charm Channel Rev Address Exposed Message
test-data-integrator active 1 data-integrator latest/stable 41 10.152.183.109 no
test-postgresql 14.11 active 1 postgresql-k8s 14/stable 198 10.152.183.206 no
Unit Workload Agent Address Ports Message
test-data-integrator/0* active idle 10.1.52.196
test-postgresql/0* active idle 10.1.52.251 Primary
Storage Unit Storage ID Type Pool Mountpoint Size Status Message
test-postgresql/0 pgdata/0 filesystem kubernetes /var/lib/postgresql/data 1.0 GiB attached
hm...
@anvial I think you have reproduced it. Lines 288-295 are the ones I am talking about. Why is there a storage associated with data-integrator?
Yep, now I see. It looks like there is a bug in case we change something with the integrated app.
Interesting that it wishes to remove (according to terraform apply
), but actually didn't remove, but frankly is shouldn't remove.
The problem is because we're getting full juju status data for the entire model and not checking the storage listed is for the application we're interested in. The fix will be to call status for only the application we're interested in.
This change will also fix #539 and help with #535
Description
I have a terraform plan consisting of multiple applications, one of them using storage directives (a postgres app) and others that don't. Whenever I upgrade some configuration of the apps that are not using storage, terraform plan shows as if the storage of the postgres application will be deleted. If the plan is executed, the storage is not actually deleted, but I think the plan is confusing.
Urgency
Annoying bug in our test suite
Terraform Juju Provider version
0.13.0
Terraform version
v1.7.2
Juju version
3.1.9
Terraform Configuration(s)
Reproduce / Test
Debug/Panic Output
Notes & References
I had this issue in production and I was afraid to continue the plan because I wasn't sure if that would destroy the database.