Terraform GCP虚拟机实例创建失败,出现Terraform Apply-错误403

时间:2020-08-02 15:18:24

标签: terraform-provider-gcp

这是我第一次尝试通过terraform在GCP上创建VM。 main.tf包含

provider "google"{
  credentials = file("terrform-gcp-demo-285210-4c273aa368b3.json")
  project     = "terrform-gcp-demo-285210"
  region      = "europe-west3"
  zone        = "europe-west3-a"
}

resource "google_compute_instance" "vm-instance" {
  name         = "terraform-instance"
  machine_type = "f1-micro"

  tags = ["creator", "juergen"]

  boot_disk {
    initialize_params {
      image = "debian-cloud/debian-9"
    }
  }

  network_interface {
    # A default network is created for all GCP projects
    network = "default"
  }
}

在terrform-gcp-demo-285210-4c273aa368b3后面,我确实创建了一个具有以下角色的服务帐户: 计算管理员 计算实例管理员(v1) 服务帐户管理员 安全中心管理员

我刚开始学到的东西

地形应用

google_compute_instance.vm-instance: Creating...

Error: Error loading zone 'europe-west3-a': googleapi: Error 403: Required 'compute.zones.get' permission for 'projects/terrform-gcp-demo-285210/zones/europe-west3-a', forbidden

  on main.tf line 8, in resource "google_compute_instance" "vm-instance":
   8: resource "google_compute_instance" "vm-instance" {

0 个答案:

没有答案