Skip to content

Commit aab974a

Browse files
authored
feat: added bgp_best_path_selection_mode bgp_always_compare_med bgp_inter_region_cost in VPC module (#610)
1 parent 7011e6e commit aab974a

File tree

6 files changed

+48
-0
lines changed

6 files changed

+48
-0
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,9 @@ Then perform the following commands on the root folder:
111111
| Name | Description | Type | Default | Required |
112112
|------|-------------|------|---------|:--------:|
113113
| auto\_create\_subnetworks | When set to true, the network is created in 'auto subnet mode' and it will create a subnet for each region automatically across the 10.128.0.0/9 address range. When set to false, the network is created in 'custom subnet mode' so the user can explicitly connect subnetwork resources. | `bool` | `false` | no |
114+
| bgp\_always\_compare\_med | If set to true, the Cloud Router will use MED values from the peer even if the AS paths differ. Default is false. | `bool` | `false` | no |
115+
| bgp\_best\_path\_selection\_mode | Specifies the BGP best path selection mode. Valid values are `STANDARD` or `LEGACY`. Default is `STANDARD`. | `string` | `"STANDARD"` | no |
116+
| bgp\_inter\_region\_cost | Specifies the BGP inter-region cost mode. Valid values are `DEFAULT` or `ADD_COST_TO_MED`. Default is `DEFAULT`. | `string` | `"DEFAULT"` | no |
114117
| delete\_default\_internet\_gateway\_routes | If set, ensure that all routes within the network specified whose names begin with 'default-route' and with a next hop of 'default-internet-gateway' are deleted | `bool` | `false` | no |
115118
| description | An optional description of this resource. The resource must be recreated to modify this field. | `string` | `""` | no |
116119
| egress\_rules | List of egress rules. This will be ignored if variable 'rules' is non-empty | <pre>list(object({<br> name = string<br> description = optional(string, null)<br> disabled = optional(bool, null)<br> priority = optional(number, null)<br> destination_ranges = optional(list(string), [])<br> source_ranges = optional(list(string), [])<br> source_tags = optional(list(string))<br> source_service_accounts = optional(list(string))<br> target_tags = optional(list(string))<br> target_service_accounts = optional(list(string))<br><br> allow = optional(list(object({<br> protocol = string<br> ports = optional(list(string))<br> })), [])<br> deny = optional(list(object({<br> protocol = string<br> ports = optional(list(string))<br> })), [])<br> log_config = optional(object({<br> metadata = string<br> }))<br> }))</pre> | `[]` | no |

main.tf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ module "vpc" {
3131
internal_ipv6_range = var.internal_ipv6_range
3232
network_firewall_policy_enforcement_order = var.network_firewall_policy_enforcement_order
3333
network_profile = var.network_profile
34+
bgp_always_compare_med = var.bgp_always_compare_med
35+
bgp_best_path_selection_mode = var.bgp_best_path_selection_mode
36+
bgp_inter_region_cost = var.bgp_inter_region_cost
3437
}
3538

3639
/******************************************

modules/vpc/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ module "vpc" {
2929
| Name | Description | Type | Default | Required |
3030
|------|-------------|------|---------|:--------:|
3131
| auto\_create\_subnetworks | When set to true, the network is created in 'auto subnet mode' and it will create a subnet for each region automatically across the 10.128.0.0/9 address range. When set to false, the network is created in 'custom subnet mode' so the user can explicitly connect subnetwork resources. | `bool` | `false` | no |
32+
| bgp\_always\_compare\_med | If set to true, the Cloud Router will use MED values from the peer even if the AS paths differ. Default is false. | `bool` | `false` | no |
33+
| bgp\_best\_path\_selection\_mode | Specifies the BGP best path selection mode. Valid values are `STANDARD` or `LEGACY`. Default is `STANDARD`. | `string` | `"STANDARD"` | no |
34+
| bgp\_inter\_region\_cost | Specifies the BGP inter-region cost mode. Valid values are `DEFAULT` or `ADD_COST_TO_MED`. Default is `DEFAULT`. | `string` | `"DEFAULT"` | no |
3235
| delete\_default\_internet\_gateway\_routes | If set, ensure that all routes within the network specified whose names begin with 'default-route' and with a next hop of 'default-internet-gateway' are deleted | `bool` | `false` | no |
3336
| description | An optional description of this resource. The resource must be recreated to modify this field. | `string` | `""` | no |
3437
| enable\_ipv6\_ula | Enabled IPv6 ULA, this is a permenant change and cannot be undone! (default 'false') | `bool` | `false` | no |

modules/vpc/main.tf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ resource "google_compute_network" "network" {
3030
internal_ipv6_range = var.internal_ipv6_range
3131
network_firewall_policy_enforcement_order = var.network_firewall_policy_enforcement_order
3232
network_profile = var.network_profile
33+
bgp_always_compare_med = var.bgp_always_compare_med
34+
bgp_best_path_selection_mode = var.bgp_best_path_selection_mode
35+
bgp_inter_region_cost = var.bgp_inter_region_cost
3336
}
3437

3538
/******************************************

modules/vpc/variables.tf

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,3 +89,21 @@ variable "network_profile" {
8989
* projects/{projectId}/global/networkProfiles/{network_profile_name}
9090
EOT
9191
}
92+
93+
variable "bgp_always_compare_med" {
94+
type = bool
95+
description = "If set to true, the Cloud Router will use MED values from the peer even if the AS paths differ. Default is false."
96+
default = false
97+
}
98+
99+
variable "bgp_best_path_selection_mode" {
100+
type = string
101+
description = "Specifies the BGP best path selection mode. Valid values are `STANDARD` or `LEGACY`. Default is `STANDARD`."
102+
default = "STANDARD"
103+
}
104+
105+
variable "bgp_inter_region_cost" {
106+
type = string
107+
description = "Specifies the BGP inter-region cost mode. Valid values are `DEFAULT` or `ADD_COST_TO_MED`. Default is `DEFAULT`."
108+
default = "DEFAULT"
109+
}

variables.tf

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,3 +211,21 @@ variable "network_profile" {
211211
* projects/{projectId}/global/networkProfiles/{network_profile_name}
212212
EOT
213213
}
214+
215+
variable "bgp_always_compare_med" {
216+
type = bool
217+
description = "If set to true, the Cloud Router will use MED values from the peer even if the AS paths differ. Default is false."
218+
default = false
219+
}
220+
221+
variable "bgp_best_path_selection_mode" {
222+
type = string
223+
description = "Specifies the BGP best path selection mode. Valid values are `STANDARD` or `LEGACY`. Default is `STANDARD`."
224+
default = "STANDARD"
225+
}
226+
227+
variable "bgp_inter_region_cost" {
228+
type = string
229+
description = "Specifies the BGP inter-region cost mode. Valid values are `DEFAULT` or `ADD_COST_TO_MED`. Default is `DEFAULT`."
230+
default = "DEFAULT"
231+
}

0 commit comments

Comments
 (0)