Skip to content
This repository has been archived by the owner on Feb 5, 2020. It is now read-only.

metal: add tectonic_ssh_private_key variable #625

Closed
wants to merge 1 commit 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
4 changes: 4 additions & 0 deletions examples/terraform.tfvars.metal
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,10 @@ tectonic_ssh_authorized_key = ""
// The Tectonic statistics collection URL to which to report.
tectonic_stats_url = "https://stats-collector.tectonic.com"

// (optional) SSH private key file corresponding to tectonic_ssh_authorized_key. If not provided, SSH agent will be used.
// Example: `/root/.ssh/id_rsa`
// tectonic_ssh_private_key_path = ""

// If set to true, a vanilla Kubernetes cluster will be deployed, omitting any Tectonic assets.
tectonic_vanilla_k8s = false

Expand Down
27 changes: 15 additions & 12 deletions platforms/metal/remote.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ resource "null_resource" "etcd_secrets" {
count = "${var.tectonic_etcd_tls_enabled ? length(var.tectonic_metal_controller_domains) : 0}"

connection {
type = "ssh"
host = "${element(var.tectonic_metal_controller_domains, count.index)}"
user = "core"
timeout = "60m"
type = "ssh"
host = "${element(var.tectonic_metal_controller_domains, count.index)}"
user = "core"
timeout = "60m"
private_key = "${file(var.tectonic_ssh_private_key_path != "" ? pathexpand(var.tectonic_ssh_private_key_path) : "/dev/null")}"
}

provisioner "file" {
Expand Down Expand Up @@ -52,10 +53,11 @@ resource "null_resource" "kubeconfig" {
depends_on = ["null_resource.etcd_secrets"]

connection {
type = "ssh"
host = "${element(concat(var.tectonic_metal_controller_domains, var.tectonic_metal_worker_domains), count.index)}"
user = "core"
timeout = "60m"
type = "ssh"
host = "${element(concat(var.tectonic_metal_controller_domains, var.tectonic_metal_worker_domains), count.index)}"
user = "core"
timeout = "60m"
private_key = "${file(var.tectonic_ssh_private_key_path != "" ? pathexpand(var.tectonic_ssh_private_key_path) : "/dev/null")}"
}

provisioner "file" {
Expand All @@ -78,10 +80,11 @@ resource "null_resource" "bootstrap" {
depends_on = ["null_resource.kubeconfig"]

connection {
type = "ssh"
host = "${element(var.tectonic_metal_controller_domains, 0)}"
user = "core"
timeout = "60m"
type = "ssh"
host = "${element(var.tectonic_metal_controller_domains, 0)}"
user = "core"
timeout = "60m"
private_key = "${file(var.tectonic_ssh_private_key_path != "" ? pathexpand(var.tectonic_ssh_private_key_path) : "/dev/null")}"
}

provisioner "file" {
Expand Down
6 changes: 6 additions & 0 deletions platforms/metal/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -185,3 +185,9 @@ SSH public key to use as an authorized key.
Example: `ssh-rsa AAAB3N...`
EOF
}

variable "tectonic_ssh_private_key_path" {
type = "string"
description = "SSH private key file corresponding to tectonic_ssh_authorized_key. If not provided, SSH agent will be used."
default = ""
}