terraform-google-modules/terraform-google-cloud-nat

var.nat_ip_allocate_option has to be set to false to be able to use MANUAL_ONLY

Closed this issue · 1 comments

TL;DR

var.nat_ip_allocate_option needing to be a bool doesnt make sense. It should be an enum of MANUAL_ONLY or AUTO_ONLY. if you set var.nat_ip_allocate_option to true the ternary operator takes the value of var.nat_ip_allocate_option which is true making it an invalid value for the compute_router_nat resource

Expected behavior

setting nat_ip_allocate_option to "MANUAL_ONLY" to work

Observed behavior

Errored invalid value as needed to be bool

Terraform Configuration

module "cloud_nat" {
  source     = "terraform-google-modules/cloud-nat/google"
  version    = "~> 2.2.1"

  name       = "${var.prefix}-nat-gateway"
  project_id = var.project_id

  region     = var.region
  router     = google_compute_router.router.name
  
  nat_ip_allocate_option = "MANUAL_ONLY"
  nat_ips = [ google_compute_address.nat_gw.address ]
  
  source_subnetwork_ip_ranges_to_nat = "LIST_OF_SUBNETWORKS"

  subnetworks = [ for subnet in local.private_subnets: {
    name = subnet.self_link
    source_ip_ranges_to_nat = [ subnet.ip_cidr_range ]
    secondary_ip_range_names = []
  }]

}

Terraform Version

Terraform v1.3.0

Additional information

No response

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days