I’m working on a project which deploys a k8s cluster (or multiple) in google cloud. This deployment is being done with Terraform.
After the deployment the cloud-controller is in charge of parts of the google infrastructure, especially;
- forwarding rules
- firewall rules
When I want to delete the cluster with terraform destroy, it fails because those objects are not managed by terraform (and so terraform cannot delete them in the right order).
Example of an error.
Error: Error when reading or editing Subnetwork: googleapi: Error 400: The subnetwork resource 'projects/tf-test/regions/europe-west4/subnetworks/sn-cluster' is already being used by 'projects/tf-test/regions/europe-west4/forwardingRules/a0b4229fbbea84b3d994b03b2ce98542', resourceInUseByAnotherResource
Is there a way to force this deletion (especially on a subnet). I’m looking into it now with terraformer, but it feels like going down a rabbit hole, where I shouldn’t go.
Currently I’m using;
Google provider v3.58.0