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

filter terraform output routerIP for v4 addresses only #936

Closed
wants to merge 2 commits into from
Closed
Changes from all 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
10 changes: 8 additions & 2 deletions pkg/internal/infrastructure/templates/main.tpl.tf
Original file line number Diff line number Diff line change
Expand Up @@ -227,10 +227,16 @@ openstack_networking_network_v2.cluster.name
data.openstack_networking_network_v2.cluster.name
{{ end -}}
{{- end -}}

// Openstack API could return an IPv6 external IP even for v4-only clusters see
// https://github.com/gardener/gardener-extension-provider-openstack/issues/897
// We filter for IPs that match the v4 pattern (4 numbers seperated by dots)
// and only return one just in case there are mulitple as the rest of the
// codebase is currently expecting a single v4 IP
{{- define "router-ip" -}}
{{ if .create.router -}}
openstack_networking_router_v2.router.external_fixed_ip[0].ip_address
one([for external_fixed_ip in openstack_networking_router_v2.router.external_fixed_ip : external_fixed_ip.ip_address if can(regex("^(?:[0-9]{1,3}\\.){3}[0-9]{1,3}$", external_fixed_ip.ip_address))])
{{ else -}}
data.openstack_networking_router_v2.router.external_fixed_ip[0].ip_address
one([for external_fixed_ip in data.openstack_networking_router_v2.router.external_fixed_ip : external_fixed_ip.ip_address if can(regex("^(?:[0-9]{1,3}\\.){3}[0-9]{1,3}$", external_fixed_ip.ip_address))])
{{ end -}}
{{- end -}}
Loading