gpt4 book ai didi

terraform - 错误 : Unsupported block, type Blocks of type "moved"are not expected here

转载 作者:行者123 更新时间:2023-12-01 23:08:09 25 4
gpt4 key购买 nike

我正在尝试使用 terraform moved 方 block ,但在使用时出现以下错误。

main.tf 文件看起来像这样:-

module "docdb" {
`source = "./modules/docdb"`
docdb_subnet_group_name = "${var.project_name}-${var.environment}-group"
docdb_subnet_ids = module.vpc.private_subnets
docdb_cluster_identifier = "${var.project_name}-${var.environment}-docdb"
docdb_username = random_password.uname_create[0].result
docdb_password = random_password.password_create[0].result
skip_final_snapshot = var.skip_final_snapshot
docdb_vpc_security_group_ids = [module.sg_docdb.security_group_id]
docdb_cluster_instance_count = var.docdb_cluster_instance_count
docdb_cluster_instance_identifier = "docdb-cluster-${var.environment}-${count.index}"
instance_class = var.instance_class
docdb_parameter_group_name = "${var.project_name}-${var.environment}-docdb"

}

moved {
from = aws_docdb_cluster.docdb
to = module.docdb.aws_docdb_subnet_group.docdbgroup
}

moved {
from = aws_docdb_cluster_instance.docdb_cluster_instances[0]
to = module.docdb.aws_docdb_cluster.docdb
}

moved {
from = aws_docdb_cluster_parameter_group.cluster_para_group
to = module.docdb.aws_docdb_cluster_instance.docdb_cluster_instances
}

moved {
from = aws_docdb_subnet_group.docdbgroup
to = module.docdb.aws_docdb_cluster_parameter_group.cluster_para_group
}

运行 terraform init 时出现以下错误

错误:不支持的 block 类型在 docdb.tf 第 18 行:18:移动{此处不应包含“已移动”类型的 block 。在此处输入代码

最佳答案

出现错误是因为我在将 Terraform 升级到 v1.1.2 后使用的是旧版本 Terraform,此错误已解决。

关于terraform - 错误 : Unsupported block, type Blocks of type "moved"are not expected here,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70433914/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com