Terraform ERROR: Inappropriate value for attribute "requires_compatibilities": set of string required
Terraform ERROR: Inappropriate value for attribute "requires_compatibilities": set of string required
我在 terraform 验证后收到以下错误消息:
############################################# ##################
错误:属性值类型不正确
在 .terraform/modules/backend_deployment/task_definition.tf 第 4 行,在资源“aws_ecs_task_definition”中:
requires_compatibilities = "FARGATE"
属性“requires_compatibilities”的值不合适:需要一组字符串。
############################################# ##################
这是我的 task_definition:
resource "aws_ecs_task_definition" "task_definition" {
family = join("-", [local.cluster_values.backend_name, local.cluster_values.environment, local.cluster_values.random_id])
network_mode = "awsvpc"
requires_compatibilities = "FARGATE"
cpu = 256
memory = 512
container_definitions = data.template_file.task_definition_template.rendered
task_role_arn = local.cluster_values.task_role
}
Terraform-Doku 是这样说的:
requires_compatibilities -(可选)任务所需的启动类型集。有效值为 EC2 和 FARGATE。
非常感谢您的帮助!
根据错误消息,提供者需要类型为 set(string)
的参数值,而您已提供 string
。您可以根据错误消息提供与提供者期望的类型一致的值来解决此问题:
requires_compatibilities = ["FARGATE"]
不适合我
// Apply the firewall rule to allow external IPs to access this instance
tags = element(var.instance_tag, count.index)
}
variable "instance_tag" {
type = list
default = ["http-one", "http-two"]
}
添加后有效[]
// Apply the firewall rule to allow external IPs to access this instance
tags = [element(var.instance_tag, count.index)]
}
variable "instance_tag" {
type = list
default = ["http-one", "http-two"]
}
还有另一种方法可以使它与 type = list(string)
一起工作
// Apply the firewall rule to allow external IPs to access this instance
tags = element(var.instance_tag, count.index)
}
variable "instance_tag" {
type = list(string)
default = ["http-one", "http-two"]
}
我在 terraform 验证后收到以下错误消息:
############################################# ##################
错误:属性值类型不正确 在 .terraform/modules/backend_deployment/task_definition.tf 第 4 行,在资源“aws_ecs_task_definition”中:
requires_compatibilities = "FARGATE"
属性“requires_compatibilities”的值不合适:需要一组字符串。
############################################# ##################
这是我的 task_definition:
resource "aws_ecs_task_definition" "task_definition" {
family = join("-", [local.cluster_values.backend_name, local.cluster_values.environment, local.cluster_values.random_id])
network_mode = "awsvpc"
requires_compatibilities = "FARGATE"
cpu = 256
memory = 512
container_definitions = data.template_file.task_definition_template.rendered
task_role_arn = local.cluster_values.task_role
}
Terraform-Doku 是这样说的:
requires_compatibilities -(可选)任务所需的启动类型集。有效值为 EC2 和 FARGATE。
非常感谢您的帮助!
根据错误消息,提供者需要类型为 set(string)
的参数值,而您已提供 string
。您可以根据错误消息提供与提供者期望的类型一致的值来解决此问题:
requires_compatibilities = ["FARGATE"]
不适合我
// Apply the firewall rule to allow external IPs to access this instance
tags = element(var.instance_tag, count.index)
}
variable "instance_tag" {
type = list
default = ["http-one", "http-two"]
}
添加后有效[]
// Apply the firewall rule to allow external IPs to access this instance
tags = [element(var.instance_tag, count.index)]
}
variable "instance_tag" {
type = list
default = ["http-one", "http-two"]
}
还有另一种方法可以使它与 type = list(string)
// Apply the firewall rule to allow external IPs to access this instance
tags = element(var.instance_tag, count.index)
}
variable "instance_tag" {
type = list(string)
default = ["http-one", "http-two"]
}