错误:属性 PP_5 的值不正确:需要字符串列表



创建安全组时,我不断收到以下错误

属性"cidr_blocks"的值不合适:字符串列表 必填。

以下是main.tf的摘录

resource "aws_security_group" "sg_sagum" {
name        = var.sg_sagum1
vpc_id      = data.aws_vpc.vpcname.id
description = var.sg_sagum1
tags = {
Name = var.sg_sagum1
}    
dynamic "ingress" {
for_each = [for s in var.sg_sagum_ports : {
from_port = s.from_port
to_port   = s.to_port
desc = s.desc
cidrs = s.cidr
}]
content {
from_port   = ingress.value.from_port
to_port     = ingress.value.to_port
cidr_blocks = ingress.value.cidrs
protocol    = "tcp"
description = ingress.value.desc
}
}
}

variables.tf

variable "sg_sagum_ports" {    
description = "Ports to be opened on SAGUM SG"    
type        = list(map(string))    
default     = []  
}

terraform.tfvars

sg_sagum_ports = [
{ from_port = "9000",
to_port   = "9000",
cidr      = "10.22.9.11/32"
desc      = "SAGBPMS"
}
]

属性"cidr_blocks"的值不合适:字符串列表 必填。

terraform.tfvars中,您需要将cidr

cidr      = "10.22.9.11/32"

cidr      = ["10.22.9.11/32"]

相关内容

  • 没有找到相关文章

最新更新