Closed lripoche closed 4 months ago
Hi @lripoche!
Please confirm if you already have the google_compute_address
resource created, and then when you are trying to update some properties it returns the last error.
If that is right, please include the arguments that you're modifying (like subnetwork
, address_type
, purpose
, etc.)
Yes the google_compute_address
already exists. For an unknown reason, each time I run tf apply
terraform thinks the subnetwork will change (although the configuration did not changed) and say the google_compute_address
must be replaced.
That's when the "bug" occurs because terraform tries to create the google_compute_address
before destroying it.
Hi @lripoche!
This scenario was replicated successfully and without errors.
network
in the subnetwork
attribute of the google_compute_address
. You need to fix it.google_compute_address
resource in your terraform configuration. For this I suggest you to separate your resources and test only the involved resources in 1 separated project to confirm that everything works(google_compute_address, google_compute_network and google_compute_subnetwork), and then check the other resources to identify where you have a bad configuration.You can learn more of how to work with these services on this link
You are right, at the time I created the issue I was only creating a network and I left it to handle the auto-provisioning of the regional subnetworks.
As google_compute_network
, to my knowledge, does not have an attribute listing regional subnetworks IDs I used the network ID.
Now I deploy my own subnetwork to use its ID and I don't have the issue anymore.
Thanks for your help!
It was a pleasure, have a happy coding!
I'm going to lock this issue because it has been closed for 30 days ā³. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
Community Note
Terraform Version
Terraform v1.7.5 on linux_amd64
Your version of Terraform is out of date! The latest version is 1.8.1. You can update by downloading from https://www.terraform.io/downloads.html
Affected Resource(s)
google_compute_address
Terraform Configuration
Debug Output
https://gist.github.com/lripoche/ef1afd3a6b3eafb15e3a367abadf2374
Expected Behavior
Compute address should be destroyed and re-created
Actual Behavior
Terraform tries to create the address before destroying it, resulting in an error:
Steps to reproduce
terraform apply
Important Factoids
No response
References
No response