Set instance zone in net vpc route to avoid recreation (#90)
This commit is contained in:
parent
7f49615c1d
commit
cf79c65d3b
|
@ -112,20 +112,21 @@ module "vpc-host" {
|
|||
| name | The name of the network being created | <code title="">string</code> | ✓ | |
|
||||
| project_id | The ID of the project where this VPC will be created | <code title="">string</code> | ✓ | |
|
||||
| *auto_create_subnetworks* | Set to true to create an auto mode subnet, defaults to custom mode. | <code title="">bool</code> | | <code title="">false</code> |
|
||||
| *delete_default_routes_on_create* | Set to true to delete the default routes at creation time. | <code title="">bool</code> | | <code title="">false</code> |
|
||||
| *description* | An optional description of this resource (triggers recreation on change). | <code title="">string</code> | | <code title="">Terraform-managed.</code> |
|
||||
| *iam_members* | List of IAM members keyed by subnet 'region/name' and role. | <code title="map(map(list(string)))">map(map(list(string)))</code> | | <code title="">null</code> |
|
||||
| *iam_roles* | List of IAM roles keyed by subnet 'region/name'. | <code title="map(list(string))">map(list(string))</code> | | <code title="">null</code> |
|
||||
| *iam_members* | List of IAM members keyed by subnet 'region/name' and role. | <code title="map(map(list(string)))">map(map(list(string)))</code> | | <code title="">{}</code> |
|
||||
| *iam_roles* | List of IAM roles keyed by subnet 'region/name'. | <code title="map(list(string))">map(list(string))</code> | | <code title="">{}</code> |
|
||||
| *log_config_defaults* | Default configuration for flow logs when enabled. | <code title="object({ aggregation_interval = string flow_sampling = number metadata = string })">object({...})</code> | | <code title="{ aggregation_interval = "INTERVAL_5_SEC" flow_sampling = 0.5 metadata = "INCLUDE_ALL_METADATA" }">...</code> |
|
||||
| *log_configs* | Map keyed by subnet 'region/name' of optional configurations for flow logs when enabled. | <code title="map(map(string))">map(map(string))</code> | | <code title="">null</code> |
|
||||
| *log_configs* | Map keyed by subnet 'region/name' of optional configurations for flow logs when enabled. | <code title="map(map(string))">map(map(string))</code> | | <code title="">{}</code> |
|
||||
| *peering_config* | VPC peering configuration. | <code title="object({ peer_vpc_self_link = string export_routes = bool import_routes = bool })">object({...})</code> | | <code title="">null</code> |
|
||||
| *routes* | Network routes, keyed by name. | <code title="map(object({ dest_range = string priority = number tags = list(string) next_hop_type = string # gateway, instance, ip, vpn_tunnel, ilb next_hop = string }))">map(object({...}))</code> | | <code title="">null</code> |
|
||||
| *routes* | Network routes, keyed by name. | <code title="map(object({ dest_range = string priority = number tags = list(string) next_hop_type = string # gateway, instance, ip, vpn_tunnel, ilb next_hop = string }))">map(object({...}))</code> | | <code title="">{}</code> |
|
||||
| *routing_mode* | The network routing mode (default 'GLOBAL') | <code title="">string</code> | | <code title="">GLOBAL</code> |
|
||||
| *shared_vpc_host* | Enable shared VPC for this project. | <code title="">bool</code> | | <code title="">false</code> |
|
||||
| *shared_vpc_service_projects* | Shared VPC service projects to register with this host | <code title="list(string)">list(string)</code> | | <code title="">[]</code> |
|
||||
| *subnet_descriptions* | Optional map of subnet descriptions, keyed by subnet 'region/name'. | <code title="map(string)">map(string)</code> | | <code title="">{}</code> |
|
||||
| *subnet_flow_logs* | Optional map of boolean to control flow logs (default is disabled), keyed by subnet 'region/name'. | <code title="map(bool)">map(bool)</code> | | <code title="">{}</code> |
|
||||
| *subnet_private_access* | Optional map of boolean to control private Google access (default is enabled), keyed by subnet 'region/name'. | <code title="map(bool)">map(bool)</code> | | <code title="">{}</code> |
|
||||
| *subnets* | The list of subnets being created | <code title="map(object({ ip_cidr_range = string region = string secondary_ip_range = map(string) }))">map(object({...}))</code> | | <code title="">null</code> |
|
||||
| *subnets* | The list of subnets being created | <code title="list(object({ name = string ip_cidr_range = string name = string region = string secondary_ip_range = map(string) }))">list(object({...}))</code> | | <code title="">[]</code> |
|
||||
|
||||
## Outputs
|
||||
|
||||
|
@ -136,10 +137,10 @@ module "vpc-host" {
|
|||
| network | Network resource. | |
|
||||
| project_id | Shared VPC host project id. | |
|
||||
| self_link | The URI of the VPC being created. | |
|
||||
| subnet_ips | Map of subnet address ranges keyed by 'region/name'. | |
|
||||
| subnet_regions | Map of subnet regions keyed by 'region/name'. | |
|
||||
| subnet_secondary_ranges | Map of subnet secondary ranges keyed by 'region/name'. | |
|
||||
| subnet_self_links | Map of subnet self links keyed by 'region/name'. | |
|
||||
| subnet_ips | Map of subnet address ranges keyed by name. | |
|
||||
| subnet_regions | Map of subnet regions keyed by name. | |
|
||||
| subnet_secondary_ranges | Map of subnet secondary ranges keyed by name. | |
|
||||
| subnet_self_links | Map of subnet self links keyed by name. | |
|
||||
| subnets | Subnet resources. | |
|
||||
<!-- END TFDOC -->
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ locals {
|
|||
}
|
||||
subnets = {
|
||||
for subnet in var.subnets :
|
||||
"${subnet.region}/${subnet.name}" => subnet
|
||||
"${subnet.region}/${subnet.name}" => subnet
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -184,6 +184,8 @@ resource "google_compute_route" "instance" {
|
|||
priority = each.value.priority
|
||||
tags = each.value.tags
|
||||
next_hop_instance = each.value.next_hop
|
||||
# not setting the instance zone will trigger a refresh
|
||||
next_hop_instance_zone = regex("zones/([^/]+)/", each.value.next_hop)[0]
|
||||
}
|
||||
|
||||
resource "google_compute_route" "ip" {
|
||||
|
|
|
@ -35,19 +35,19 @@ variable "description" {
|
|||
variable "iam_roles" {
|
||||
description = "List of IAM roles keyed by subnet 'region/name'."
|
||||
type = map(list(string))
|
||||
default = null
|
||||
default = {}
|
||||
}
|
||||
|
||||
variable "iam_members" {
|
||||
description = "List of IAM members keyed by subnet 'region/name' and role."
|
||||
type = map(map(list(string)))
|
||||
default = null
|
||||
default = {}
|
||||
}
|
||||
|
||||
variable "log_configs" {
|
||||
description = "Map keyed by subnet 'region/name' of optional configurations for flow logs when enabled."
|
||||
type = map(map(string))
|
||||
default = null
|
||||
default = {}
|
||||
}
|
||||
|
||||
variable "log_config_defaults" {
|
||||
|
@ -93,7 +93,7 @@ variable "routes" {
|
|||
next_hop_type = string # gateway, instance, ip, vpn_tunnel, ilb
|
||||
next_hop = string
|
||||
}))
|
||||
default = null
|
||||
default = {}
|
||||
}
|
||||
|
||||
variable "routing_mode" {
|
||||
|
|
Loading…
Reference in New Issue