-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Open
Labels
enhancementNew feature or requestNew feature or request
Description
TL;DR
Implement support for removing secondary_ranges by supplying the one-line argument send_secondary_ip_range_if_empty = true
to the underlying google_compute_subnetwork resource in the subnets submodule.
Terraform Resources
https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/compute_subnetwork
Detailed design
It appears this could be supported by simply adding the send_secondary_ip_range_if_empty = true argument to the underlying resource that is created in the subnets submodule of this module, like so:
resource "google_compute_subnetwork" "subnetwork" {
for_each = local.subnets
name = each.value.subnet_name
ip_cidr_range = each.value.subnet_ip
region = each.value.subnet_region
private_ip_google_access = lookup(each.value, "subnet_private_access", "false")
private_ipv6_google_access = lookup(each.value, "subnet_private_ipv6_access", null)
send_secondary_ip_range_if_empty = true
dynamic "log_config" {
for_each = coalesce(lookup(each.value, "subnet_flow_logs", null), false) ? [{
aggregation_interval = each.value.subnet_flow_logs_interval
flow_sampling = each.value.subnet_flow_logs_sampling
metadata = each.value.subnet_flow_logs_metadata
filter_expr = each.value.subnet_flow_logs_filter
metadata_fields = each.value.subnet_flow_logs_metadata_fields
}] : []
content {
aggregation_interval = log_config.value.aggregation_interval
flow_sampling = log_config.value.flow_sampling
metadata = log_config.value.metadata
filter_expr = log_config.value.filter_expr
metadata_fields = log_config.value.metadata == "CUSTOM_METADATA" ? log_config.value.metadata_fields : null
}
}
network = var.network_name
project = var.project_id
description = lookup(each.value, "description", null)
dynamic "secondary_ip_range" {
for_each = contains(keys(var.secondary_ranges), each.value.subnet_name) == true ? var.secondary_ranges[each.value.subnet_name] : []
content {
range_name = secondary_ip_range.value.range_name
ip_cidr_range = secondary_ip_range.value.ip_cidr_range
}
}
purpose = lookup(each.value, "purpose", null)
role = lookup(each.value, "role", null)
stack_type = lookup(each.value, "stack_type", null)
ipv6_access_type = lookup(each.value, "ipv6_access_type", null)
}
Additional information
No response
yooknee
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request