错误地授权启用Project media-244309服务

时间:2019-07-04 12:03:04

标签: google-cloud-platform terraform

当我执行命令terraform apply时,它将引发错误。我本地计算机上的所有配置和连接都可以正常工作。我使用以下命令进行了检查。

  1. gcloud身份验证登录和
  2. 已使用gcloud配置列表进行了验证。

我在下面附加了主要和可变的tf文件

resource "google_project" "my_project" {
  name = "${var.project_name}"
  project_id = "${var.project_id}"
}

provider "google" {
  project = "${var.project_id}"
  region  = "${var.region}"
  zone    = "${var.zone}"
}

resource "google_project_services" "project" {
  project = "${var.project_id}"
  services   = ["composer.googleapis.com", "iam.googleapis.com", "cloudresourcemanager.googleapis.com"]
}

resource "google_pubsub_topic" "topic" {
  name    = "${var.topic}"
  project = "${var.project_id}"
}

resource "google_pubsub_subscription" "push_subscriptions" {
  count                = "${length(var.push_subscriptions)}"
  name                 = "${lookup(var.push_subscriptions[count.index], "name")}"
  topic                = "${google_pubsub_topic.topic.name}"
  project              = "${var.project_id}"

  depends_on = ["google_pubsub_topic.topic"]
}

resource "google_pubsub_subscription" "pull_subscriptions" {
  count                = "${length(var.pull_subscriptions)}"
  name                 = "${lookup(var.pull_subscriptions[count.index], "name")}"
  topic                = "${google_pubsub_topic.topic.name}"
  project              = "${var.project_id}"

  depends_on = ["google_pubsub_topic.topic"]
}

Variables.tf文件

variable "project_id" {
  default     = "media-intelligence-244309"
}

variable "region" {
  default     = "asia-south1"
}

variable "zone" {
  default     = "asia-south1-b"
}

variable "project_name" {
  default     = "media-intelligence"
}

variable "topic" {
  default     = "topic-1"
}

variable "push_subscriptions" {
  type        = "list"
  default     = []
}

variable "pull_subscriptions" {
  type        = "list"
  default     = []
}

错误:应用计划时出错:

发生3个错误:

0 个答案:

没有答案