googleapi:错误 400:先决条件检查失败。通过 Terraform 创建 Cloud Composer 环境时失败了先决条件

rag*_*ceg 3 google-cloud-platform terraform google-cloud-composer

我正在尝试通过 Terraform 创建 Cloud Composer 环境并收到此错误

googleapi:错误 400:先决条件检查失败。通过 Terraform 创建 Cloud Composer 环境时失败了先决条件

我尝试从中创建 Composer 的 VM 的服务帐户在 GCP 项目中具有所有者权限。

我已尝试使用 GCP 控制台中的相同作曲家配置,并且创建的环境没有任何问题。

我尝试禁用 Cloud Composer API 并再次启用它,但没有解决方案。

最终,第一次执行 terraform apply 时,它试图创建 Composer 环境,但最终出现版本错误,我更改了 Composer 的 Image 版本。现在我面临这个问题。有人可以帮忙吗?

来自终端的错误消息

作曲家/main.tf

    resource "google_composer_environment" "etl_env" {
    provider = google-beta
    name     = var.env_name
    region   = var.region
    config {
    node_count = 3

    node_config {
      zone         = var.zone
      machine_type = var.node_machine_type

      network    = var.network
      subnetwork = var.app_subnet_selflink

      ip_allocation_policy {
      use_ip_aliases = true
    }
   }

   software_config {
      image_version  = var.software_image_version
      python_version = 3
   }

   private_environment_config {
      enable_private_endpoint = false
   }

   database_config {
      machine_type = var.database_machine_type
   }

   web_server_config {
      machine_type = var.web_machine_type
   }
  }
 }
Run Code Online (Sandbox Code Playgroud)

作曲家/变量.tf

  variable "app_subnet_selflink" {
    type        = string
    description = "App Subnet Selflink"
  }

  variable "region" {
    type        = string
    description = "Region"
    default     = "us-east4"
  }

  variable "zone" {
    type        = string
    description = "Availability Zone"
    default     = "us-east4-c"
  }

  variable "network" {
    type        = string
    description = "Name of the network"
  }

  variable "env_name" {
    type        = string
    default     = "composer-etl"
    description = "The name of the composer environment"
  }

  variable "node_machine_type" {
    type        = string
    default     = "n1-standard-1"
    description = "The machine type of the worker nodes"
  }

  variable "software_image_version" {
    type        = string
    default     = "composer-1.15.2-airflow-1.10.14"
    description = "The image version used in the software configurations of composer"
  }

  variable "database_machine_type" {
    type        = string
    default     = "db-n1-standard-2"
    description = "The machine type of the database instance"
  }

  variable "web_machine_type" {
    type        = string
    default     = "composer-n1-webserver-2"
    description = "The machine type of the web server instance"
  }
Run Code Online (Sandbox Code Playgroud)

网络和子网是从另一个模块引用的,并且它们是正确的。

use*_*090 5

问题在于master_ipv4_cidr_block范围。如果留空,则使用默认值“172.16.0.0/28”。由于您已经手动创建了该范围,因此该范围已在使用中,因此请使用其他一些范围。

请点击链接了解更多GCPTerraform