Skip to content
New issue

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

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

Already on GitHub? # to your account

Add explicit "create_ca" bool #1

Merged
merged 3 commits into from
Aug 24, 2018
Merged
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
4 changes: 2 additions & 2 deletions tls-k8s.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@

# Kubernetes CA (tls/{ca.crt,ca.key})
resource "tls_private_key" "kube-ca" {
count = "${var.ca_certificate == "" ? 1 : 0}"
count = "${var.create_ca == 1 ? 1 : 0}"

algorithm = "RSA"
rsa_bits = "2048"
}

resource "tls_self_signed_cert" "kube-ca" {
count = "${var.ca_certificate == "" ? 1 : 0}"
count = "${var.create_ca == 1 ? 1 : 0}"

key_algorithm = "${tls_private_key.kube-ca.algorithm}"
private_key_pem = "${tls_private_key.kube-ca.private_key_pem}"
Expand Down
5 changes: 5 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@ variable "trusted_certs_dir" {
default = "/usr/share/ca-certificates"
}

variable "create_ca" {
description = "Toggles creation of a CA (omit ca_certificate when true)"
default = true
}

variable "ca_certificate" {
description = "Existing PEM-encoded CA certificate (generated if blank)"
type = "string"
Expand Down