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 Jun 5, 2017
1 parent aa9fefc commit 37fcb86
Show file tree
Hide file tree
Showing 3 changed files with 20 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 @@ -200,6 +200,10 @@ tectonic_service_cidr = "10.3.0.0/16"
// Example: `ssh-rsa AAAB3N...`
tectonic_ssh_authorized_key = ""

// (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
18 changes: 10 additions & 8 deletions platforms/metal/remote.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ resource "null_resource" "kubeconfig" {
count = "${length(var.tectonic_metal_controller_domains) + length(var.tectonic_metal_worker_domains)}"

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 @@ -28,10 +29,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 37fcb86

Please sign in to comment.