title: ip_cidr_range From tf.vars "is not a valid IP CIDR range: invalid CIDR address"
body: <p>I've created a Terraform module for deploying VPCs in Google Cloud, part of which is:</p>
  <pre><code>  resource &quot;google_compute_subnetwork&quot; &quot;network-with-private-secondary-ip-ranges&quot; {
    name          = var.vpc_subnet_name
    ip_cidr_range = var.ip_cidr_range 
    region        = var.vpc_region
    network       = google_compute_network.vpc_network.id
    secondary_ip_range {
      range_name    = var.services_secondary_range_name
      ip_cidr_range = var.services_secondary_cidr_range
    }
    secondary_ip_range {
      range_name    = var.pods_secondary_range_name
      ip_cidr_range = var.pods_secondary_cidr_range
    }
  </code></pre>
  <p>The <em>main.tf</em> file that <em>tf plan</em> accesses is updated by a Python script to provide unique CIDR ranges to ensure our deployed networks don't overlap. This sets the following:</p>
  <pre><code>ip_cidr_range = &quot;10.51.0.0/20&quot;
  pods_secondary_cidr_range = &quot;10.52.0.0/20&quot;
  services_secondary_cidr_range = &quot;10.53.0.0/20&quot;
  </code></pre>
  <p>However, <em>tf plan</em> complains:</p>
  <p>*&quot;ip_cidr_range&quot; is not a valid IP CIDR range: invalid CIDR address:</p>
  <p><em>with module.ic-vpc.google_compute_subnetwork.network-with-private-secondary-ip-ranges,<br />
  on .terraform/modules/ic-vpc/main.tf line 11, in resource &quot;google_compute_subnetwork&quot; &quot;network-with-private-secondary-ip-ranges&quot;:
  11:   ip_cidr_range = var.ip_cidr_range</em></p>
  <p><em>&quot;secondary_ip_range.0.ip_cidr_range&quot; is not a valid IP CIDR range: invalid CIDR address:</em></p>
  <p><em>with module.ic-vpc.google_compute_subnetwork.network-with-private-secondary-ip-ranges,
  on .terraform/modules/ic-vpc/main.tf line 16, in resource &quot;google_compute_subnetwork&quot; &quot;network-with-private-secondary-ip-ranges&quot;:
  16:     ip_cidr_range = var.services_secondary_cidr_range</em></p>
  <p><em>&quot;secondary_ip_range.1.ip_cidr_range&quot; is not a valid IP CIDR range: invalid CIDR address:</em></p>
  <p><em>with module.ic-vpc.google_compute_subnetwork.network-with-private-secondary-ip-ranges,
  on .terraform/modules/ic-vpc/main.tf line 20, in resource &quot;google_compute_subnetwork&quot; &quot;network-with-private-secondary-ip-ranges&quot;:
  20:     ip_cidr_range = var.pods_secondary_cidr_range</em></p>
  <p>The addresses look fine to me, unless I'm missing something obvious.
  What else could be causing this error?</p>
  <p>Any help with this would be greatly appreciated.</p>
  <p><strong>Edit:</strong></p>
  <p>This works without issue via Cloud Shell, which is what I need to replicate:</p>
  <pre><code>resource &quot;google_compute_subnetwork&quot; &quot;network-with-private-secondary-ip-ranges&quot; {
    name          = var.vpc_subnet_name
    ip_cidr_range = &quot;10.51.0.0/20&quot;
    region        = &quot;europe-west2&quot;
    network       = google_compute_network.custom-test.id
    secondary_ip_range {
      range_name    = &quot;services&quot;
      ip_cidr_range = &quot;10.52.0.0/20&quot;
    }
     secondary_ip_range {
      range_name    = &quot;pods&quot;
      ip_cidr_range = &quot;10.53.0.0/20&quot;
    }
  }
  
  resource &quot;google_compute_network&quot; &quot;custom-test&quot; {
    name                    = &quot;projectname-subnet-eu&quot;
    auto_create_subnetworks = false
  }
  </code></pre>