-
Notifications
You must be signed in to change notification settings - Fork 55
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
Allow renaming a folder name without destroying the folder #41
Comments
Hi, resource "google_folder" "folders" {
count= length(var.names)
display_name = "${local.prefix}${var.names[count.index]}"
parent = var.parent
} |
@lemoo5sg Are moved blocks another alternative you could consider? The first approach maybe possible to implement but it would be a breaking change and some added complexity. |
@bharathkkb thanks for your comment ; nope, moved blocks (or state mv commands) mean additional / manual actions each time, it's better that the module handles renaming by design. |
I'm playing around with some code to get by this myself, and it still feels pretty ugly :D - NOTE: I'm not using this module but what I'm wondering is if anyone has any links to good examples of folks using this resource in a reasonably DRY way? At this point, for me, it's more around subfolders and just copy-pasting resources with different parent keys. |
Hi, (lemoo5sg but now working for another company ;) |
TL;DR
Note: We have originally opened issue 40, which has been closed because similar to issue 38.
However issue 38 is also closed with no change delivered, stating that this is due to a terraform constraint.
However we reject this reason, there is a proposed solution.
Request:
If we rename a previously created folder through names variable, terraform will destroy the folder and recreate a new one, as the folder name is used as a for_each key.
Note 1: the workaround to manually remove the folder from the state and delete the folder is not acceptable, the goal is to automate with Terraform and avoiding manual actions.
Note 2: Also the potential workaround to add the new folder name as a new value in the list and keep the old name as it is is not acceptable as we do not want to keep a second folder, we need a renaming.
Terraform Resources
Proposed Solution
This way, when we change folder_name later to "new_name", we do not change folder_key, the state key is unchanged and the folder is renamed as expected.
Originally posted by @lemoo5sg in #38 (comment)
The text was updated successfully, but these errors were encountered: