Add egress security group to kubernetes nodes

This commit is contained in:
Magnus Andersson 2024-01-12 12:53:55 +01:00
parent 57064f2eb6
commit 72f54d7e7f
Signed by: mandersson
GPG key ID: 19CB2C58E1F19B16
2 changed files with 6 additions and 2 deletions

View file

@ -5,7 +5,7 @@ resource "openstack_networking_port_v2" "kubeport" {
count = var.kubesize # size of cluster count = var.kubesize # size of cluster
network_id = data.openstack_networking_network_v2.public.id network_id = data.openstack_networking_network_v2.public.id
# A list of security group ID # A list of security group ID
security_group_ids = [ data.openstack_networking_secgroup_v2.sshfromjumphosts.id ] security_group_ids = [ data.openstack_networking_secgroup_v2.sshfromjumphosts.id, data.openstack_networking_secgroup_v2.allegress.id ]
admin_state_up = "true" admin_state_up = "true"
} }
@ -32,7 +32,7 @@ resource "openstack_compute_instance_v2" "kube" {
count = var.kubesize count = var.kubesize
flavor_id = data.openstack_compute_flavor_v2.b2c4r16.id flavor_id = data.openstack_compute_flavor_v2.b2c4r16.id
key_pair = data.openstack_compute_keypair_v2.manderssonpub.id key_pair = data.openstack_compute_keypair_v2.manderssonpub.id
security_groups = ["ssh-from-jumphost"] security_groups = [ data.openstack_networking_secgroup_v2.sshfromjumphosts.name, data.openstack_networking_secgroup_v2.allegress.name ]
network { network {
port = resource.openstack_networking_port_v2.kubeport[count.index].id port = resource.openstack_networking_port_v2.kubeport[count.index].id

View file

@ -2,3 +2,7 @@
data "openstack_networking_secgroup_v2" "sshfromjumphosts" { data "openstack_networking_secgroup_v2" "sshfromjumphosts" {
name = "ssh-from-jumphost" name = "ssh-from-jumphost"
} }
data "openstack_networking_secgroup_v2" "allegress" {
name = "allegress"
}