-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Deleting instance template while updating template of an Instance group manager in the same apply #10365
Comments
@rdiaz002 have you tried adding lifecycle.create_before_destroy in the config? // Update mig to use template_2
resource "google_compute_instance_group_manager" "mig_1" {
name = "mig-1"
base_instance_name = "mig-instance"
zone = var.default_zone
target_size = 2
version {
instance_template = google_compute_instance_template.template_2.id
}
lifecycle {
create_before_destroy = true
}
} |
@edwardmedia I tried adding create_before_destroy and I get back the same error. |
@rdiaz002 can you share the debug log and the detailed steps how you did? |
Steps to reproduce
Here is my debug log
|
@rdiaz002 can you try adding the |
I added the Here is the debug log.
|
@ScottSuarez Does |
Can you put |
Steps to reproduce
Result:
Here is my debug log
My current workaround is a script that does a two phase apply. First phase involves any target resources that need to be updated before hand. The second phase is the remaining resources. |
…r enterprise (hashicorp#10365) [upstream:1c575ec1b7fe3a731908b461601025a45f90a7ed] Signed-off-by: Modular Magician <magic-modules@google.com>
FWIW, I came here by googling the error message, and setting |
The reason of this issue may come from the lack of the |
I found a workaround that set new template to the IGM when a template is recreating. resource "google_compute_instance_template" "a_template" {
...
provisioner "local-exec" {
command = <<-EOF
if gcloud compute instance-groups managed describe the-igm \
--zone ${var.zone} &>/dev/null; then
gcloud compute instance-groups managed set-instance-template the-igm \
--template ${self.id} --zone ${var.zone}
fi
EOF
} Thereby, succeeding deletion of the old template is not blocked by the IGM. |
Community Note
modular-magician
user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If an issue is assigned to a user, that user is claiming responsibility for the issue. If an issue is assigned tohashibot
, a community member has claimed the issue already.Terraform Version
Affected Resource(s)
Terraform Configuration Files
Before Apply
After Apply
Expected Behavior
Terraform should update the instance group manager first and then delete the old instance template
Actual Behavior
Terraform tries to delete the old instance template and then update the instance group manager. This leads to the following error.
Steps to Reproduce
terraform apply
terraform apply
The text was updated successfully, but these errors were encountered: