openinfrastructure / terraform-google-multinic

Connect two VPC networks with an auto-healing, auto-scaling group of IP router instances.
Apache License 2.0
10 stars 5 forks source link

Investigate destroy error upgrading from 1.4.0 to 2.0.0 #23

Closed jeffmccune closed 4 years ago

jeffmccune commented 4 years ago

Terraform refuses to destroy the instance template, saying it's in use by the instance group manager.

jeffmccune commented 4 years ago

First apply in examples/multiregion after switching from 1.4.0 to 2.0.0

Error: Error waiting for Deleting InstanceGroupManager: The instance_group_manager resource 'projects/multinic-networks-18d1/zones/us-west1-c/instanceGroupManagers/multinic-us-west1-c-us-west1-c'
is already being used by 'projects/multinic-networks-18d1/regions/us-west1/backendServices/multinic-transit-us-west1'
jeffmccune commented 4 years ago

Second apply, same error.

First terraform destroy in examples/multiregion still in 2.0.0

Error: Error deleting instance template: googleapi: Error 400: The instance_template resource 'projects/multinic-networks-18d1/global/instanceTemplates/multinic-us-west1-a20200930174329933400000006' is already being used by 'projects/multinic-networks-18d1/zones/us-west1-a/instanceGroupManagers/multinic-us-west1-a-us-west1-a', resourceInUseByAnotherResource
jeffmccune commented 4 years ago

Second destroy cleaned everything up:

Destroy complete! Resources: 7 destroyed.

Then, terraform apply works as expected with 2.0.0:

Closing as a known issue with the major version upgrade to 2.0.0, the resource addresses changed and therefore upgrading this module should first destroy 1.4.0 and apply 2.0.0.

In the future, major version upgrades should be carried out by first creating an entirely new multinic cluster in the region, ideally with a slightly higher priority route resource. Use a different name_prefix and route priority, then destroy the previous multinic clusters.