我正在浏览文档,他们在资源中有aws_vpc.main.cidr_block。我定义了不在文档中的资源,但是我犯了以下错误。
Terraform - expected cidr_block to contain a valid Value, got: 0.0.0.0 with err: invalid CIDR address: 0.0.0.0
为什么是无效的?我希望允许进入所有的源IP能够达到443。
文件vpc.tf
resource "aws_vpc" "main" {
    id = "vpc-0da86af9876e72d66c"
    cidr_block = "0.0.0.0/0"
}文件test.tf
resource "aws_security_group" "allow_tls" {
  name        = "allow_tls"
  description = "Allow TLS inbound traffic"
  vpc_id      = aws_vpc.main.id
  ingress {
    description = "TLS from VPC"
    from_port   = 443
    to_port     = 443
    protocol    = "tcp"
    cidr_blocks = [aws_vpc.main.cidr_block]
  }
  egress {
    from_port   = 0
    to_port     = 0
    protocol    = "-1"
    cidr_blocks = ["0.0.0.0/0"]
  }
  tags = {
    Name = "allow_tls"
  }
}发布于 2020-11-11 18:43:16
https://stackoverflow.com/questions/64792119
复制相似问题