-1

我创建了 2 个 rds 实例,在运行 tf plan 时,我收到一个关于不支持的块类型的 terraform 错误:

Error: Unsupported block type

  on rds.tf line 85, in module "rds":
  85: resource "random_string" "rds_password_dr" {

Blocks of type "resource" are not expected here.

Error: Unsupported block type

  on rds.tf line 95, in module "rds":
  95: module "rds_dr" {

Blocks of type "module" are not expected here.

这是我的 rds.tf 文件中的代码:

# PostgreSQL RDS App Instance
module "rds" {
  source = "git@github.com:************"

  name           = var.rds_name_app
  engine         = var.rds_engine_app
  engine_version = var.rds_engine_version_app
  family         = var.rds_family_app
  instance_class = var.rds_instance_class_app

  # WARNING: 'terraform taint random_string.rds_password' must be run prior to recreating the DB if it is destroyed
  password                   = random_string.rds_password.result
  port                       = var.rds_port_app
  "
  "

# PostgreSQL RDS DR Password
resource "random_string" "rds_password_dr" {
  length           = 16
  override_special = "!&*-_=+[]{}<>:?"

  keepers = {
    rds_id = "${var.rds_name_dr}-${var.environment}-${var.rds_engine_dr}"
  }
}

# PostgreSQL RDS DR Instance
module "rds_dr" {
  source = "git@github.com:notarize/terraform-aws-rds.git?ref=v0.0.1"

  name           = var.rds_name_dr
  engine         = var.rds_engine_dr
  engine_version = var.rds_engine_version_dr
  family         = var.rds_family_dr
  instance_class = var.rds_instance_class_dr

  # WARNING: 'terraform taint random_string.rds_password' must be run prior to recreating the DB if it is destroyed
  password                   = random_string.rds_password.result
  port                       = var.rds_port_dr
  "
  "

我不知道为什么我会得到这个?有人请帮助我。

4

1 回答 1

3

您还没有关闭module块(module "rds"module "rds_dr")。module在两个块的末尾还有几个奇怪的双引号。

删除双引号并关闭块(用})。

于 2020-11-06T01:24:34.530 回答