Skip to content

Commit

Permalink
Merge pull request #87 from utilitywarehouse/tf-0.12
Browse files Browse the repository at this point in the history
Convert to v0.12 syntax
  • Loading branch information
ribbybibby authored Jul 9, 2019
2 parents e9bf51a + ad86924 commit 3d42b4a
Show file tree
Hide file tree
Showing 9 changed files with 330 additions and 328 deletions.
6 changes: 3 additions & 3 deletions _data.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
variable "node_name_command" {
type = "map"
type = map(string)

default = {
"" = "hostname -f"
Expand All @@ -9,7 +9,7 @@ variable "node_name_command" {
}

variable "get_ip_command" {
type = "map"
type = map(string)

default = {
"" = "ip route get 1.2.3.4 | head -n 1 | awk '{print $7}'"
Expand All @@ -20,5 +20,5 @@ variable "get_ip_command" {

// master address is the first in the service subnet
locals {
kubernetes_master_svc = "${cidrhost(var.service_network, 1)}"
kubernetes_master_svc = cidrhost(var.service_network, 1)
}
92 changes: 46 additions & 46 deletions cfssl.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,35 +13,35 @@ resource "random_id" "cfssl-auth-key-apiserver" {

data "ignition_systemd_unit" "locksmithd_cfssl" {
name = "locksmithd.service"
mask = "${!var.enable_container_linux_locksmithd_cfssl}"
mask = false == var.enable_container_linux_locksmithd_cfssl
}

// used by clients
data "template_file" "cfssl-client-config" {
template = "${file("${path.module}/resources/cfssl-client-config.json")}"
template = file("${path.module}/resources/cfssl-client-config.json")

vars {
cfssl_server_endpoint = "${var.cfssl_server_address}"
cfssl_auth_key = "${random_id.cfssl-auth-key-client.hex}"
vars = {
cfssl_server_endpoint = var.cfssl_server_address
cfssl_auth_key = random_id.cfssl-auth-key-client.hex
}
}

data "ignition_file" "cfssl-client-config" {
mode = 0600
mode = 384
filesystem = "root"
path = "/etc/cfssl/config.json"

content {
content = "${data.template_file.cfssl-client-config.rendered}"
content = data.template_file.cfssl-client-config.rendered
}
}

data "template_file" "cfssl-disk-mounter" {
template = "${file("${path.module}/resources/disk-mounter.service")}"
template = file("${path.module}/resources/disk-mounter.service")

vars {
vars = {
script_path = "/opt/bin/format-and-mount"
volume_id = "${var.cfssl_data_volumeid}"
volume_id = var.cfssl_data_volumeid
filesystem = "ext4"
user = "root"
group = "root"
Expand All @@ -51,11 +51,11 @@ data "template_file" "cfssl-disk-mounter" {

data "ignition_systemd_unit" "cfssl-disk-mounter" {
name = "disk-mounter.service"
content = "${data.template_file.cfssl-disk-mounter.rendered}"
content = data.template_file.cfssl-disk-mounter.rendered
}

data "ignition_file" "cfssl-ca-csr" {
mode = 0644
mode = 420
filesystem = "root"
path = "/etc/cfssl/ca-csr.json"

Expand All @@ -67,72 +67,72 @@ EOS
}

data "ignition_file" "cfssl-init-ca" {
mode = 0755
mode = 493
filesystem = "root"
path = "/opt/bin/cfssl-init-ca"

content {
content = "${file("${path.module}/resources/cfssl-init-ca.sh")}"
content = file("${path.module}/resources/cfssl-init-ca.sh")
}
}

data "ignition_file" "cfssl-init-proxy-pki" {
mode = 0755
mode = 493
filesystem = "root"
path = "/opt/bin/cfssl-init-proxy-pki"

content {
content = "${file("${path.module}/resources/cfssl-init-proxy-pki")}"
content = file("${path.module}/resources/cfssl-init-proxy-pki")
}
}

data "ignition_file" "cfssl-proxy-ca-csr-json" {
mode = 0644
mode = 420
filesystem = "root"
path = "/etc/cfssl/proxy-ca-csr.json"

content {
content = "${file("${path.module}/resources/cfssl-proxy-ca-csr.json")}"
content = file("${path.module}/resources/cfssl-proxy-ca-csr.json")
}
}

data "ignition_file" "cfssl-proxy-csr-json" {
mode = 0644
mode = 420
filesystem = "root"
path = "/etc/cfssl/proxy-csr.json"

content {
content = "${file("${path.module}/resources/cfssl-proxy-csr.json")}"
content = file("${path.module}/resources/cfssl-proxy-csr.json")
}
}

data "template_file" "cfssl-server-config" {
template = "${file("${path.module}/resources/cfssl-server-config.json")}"
template = file("${path.module}/resources/cfssl-server-config.json")

vars {
expiry_hours = "${var.cfssl_node_expiry_hours}"
cfssl_unused_key = "${random_id.cfssl-auth-key-unused.hex}"
cfssl_auth_key = "${random_id.cfssl-auth-key-client.hex}"
vars = {
expiry_hours = var.cfssl_node_expiry_hours
cfssl_unused_key = random_id.cfssl-auth-key-unused.hex
cfssl_auth_key = random_id.cfssl-auth-key-client.hex
}
}

data "ignition_file" "cfssl-server-config" {
mode = 0600
mode = 384
filesystem = "root"
path = "/etc/cfssl/config.json"

content {
content = "${data.template_file.cfssl-server-config.rendered}"
content = data.template_file.cfssl-server-config.rendered
}
}

data "ignition_systemd_unit" "cfssl" {
name = "cfssl.service"
content = "${file("${path.module}/resources/cfssl.service")}"
content = file("${path.module}/resources/cfssl.service")
}

data "ignition_file" "cfssl-sk-csr" {
mode = 0644
mode = 420
filesystem = "root"
path = "/etc/cfssl/sk-csr.json"

Expand All @@ -144,17 +144,17 @@ EOS
}

data "ignition_file" "cfssl-nginx-conf" {
mode = 0644
mode = 420
filesystem = "root"
path = "/etc/cfssl/sk-nginx.conf"

content {
content = "${file("${path.module}/resources/cfssl-nginx.conf")}"
content = file("${path.module}/resources/cfssl-nginx.conf")
}
}

data "ignition_file" "cfssl-nginx-auth" {
mode = 0644
mode = 420
filesystem = "root"
path = "/etc/cfssl/sk-nginx.htpasswd"

Expand All @@ -166,9 +166,9 @@ data "ignition_file" "cfssl-nginx-auth" {
}

data "template_file" "cfssl-nginx" {
template = "${file("${path.module}/resources/cfssl-nginx.service")}"
template = file("${path.module}/resources/cfssl-nginx.service")

vars {
vars = {
nginx_image_url = "nginx"
nginx_image_tag = "1.15-alpine"
}
Expand All @@ -177,7 +177,7 @@ data "template_file" "cfssl-nginx" {
data "ignition_systemd_unit" "cfssl-nginx" {
name = "cfssl-nginx.service"

content = "${data.template_file.cfssl-nginx.rendered}"
content = data.template_file.cfssl-nginx.rendered
}

module "cfssl-restarter" {
Expand All @@ -188,8 +188,8 @@ module "cfssl-restarter" {
}

data "ignition_config" "cfssl" {
files = ["${concat(
list(
files = concat(
[
data.ignition_file.cfssl.id,
data.ignition_file.cfssljson.id,
data.ignition_file.cfssl-server-config.id,
Expand All @@ -202,21 +202,21 @@ data "ignition_config" "cfssl" {
data.ignition_file.cfssl-nginx-conf.id,
data.ignition_file.cfssl-nginx-auth.id,
data.ignition_file.format-and-mount.id,
),
var.cfssl_additional_files,
)}"]
],
var.cfssl_additional_files
)

systemd = ["${concat(
list(
systemd = concat(
[
data.ignition_systemd_unit.update-engine.id,
data.ignition_systemd_unit.locksmithd_cfssl.id,
data.ignition_systemd_unit.docker-opts-dropin.id,
data.ignition_systemd_unit.node-exporter.id,
data.ignition_systemd_unit.cfssl.id,
data.ignition_systemd_unit.cfssl-nginx.id,
data.ignition_systemd_unit.cfssl-disk-mounter.id,
),
module.cfssl-restarter.systemd_units,
var.cfssl_additional_systemd_units,
)}"]
],
module.cfssl-restarter.systemd_units,
var.cfssl_additional_systemd_units
)
}
24 changes: 12 additions & 12 deletions common.tf
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
data "ignition_systemd_unit" "update-engine" {
name = "update-engine.service"
mask = "${!var.enable_container_linux_update-engine}"
mask = false == var.enable_container_linux_update-engine
}

data "ignition_file" "cfssl" {
filesystem = "root"
path = "/opt/bin/cfssl"
mode = 0755
mode = 493

source {
source = "https://pkg.cfssl.org/R1.2/cfssl_linux-amd64"
Expand All @@ -17,7 +17,7 @@ data "ignition_file" "cfssl" {
data "ignition_file" "cfssljson" {
filesystem = "root"
path = "/opt/bin/cfssljson"
mode = 0755
mode = 493

source {
source = "https://pkg.cfssl.org/R1.2/cfssljson_linux-amd64"
Expand All @@ -29,39 +29,39 @@ module "kubelet-restarter" {
source = "./systemd_service_restarter"

service_name = "kubelet"
on_calendar = "${var.cfssl_node_renew_timer}"
on_calendar = var.cfssl_node_renew_timer
}

data "ignition_systemd_unit" "docker-opts-dropin" {
name = "docker.service"

dropin {
name = "10-custom-options.conf"
content = "${file("${path.module}/resources/docker-dropin.conf")}"
content = file("${path.module}/resources/docker-dropin.conf")
}
}

data "template_file" "node-exporter" {
template = "${file("${path.module}/resources/node-exporter.service")}"
template = file("${path.module}/resources/node-exporter.service")

vars {
node_exporter_image_url = "${var.node_exporter_image_url}"
node_exporter_image_tag = "${var.node_exporter_image_tag}"
vars = {
node_exporter_image_url = var.node_exporter_image_url
node_exporter_image_tag = var.node_exporter_image_tag
}
}

data "ignition_systemd_unit" "node-exporter" {
name = "node-exporter.service"

content = "${data.template_file.node-exporter.rendered}"
content = data.template_file.node-exporter.rendered
}

data "ignition_file" "format-and-mount" {
mode = 0755
mode = 493
filesystem = "root"
path = "/opt/bin/format-and-mount"

content {
content = "${file("${path.module}/resources/format-and-mount")}"
content = file("${path.module}/resources/format-and-mount")
}
}
Loading

0 comments on commit 3d42b4a

Please sign in to comment.