Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add ip_address to bgp_peer_options in vpn_ha #100

Merged
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion modules/vpn_ha/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ module "vpn_ha" {
| router\_advertise\_config | Router custom advertisement configuration, ip\_ranges is a map of address ranges and descriptions. | <pre>object({<br> groups = list(string)<br> ip_ranges = map(string)<br> mode = string<br> })</pre> | `null` | no |
| router\_asn | Router ASN used for auto-created router. | `number` | `64514` | no |
| router\_name | Name of router, leave blank to create one. | `string` | `""` | no |
| tunnels | VPN tunnel configurations, bgp\_peer\_options is usually null. | <pre>map(object({<br> bgp_peer = object({<br> address = string<br> asn = number<br> })<br> bgp_peer_options = object({<br> advertise_groups = list(string)<br> advertise_ip_ranges = map(string)<br> advertise_mode = string<br> route_priority = number<br> })<br> bgp_session_range = string<br> ike_version = number<br> vpn_gateway_interface = number<br> peer_external_gateway_interface = number<br> shared_secret = string<br> }))</pre> | `{}` | no |
| tunnels | VPN tunnel configurations, bgp\_peer\_options is usually null. | <pre>map(object({<br> bgp_peer = object({<br> address = string<br> asn = number<br> })<br> bgp_peer_options = object({<br> ip_address = string<br> advertise_groups = list(string)<br> advertise_ip_ranges = map(string)<br> advertise_mode = string<br> route_priority = number<br> })<br> bgp_session_range = string<br> ike_version = number<br> vpn_gateway_interface = number<br> peer_external_gateway_interface = number<br> shared_secret = string<br> }))</pre> | `{}` | no |
| vpn\_gateway\_self\_link | self\_link of existing VPN gateway to be used for the vpn tunnel | `string` | `null` | no |

## Outputs
Expand Down
3 changes: 3 additions & 0 deletions modules/vpn_ha/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ resource "google_compute_router_peer" "bgp_peer" {
router = local.router
peer_ip_address = each.value.bgp_peer.address
peer_asn = each.value.bgp_peer.asn
ip_address = (
imrannayer marked this conversation as resolved.
Show resolved Hide resolved
each.value.bgp_peer_options == null ? null : each.value.bgp_peer_options.ip_address
)
advertised_route_priority = (
each.value.bgp_peer_options == null ? var.route_priority : (
each.value.bgp_peer_options.route_priority == null
Expand Down
1 change: 1 addition & 0 deletions modules/vpn_ha/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ spec:
asn = number
})
bgp_peer_options = object({
ip_address = string
advertise_groups = list(string)
advertise_ip_ranges = map(string)
advertise_mode = string
Expand Down
1 change: 1 addition & 0 deletions modules/vpn_ha/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ variable "tunnels" {
asn = number
})
bgp_peer_options = object({
ip_address = string
advertise_groups = list(string)
advertise_ip_ranges = map(string)
advertise_mode = string
Expand Down