Skip to content

Commit

Permalink
interpolations
Browse files Browse the repository at this point in the history
  • Loading branch information
grandich committed Apr 9, 2021
1 parent 46ac96e commit 04089c9
Show file tree
Hide file tree
Showing 4 changed files with 367 additions and 367 deletions.
42 changes: 21 additions & 21 deletions contrib/terraform/openstack/modules/compute/despegar.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
# https://github.com/projectcalico/calico/issues/1604
# https://github.com/projectcalico/calico/issues/3365#issuecomment-660202663
resource "openstack_networking_secgroup_rule_v2" "master_tcp" {
security_group_id = "${openstack_networking_secgroup_v2.k8s_master.id}"
count = "${length(var.worker_allowed_ports)}"
security_group_id = openstack_networking_secgroup_v2.k8s_master.id
count = length(var.worker_allowed_ports)
direction = "ingress"
ethertype = "IPv4"
protocol = "${lookup(var.worker_allowed_ports[count.index], "protocol", "tcp")}"
port_range_min = "${lookup(var.worker_allowed_ports[count.index], "port_range_min")}"
port_range_max = "${lookup(var.worker_allowed_ports[count.index], "port_range_max")}"
remote_ip_prefix = "${lookup(var.worker_allowed_ports[count.index], "remote_ip_prefix", "0.0.0.0/0")}"
protocol = lookup(var.worker_allowed_ports[count.index], "protocol", "tcp")
port_range_min = lookup(var.worker_allowed_ports[count.index], "port_range_min")
port_range_max = lookup(var.worker_allowed_ports[count.index], "port_range_max")
remote_ip_prefix = lookup(var.worker_allowed_ports[count.index], "remote_ip_prefix", "0.0.0.0/0")
}

data "template_file" "user_data" {
Expand All @@ -24,53 +24,53 @@ data "template_file" "user_data" {

# allow ping
resource "openstack_networking_secgroup_rule_v2" "k8s_icmp_i" {
count = "${length(var.k8s_allowed_remote_ips)}"
count = length(var.k8s_allowed_remote_ips)
direction = "ingress"
ethertype = "IPv4"
protocol = "icmp"
remote_ip_prefix = "${var.k8s_allowed_remote_ips[count.index]}"
security_group_id = "${openstack_networking_secgroup_v2.k8s.id}"
remote_ip_prefix = var.k8s_allowed_remote_ips[count.index]
security_group_id = openstack_networking_secgroup_v2.k8s.id
}

resource "openstack_networking_secgroup_rule_v2" "k8s_icmp_e" {
count = "${length(var.k8s_allowed_remote_ips)}"
count = length(var.k8s_allowed_remote_ips)
direction = "egress"
ethertype = "IPv4"
protocol = "icmp"
remote_ip_prefix = "${var.k8s_allowed_remote_ips[count.index]}"
security_group_id = "${openstack_networking_secgroup_v2.k8s.id}"
remote_ip_prefix = var.k8s_allowed_remote_ips[count.index]
security_group_id = openstack_networking_secgroup_v2.k8s.id
}

# allow SNMP
resource "openstack_networking_secgroup_rule_v2" "k8s_snmp" {
count = "${length(var.k8s_allowed_remote_ips)}"
count = length(var.k8s_allowed_remote_ips)
direction = "ingress"
ethertype = "IPv4"
protocol = "udp"
port_range_min = 161
port_range_max = 161
remote_ip_prefix = "${var.k8s_allowed_remote_ips[count.index]}"
security_group_id = "${openstack_networking_secgroup_v2.k8s.id}"
remote_ip_prefix = var.k8s_allowed_remote_ips[count.index]
security_group_id = openstack_networking_secgroup_v2.k8s.id
}

# allow NTP from nagios
resource "openstack_networking_secgroup_rule_v2" "k8s_ntp" {
count = "${length(var.k8s_allowed_remote_ips)}"
count = length(var.k8s_allowed_remote_ips)
direction = "ingress"
ethertype = "IPv4"
protocol = "udp"
port_range_min = 123
port_range_max = 123
remote_ip_prefix = "${var.k8s_allowed_remote_ips[count.index]}"
security_group_id = "${openstack_networking_secgroup_v2.k8s.id}"
remote_ip_prefix = var.k8s_allowed_remote_ips[count.index]
security_group_id = openstack_networking_secgroup_v2.k8s.id
}
resource "openstack_networking_secgroup_rule_v2" "k8s_ntp_e" {
count = "${length(var.k8s_allowed_remote_ips)}"
count = length(var.k8s_allowed_remote_ips)
direction = "egress"
ethertype = "IPv4"
protocol = "udp"
port_range_min = 123
port_range_max = 123
remote_ip_prefix = "${var.k8s_allowed_remote_ips[count.index]}"
security_group_id = "${openstack_networking_secgroup_v2.k8s.id}"
remote_ip_prefix = var.k8s_allowed_remote_ips[count.index]
security_group_id = openstack_networking_secgroup_v2.k8s.id
}
Loading

0 comments on commit 04089c9

Please sign in to comment.