我无法将安全组“sg0”添加到另一个安全组“sg1”的入站规则作为 Terraform 的源。(我用Terraform v0.15.4
)
这是我试过的代码:
resource "aws_security_group" "sg0" {
..........
}
resource "aws_security_group" "sg1" {
..........
ingress {
from_port = 5432
to_port = 5432
security_groups = [aws_security_group.sg0]
protocol = "tcp"
}
..........
}
但我收到以下错误:
Error: Incorrect attribute value type
│
│ on main.tf line 235, in resource "aws_security_group" "sg1":
│ 235: security_groups = [aws_security_group.sg0]
│ ├────────────────
│ │ aws_security_group.sg0 is object with 13 attributes
│
│ Inappropriate value for attribute "security_groups": element 0: string required.
我想获得与以下我在没有 Terraform 的情况下手动完成的结果相同的结果。我怎样才能做到这一点?