googleapi: Error 400: Precondition check failed., failedPrecondition while creating Cloud Composer Environment 通过 Terraform

googleapi: Error 400: Precondition check failed., failedPrecondition while creating Cloud Composer Environment through Terraform

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

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

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

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

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

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

Error message from terminal

composer/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
   }
  }
 }

composer/variables.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"
  }

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

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

请点击链接了解更多GCP and Terraform