Terraform and GCP composer setup



我正在尝试使用terraform部署GCP composer,但遇到了问题->

错误:编写器上不支持的块类型。第43行,在资源google_composer_environment"test": 34: encryption_config {类型为"encryption_config">

这是作曲家。tf文件:

resource "google_composer_environment" "test" {
name   = "dwh_composer"
region = local.default_region
config {
node_count = 3
node_config {
zone         = local.default_zone
machine_type = "e2-medium"
network    = google_compute_network.test.id
subnetwork = google_compute_subnetwork.test.id
service_account = google_service_account.test.name
}
software_config {
image_version = "composer-1.17.0-preview.9-airflow-2.1.1"
python_version = "3"
airflow_config_overrides = {
core-load_example = "True"
}
pypi_packages = {
numpy = ""
scipy = "==1.1.0"
}
env_variables = {
FOO = "bar"
R1 = "test5"
evvv_qqq_d = "test1"
M1 = "test3"
AIRFLOW-3 = "test2"
}
}
private_environment_config {
enable_private_endpoint = true
}
encryption_config {
kms_key_name = google_kms_crypto_key.dwh_composer_crypto_key.name
}
}
}
resource "google_kms_key_ring" "data_warehouse_kms_keyring" {
name     = "data-warehouse-kms-keyring"
location = "europe-west4"
}
resource "google_kms_crypto_key" "dwh_composer_crypto_key" {
name            = "dwh-composer-crypto-key"
key_ring        = google_kms_key_ring.data_warehouse_kms_keyring.self_link
}

这里是main。tf文件:

terraform {
required_version = "1.0.0"
backend "gcs" {
bucket = "terraform-data-warehouse"
prefix = "gcp/data-warehouse/composer"
}
required_providers {
google = {
source  = "hashicorp/google"
version = "~> 3.70.0"
}
google-beta = {
source  = "hashicorp/google-beta"
version = "~> 3.70.0"
}
}
}
# -- Providers
provider "google" {
project = local.project_id
}
provider "google-beta" {
project = local.project_id
}
# -- common public state
data "terraform_remote_state" "common" {
backend = "gcs"
config = {
bucket = "terraform-public"
prefix = "common"
}
}
# -- Local variables
locals {
default_zone = "europe-west4-a"
default_region = "europe-west1"
project_id = "my-project"
team_group = data.terraform_remote_state.common.outputs.teams.data_warehouse.group
default_multi_region = "EU"
}

你能帮我吗?

您遇到的问题是因为根据文档,encryption_configgoogle_composer_environment地形资源中的测试版功能。只需在资源中指定测试版提供商:

resource "google_composer_environment" "test" {
name   = "dwh_composer"
region = local.default_region
provider = google-beta
...
}

不要忘记terraform init之前,这样测试版谷歌提供程序将被下载和使用。

相关内容

  • 没有找到相关文章

最新更新