This is a minimal repo to provide repro steps for hashicorp/terraform-provider-google#2799.
git clone
this repo- provide a valid service account key at
account.json
git checkout fc01d6556b4d39a4b66a7fe77ee562ed47e91061
terraform init
terraform apply
and enter the gcp project (the service account whose key you provided above must have appropriate permissions in this project)
If all goes well (?), you will get this error:
google_service_networking_connection.private_vpc_connection: Creating...
network: "" => "example"
reserved_peering_ranges.#: "" => "1"
reserved_peering_ranges.0: "" => "google-managed-services-example"
service: "" => "servicenetworking.googleapis.com"
Error: Error applying plan:
1 error(s) occurred:
* google_service_networking_connection.private_vpc_connection: 1 error(s) occurred:
* google_service_networking_connection.private_vpc_connection: Failed to find Service Networking Connection, err: Failed to retrieve network field value, err: project: required field is not set
- To clean things up from the first run repro'ing the problem,
terraform destroy
git checkout 121327a68696e7d06ffd384870dea7f3fecb843e
(this commit switches to the aliased provider which has the project set)terraform apply
NOTE: you will get farther in the process (validating the workaround), but you will get the error below. I excluded the null resource which is running scripts to provision the IP range.
google_service_networking_connection.private_vpc_connection: Creating...
network: "" => "example"
reserved_peering_ranges.#: "" => "1"
reserved_peering_ranges.0: "" => "google-managed-services-example"
service: "" => "servicenetworking.googleapis.com"
Error: Error applying plan:
1 error(s) occurred:
* google_service_networking_connection.private_vpc_connection: 1 error(s) occurred:
* google_service_networking_connection.private_vpc_connection: allocated IP range 'google-managed-services-example' not found in network