title: Getting Terraform error: "Error: expected cidr_block to contain a valid Value, got: with err: invalid CIDR address:"
body: <p>Trying to make a simple vpc/security group module set. VPC resource is here:</p>
  <pre><code>resource &quot;aws_vpc&quot; &quot;main&quot; {
    cidr_block = var.cidr
  }
  </code></pre>
  <p>Security Group resources are here:</p>
  <pre><code>resource &quot;aws_security_group&quot; &quot;default&quot; {
    name        = var.sg-name
    vpc_id      = aws_vpc.main.id
    description = var.sg-description
  }
  
  resource &quot;aws_security_group_rule&quot; &quot;ingress&quot; {
    count = length(var.allowed_ip)
  
    type = &quot;ingress&quot;
    from_port = element(var.allowed_ports, count.index)
    to_port = element(var.allowed_ports, count.index)
    protocol = var.protocol
    cidr_blocks = var.allowed_ip
    security_group_id = aws_security_group.default.id
  }
  
  resource &quot;aws_security_group_rule&quot; &quot;egress&quot; {
    type              = &quot;egress&quot;
    from_port         = 0
    to_port           = 65535
    protocol          = &quot;-1&quot;
    cidr_blocks       = [&quot;0.0.0.0/0&quot;]
    security_group_id = aws_security_group.default.id
  }
  </code></pre>
  <p>Modules are here:</p>
  <pre><code>module &quot;vpc&quot; {
    source = &quot;../&quot;
  
    cidr = &quot;10.0.0.0/16&quot;
  }
  
  module &quot;security_group&quot; {
    source = &quot;../&quot;
  
    sg-name = &quot;Test&quot;
    sg-description = &quot;Test Description&quot;
  
    protocol = &quot;tcp&quot;
    allowed_ip = [&quot;10.10.0.0/20&quot;, &quot;10.20.0.0/20&quot;]
    allowed_ports = [22, 443]
  }
  </code></pre>
  <p>When I run Terraform Plan, I get this error:</p>
  <blockquote>
  <p>Error: expected cidr_block to contain a valid Value, got:  with err:
  invalid CIDR address:</p>
  <p>on ..\vpc.tf line 2, in resource &quot;aws_vpc&quot; &quot;main&quot;:    2:<br />
  cidr_block = var.cidr</p>
  </blockquote>
  <p>I've done a lot of researching but can't quite nail the issue. Does anyone have any ideas?</p>