-
Notifications
You must be signed in to change notification settings - Fork 910
New issue
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
Order of google_cloud_run_v2_service => volumes constantly need update #2698
Comments
This seems to be a fairly-common problem with Terraform and complex attributes... In this case, is it because there's some "magic" involved in the cloudsql mapping? If I do a |
from debug output:
|
I think upstream module has an issue here, and we're triggering it. If we use the following with google_cloud_run_v2_service
then plan/apply shows a delta every time. If we swap the order of the volume mounts, then it shows no-changes. So, I assume this means that Google is returning these in a particular order, not the order they were added. Interestingly The challenge is that (I think) we are reordering any volume_mounts that cloud-run-v2 module is passed by using:
If we do cloudsql mounts last this seems to work (at least for this case). I don't know terraform well enough to do a filter, and a separate dynamic content. There's probably something similar for the |
TLDR: we seem to need to provide the cloudsql volume/volume_mount last when calling the upstream module. for now |
Raised a bug on the provider hashicorp/terraform-provider-google#20360 but... pragmatically maybe we should work around it here? |
I'm able to reproduce the issue with the volume name So there is no good solution within module as of now 🫤 |
@wiktorn would it be enough to split the dynamic block into multiple dynamic blocks, and pin the order? It's quite a bit of work as we would need to correlate volumes and mounts, but doable. |
Let me test that out. |
I was experimenting with splitting the volume_mount loop (but ran out of time). Iirc just reordering the volume stanza fixed that half |
I have a working fix for Cloud SQL, it's needed in both volume definitions and mounts, just checking all the other mount types as I'm at it. |
Works for me, in my limited case.
|
Describe the bug
When applying the same terraform code repeatedly, the order of two volumes/volume_mounts is always different, creating unnecessary changes for "apply"
Environment
To Reproduce
A resource with two volume/mounts, and apply these. eg:
Expected behavior
On subsequent run, there should be no change/diff.
Result
Immediately after applying, when terraform-apply again:
Additional context
Is this issue with underlying module, or our use of it?
The text was updated successfully, but these errors were encountered: