[英]Terraform aws_iam_policy_document: Inappropriate value for attribute "resources": element 0: string required
[英]Terraform ERROR: Inappropriate value for attribute "requires_compatibilities": set of string required
terraform 驗證后,我收到以下錯誤消息:
################################################## #############
錯誤:不正確的屬性值類型 on.terraform/modules/backend_deployment/task_definition.tf 第 4 行,在資源“aws_ecs_task_definition”中:
requires_compatibilities = "FARGATE"
屬性“requires_compatibilities”的值不合適:需要一組字符串。
################################################## #############
這是我的任務定義:
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"]
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.