Open gdelaney opened 3 years ago
A work around for this was to remove the network from the state, then import it back. The ID field is now in the correct format.
terraform state rm google_compute_network.vpc_network
terraform import google_compute_network.vpc_network projects/aproject/global/networks/mynetwork
Same issue here, thanks for the workaround.
There appears to be different behavior now with google_compute_network.id
: it does appear to be in the format projects/{{project}}/global/networks/{{name}}
. However, while this format is accepted by the API behind google_compute_network_peering
, it ends up creating a diff, because the format returned by the server is https://www.googleapis.com/compute/v1/projects/{{project}}/global/networks/{{name}}
.
We could choose to support passing network.id
(similar to https://github.com/GoogleCloudPlatform/magic-modules/pull/3621), but we would need to build in some custom logic. However, for now, the recommended solution is to use self_link
, as mentioned in the examples.
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
Terraform v1.0.7 on darwin_amd64
Affected Resource(s)
Terraform Configuration Files
Debug Output
Expected Behavior
I expect that the .id attribute to return the same values. The docs say the it should return "an identifier for the resource with format projects/{{project}}/global/networks/{{name}}"
Actual Behavior
Its returning only the vpc name and not projects/{{project}}/global/networks/{{name}}
Steps to Reproduce
terraform plan
Important Factoids
I use a service account json token to authenticate with GCP This is project that was built some time ago and we are trying to add peering between projects.
References
b/314111131