Skip to content
Open
1 change: 1 addition & 0 deletions ca/deploy.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ resource "null_resource" "deploy-ca-certs" {
early_renewal_hours = "${var.early_renewal_hours}"
common_name = "${var.common_name}"
organization = "${var.organization}"
deploy_ssh_hosts = "${join(",",var.deploy_ssh_hosts)}"
}

connection {
Expand Down
2 changes: 1 addition & 1 deletion ca/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ variable "is_ca_certificate" { default = true }
variable "ca_count" {}
# supports if you have a public/private ip and you want to set the private ip
# for internal cert but use the public_ip to connect via ssh
variable "deploy_ssh_hosts" {}
variable "deploy_ssh_hosts" { type = "list" }
variable "common_name" { default = "kube-ca" }
variable "target_folder" { default = "/etc/kubernetes/ssl"}
variable "user" { default = "core" }
Expand Down
5 changes: 3 additions & 2 deletions docker/client/deploy.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ resource "null_resource" "configure-docker-client-certs" {
docker_client_certs_pem = "${element(tls_locally_signed_cert.docker_client.*.cert_pem, count.index)}"
validity_period_hours = "${var.validity_period_hours}"
early_renewal_hours = "${var.early_renewal_hours}"
ip_addresses_list = "${var.ip_addresses_list}"
dns_names_list = "${var.dns_names_list}"
ip_addresses_list = "${join(",",var.ip_addresses_list)}"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need the joins here? Can't we use the "list" value on the trigger here and ones below?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can see why I added in the first time b1a4420 not sure if this still apply for Terraform v0.7.13
Is this pr actually any different from #38 ?

@tamsky tamsky Dec 2, 2016

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As best I can tell from my testing, triggers are still restricted to string-values only.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this pr actually any different from #38/ ?

#38 does require a rebase.

After careful further review of this PR, it appears to be identical except for format and ordering of elements.

dns_names_list = "${join(",",var.dns_names_list)}"
deploy_ssh_hosts = "${join(",",var.deploy_ssh_hosts)}"
}

connection {
Expand Down
11 changes: 7 additions & 4 deletions docker/client/main.tf
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
variable "ca_cert_pem" {}
variable "ca_private_key_pem" {}
variable "ip_addresses_list" {}
variable "ip_addresses_list" { type = "list" }
# supports if you have a public/private ip and you want to set the private ip
# for internal cert but use the public_ip to connect via ssh
variable "deploy_ssh_hosts" {}
variable "dns_names_list" { default = "*.*.cluster.internal,*.ec2.internal" }
variable "deploy_ssh_hosts" { type = "list" }
variable "dns_names_list" {
type = "list"
default = [ "*.*.cluster.internal", "*.ec2.internal" ]
}
variable "docker_client_count" {}
variable "private_key" {}
variable "validity_period_hours" {}
Expand All @@ -25,7 +28,7 @@ resource "tls_cert_request" "docker_client" {
common_name = "docker_client_${count.index}"
}

dns_names = ["${split(",", var.dns_names_list)}"]
dns_names = ["${var.dns_names_list}"]
ip_addresses = ["${element(var.ip_addresses_list, count.index)}"]
}

Expand Down
5 changes: 3 additions & 2 deletions docker/daemon/deploy.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ resource "null_resource" "configure-docker-dameon-certs" {
docker_daemon_certs_pem = "${element(tls_locally_signed_cert.docker_daemon.*.cert_pem, count.index)}"
validity_period_hours = "${var.validity_period_hours}"
early_renewal_hours = "${var.early_renewal_hours}"
ip_addresses_list = "${var.ip_addresses_list}"
dns_names_list = "${var.dns_names_list}"
ip_addresses_list = "${join(",",var.ip_addresses_list)}"
dns_names_list = "${join(",",var.dns_names_list)}"
deploy_ssh_hosts = "${join(",",var.deploy_ssh_hosts)}"
}

connection {
Expand Down
15 changes: 11 additions & 4 deletions docker/daemon/main.tf
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
variable "ca_cert_pem" {}
variable "ca_private_key_pem" {}
variable "ip_addresses_list" {}
variable "ip_addresses_list" { type = "list" }
# supports if you have a public/private ip and you want to set the private ip
# for internal cert but use the public_ip to connect via ssh
variable "deploy_ssh_hosts" {}
variable "dns_names_list" { default = "kubernetes,kubernetes.default,kubernetes.default.svc,kubernetes.default.svc.cluster.local" }
variable "deploy_ssh_hosts" { type = "list" }
variable "dns_names_list" {
type = "list"
default = [
"kubernetes,kubernetes.default",
"kubernetes.default.svc",
"kubernetes.default.svc.cluster.local"
]
}
variable "docker_daemon_count" {}
variable "private_key" {}
variable "validity_period_hours" { default = 8760 }
Expand All @@ -25,7 +32,7 @@ resource "tls_cert_request" "docker_daemon" {
common_name = "docker_daemon"
}

dns_names = ["${split(",", var.dns_names_list)}"]
dns_names = ["${var.dns_names_list}"]
ip_addresses = [
"127.0.0.1",
"${element(var.ip_addresses_list, count.index)}"
Expand Down
3 changes: 2 additions & 1 deletion kubernetes/kubelet/deploy.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ resource "null_resource" "configure-kubelet-certs" {
kubelet_certs_pem = "${element(tls_locally_signed_cert.kubelet.*.cert_pem, count.index)}"
validity_period_hours = "${var.validity_period_hours}"
early_renewal_hours = "${var.early_renewal_hours}"
ip_addresses = "${var.ip_addresses}"
ip_addresses = "${join(",",var.ip_addresses)}"
deploy_ssh_hosts = "${join(",",var.deploy_ssh_hosts)}"
}

connection {
Expand Down
4 changes: 2 additions & 2 deletions kubernetes/kubelet/main.tf
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
variable "ca_cert_pem" {}
variable "ca_private_key_pem" {}
variable "ip_addresses" {}
variable "ip_addresses" { type = "list" }
# supports if you have a public/private ip and you want to set the private ip
# for internal cert but use the public_ip to connect via ssh
variable "deploy_ssh_hosts" {}
variable "deploy_ssh_hosts" { type = "list" }
variable "kubelet_count" { default = "1" }
variable "validity_period_hours" { default = "8760" }
variable "early_renewal_hours" { default = "720" }
Expand Down
4 changes: 2 additions & 2 deletions kubernetes/master/deploy.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ resource "null_resource" "configure-master-certs" {
master_certs_pem = "${element(tls_locally_signed_cert.master.*.cert_pem, count.index)}"
validity_period_hours = "${var.validity_period_hours}"
early_renewal_hours = "${var.early_renewal_hours}"
dns_names = "${var.dns_names}"
ip_addresses = "${var.ip_addresses}"
dns_names = "${join(",",var.dns_names)}"
ip_addresses = "${join(",",var.ip_addresses)}"
}

connection {
Expand Down
29 changes: 24 additions & 5 deletions kubernetes/master/main.tf
Original file line number Diff line number Diff line change
@@ -1,12 +1,31 @@
variable "ca_cert_pem" {}
variable "ca_private_key_pem" {}
variable "ip_addresses" {}
variable "dns_names" { default = "" }
# supports if you have a public/private ip and you want to set the private ip
# for internal cert but use the public_ip to connect via ssh
variable "deploy_ssh_hosts" {}
variable "deploy_ssh_hosts" {
type = "list"
}
variable "ip_addresses" {
type = "list"
}
variable "kube_service_ip" {
type = "list"
default = [ "10.3.0.1" ]
}
variable "dns_names" {
type = "list"
}
variable "default_dns_names" {
type = "list"
default = [
"kubernetes",
"kubernetes.default",
"kubernetes.default.svc",
"kubernetes.default.svc.cluster.local"
]
}

variable "master_count" {}
variable "kube_service_ip" { default = "10.3.0.1" }
variable "validity_period_hours" { default = "8760" }
variable "early_renewal_hours" { default = "720" }
variable "ssh_user" { default = "core" }
Expand All @@ -26,7 +45,7 @@ resource "tls_cert_request" "master" {
common_name = "kube-master"
}

dns_names = ["${compact(var.dns_names)}", "kubernetes", "kubernetes.default", "kubernetes.default.svc", "kubernetes.default.svc.cluster.local"]
dns_names = ["${concat(var.dns_names, var.default_dns_names)}"]
ip_addresses = ["${concat(var.kube_service_ip, var.ip_addresses)}"]
}

Expand Down