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

Commit

Permalink
metal: add tectonic_ssh_private_key variable
Browse files Browse the repository at this point in the history
Allow users to specify the SSH private key via a variable in cases where
ssh-agent isn't available or configured.
  • Loading branch information
coreypobrien committed Jul 11, 2017
1 parent b47c81d commit 1730d62
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 8 deletions.
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
19 changes: 11 additions & 8 deletions platforms/metal/remote.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ resource "null_resource" "etcd_secrets" {
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 = ""
}

0 comments on commit 1730d62

Please sign in to comment.