gpt4 book ai didi

地形 | 0.12.2 |升级问题

转载 作者:行者123 更新时间:2023-12-04 11:47:34 27 4
gpt4 key购买 nike

执行 terraform init 时出现以下错误升级到 0.12.2 后的命令版本。早期的相同代码在 terraform 中运行良好,没有问题 0.11.10版本。

alb.tf

tags {
Name = "${var.name}"
Environment = "${lookup(var.environment, terraform.workspace)}"
}

lc.tf:-
  vars {
EFS_ENDPOINT = "${aws_efs_file_system.jenkins.dns_name}"

}

remote_state.tf 第 4 行
config {
bucket = "s3-terraform-state"
key = "env:/${lookup(var.environment, terraform.workspace)}/cicd-security-groups/terraform.tfstate"
region = "${var.region}"
}

remote_state.tf 第 14 行
config {
bucket = "ttgsl-s3-terraform-state"
key = "env:/${lookup(var.environment, terraform.workspace)}/cicd-kms-ebs/terraform.tfstate"
region = "${var.region}"
}

地形验证-无颜色
Error: Unsupported block type

on alb.tf line 40, in resource "aws_lb_target_group" "jenkins_master":
40: tags {

Blocks of type "tags" are not expected here. Did you mean to define argument
"tags"? If so, use the equals sign to assign it a value.


Error: Unsupported block type

on lc.tf line 4, in data "template_file" "jenkins_user_data_template":
4: vars {

Blocks of type "vars" are not expected here. Did you mean to define argument
"vars"? If so, use the equals sign to assign it a value.


Error: Unsupported block type

on remote_state.tf line 4, in data "terraform_remote_state" "remote-cicd-security-groups_state":
4: config {

Blocks of type "config" are not expected here. Did you mean to define argument
"config"? If so, use the equals sign to assign it a value.


Error: Unsupported block type

on remote_state.tf line 14, in data "terraform_remote_state" "remote-cicd-kms-ebs_state":
14: config {

Blocks of type "config" are not expected here. Did you mean to define argument
"config"? If so, use the equals sign to assign it a value.

make: *** [validate] Error 1

最佳答案

tags = {
Name = "${var.name}"
Environment = "${lookup(var.environment, terraform.workspace)}"
}

vars = {
EFS_ENDPOINT = "${aws_efs_file_system.jenkins.dns_name}"
}

我们需要添加 =在标签之后,变量以及配置以避免错误。

关于地形 | 0.12.2 |升级问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56704965/

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