google_compute_zones 404

772 views
Skip to first unread message

Matt Conroy

unread,
Dec 7, 2017, 1:12:39 PM12/7/17
to Terraform
I'm probably missing something very simple so thanks in advance for any knowledge you can provide. 

When using google_compute_zones I receive a 404 like no zones are available. 

- Create a file named test.tf that contains...
data "google_compute_zones" "available" {}

- Run terraform init to install the google provider.

- Run terraform plan on the us-east1 region of GCP
$ terraform plan
provider.google.region
  Enter a value: us-east1

Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.

data.google_compute_zones.available: Refreshing state...

Error: Error refreshing state: 1 error(s) occurred:

* data.google_compute_zones.available: 1 error(s) occurred:

* data.google_compute_zones.available: data.google_compute_zones.available: googleapi: got HTTP response code 404 with body: Not Found


When using the gcloud sdk everything appears ok.
gcloud compute zones list
NAME                    REGION                STATUS  NEXT_MAINTENANCE  TURNDOWN_DATE
asia-east1-b            asia-east1            UP
asia-east1-a            asia-east1            UP
asia-east1-c            asia-east1            UP
asia-northeast1-b       asia-northeast1       UP
asia-northeast1-c       asia-northeast1       UP
asia-northeast1-a       asia-northeast1       UP
asia-south1-b           asia-south1           UP
asia-south1-a           asia-south1           UP
asia-south1-c           asia-south1           UP
asia-southeast1-a       asia-southeast1       UP
asia-southeast1-b       asia-southeast1       UP
australia-southeast1-b  australia-southeast1  UP
australia-southeast1-a  australia-southeast1  UP
australia-southeast1-c  australia-southeast1  UP
europe-west1-d          europe-west1          UP
europe-west1-c          europe-west1          UP
europe-west1-b          europe-west1          UP
europe-west2-a          europe-west2          UP
europe-west2-b          europe-west2          UP
europe-west2-c          europe-west2          UP
europe-west3-b          europe-west3          UP
europe-west3-c          europe-west3          UP
europe-west3-a          europe-west3          UP
southamerica-east1-c    southamerica-east1    UP
southamerica-east1-a    southamerica-east1    UP
southamerica-east1-b    southamerica-east1    UP
us-central1-b           us-central1           UP
us-central1-f           us-central1           UP
us-central1-c           us-central1           UP
us-central1-a           us-central1           UP
us-east1-c              us-east1              UP
us-east1-b              us-east1              UP
us-east1-d              us-east1              UP
us-east4-b              us-east4              UP
us-east4-c              us-east4              UP
us-east4-a              us-east4              UP
us-west1-b              us-west1              UP
us-west1-a              us-west1              UP
us-west1-c              us-west1              UP



Dmitry Nefedkin

unread,
Dec 7, 2017, 2:52:28 PM12/7/17
to terrafo...@googlegroups.com
Matt, you need to specifiy a GCP project id in the provider configuration, e.g. 

provider "google" {
project = "your_project_id_here"
#region = "us-central1"
}

data "google_compute_zones" "available" {}

output "zones" {
value = "${data.google_compute_zones.available.names}"
}

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/hashicorp/terraform/issues
IRC: #terraform-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Terraform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to terraform-tool+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/terraform-tool/dd472c20-7692-4a41-97e1-8c95908a9a37%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Matt Conroy

unread,
Dec 7, 2017, 3:23:54 PM12/7/17
to Terraform
Thanks for the quick reply Dmitry - your update did fix the issue I was having. 

(thumbsup)
To unsubscribe from this group and stop receiving emails from it, send an email to terraform-too...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages