我正在尝试使用 terraform module 创建一个安全组terraform-aws-modules/security-group/aws。这需要从数据源id获取的VPC。aws_vpcsVPC ID 需要一个字符串值,但aws_vpcs数据源返回一个包含单个值的列表。
请找到
data "aws_vpcs" "this" {
tags = {
"Name" = "example"
}
}
module "route53_sg" {
source = "terraform-aws-modules/security-group/aws"
name = "R53_health_checkers"
description = "Security group for Route53 health checkers"
vpc_id = element([data.aws_vpcs.this.ids], 0)
ingress_cidr_blocks = [
...
...
...
]
ingress_rules = ["https-443-tcp"]
}
Run Code Online (Sandbox Code Playgroud)
$ terraform apply
data.aws_lb.ext_alb: Refreshing state...
data.aws_vpcs.this: Refreshing state...
Error: Invalid value for module argument
on main.tf line 75, in module …Run Code Online (Sandbox Code Playgroud) terraform ×1