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 = []
}]
}
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
Terraform Version
Additional information
No response