Skip to content
This repository has been archived by the owner on May 8, 2019. It is now read-only.

Commit

Permalink
Give security groups per-cluster names and reference them by name whe…
Browse files Browse the repository at this point in the history
…n adding to instances

This works around this issue: hashicorp/terraform#6317
  • Loading branch information
sigmunau committed May 16, 2017
1 parent 633ab39 commit b8c83eb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions terraform/networking.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ resource "openstack_networking_router_interface_v2" "router_interface_1" {

resource "openstack_networking_secgroup_v2" "ssh_access" {
region = "${var.region}"
name = "ssh_access"
name = "${var.cluster_name}-ssh_access"
description = "Security groups for allowing SSH access"
}

Expand All @@ -45,7 +45,7 @@ resource "openstack_networking_secgroup_rule_v2" "ssh_access_ipv4" {

resource "openstack_networking_secgroup_v2" "kube_lb" {
region = "${var.region}"
name = "kube_lb"
name = "${var.cluster_name}-kube_lb"
description = "Security groups for allowing web access to lb nodes"
}

Expand Down Expand Up @@ -75,7 +75,7 @@ resource "openstack_networking_secgroup_rule_v2" "kube_lb_https_ipv4" {

resource "openstack_networking_secgroup_v2" "kube_master" {
region = "${var.region}"
name = "kube_master"
name = "${var.cluster_name}_kube_master"
description = "Security groups for allowing API access to the master nodes"
}

Expand Down
8 changes: 4 additions & 4 deletions terraform/testsetup.tf
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ resource "openstack_compute_instance_v2" "master" {
key_pair = "${openstack_compute_keypair_v2.keypair.name}"
security_groups = [
"default",
"${openstack_networking_secgroup_v2.ssh_access.id}",
"${openstack_networking_secgroup_v2.kube_master.id}",
"${openstack_networking_secgroup_v2.ssh_access.name}",
"${openstack_networking_secgroup_v2.kube_master.name}",
]
user_data = "#cloud-config\nhostname: ${var.cluster_name}-master-${count.index}\n"

Expand Down Expand Up @@ -64,8 +64,8 @@ resource "openstack_compute_instance_v2" "worker" {
key_pair = "${openstack_compute_keypair_v2.keypair.name}"
security_groups = [
"default",
"${openstack_networking_secgroup_v2.ssh_access.id}",
"${openstack_networking_secgroup_v2.kube_lb.id}",
"${openstack_networking_secgroup_v2.ssh_access.name}",
"${openstack_networking_secgroup_v2.kube_lb.name}",
]
user_data = "#cloud-config\nhostname: ${var.cluster_name}-worker-${count.index}\n"

Expand Down

0 comments on commit b8c83eb

Please sign in to comment.