Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Params cleanup #38

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
4 changes: 3 additions & 1 deletion ca/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ 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)}"
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/client/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" {}
# 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"
Copy link
Member

Choose a reason for hiding this comment

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

I thought the only types available were string and map? https://www.terraform.io/docs/configuration/variables.html

}
variable "dns_names_list" {
type = "list"
default = ["*.*.cluster.internal","*.ec2.internal"]
}
variable "ip_addresses_list" {
type = "list"
}
variable "docker_client_count" {}
variable "private_key" {}
variable "ca_cert_pem" {}
Expand All @@ -26,7 +33,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" {}
# 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 "ip_addresses_list" {
type = "list"
}
variable "docker_daemon_count" {}
variable "private_key" {}
variable "ca_cert_pem" {}
Expand All @@ -26,7 +33,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
8 changes: 6 additions & 2 deletions kubernetes/kubelet/main.tf
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
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
3 changes: 2 additions & 1 deletion kubernetes/master/deploy.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ resource "null_resource" "configure-master-certs" {
validity_period_hours = "${var.validity_period_hours}"
early_renewal_hours = "${var.early_renewal_hours}"
dns_names = "${var.dns_names}"
ip_addresses = "${var.ip_addresses}"
ip_addresses = "${join(",",var.ip_addresses)}"
deploy_ssh_hosts = "${join(",",var.deploy_ssh_hosts)}"
}

connection {
Expand Down
24 changes: 19 additions & 5 deletions kubernetes/master/main.tf
Original file line number Diff line number Diff line change
@@ -1,12 +1,26 @@
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 +40,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