Skip to content

Commit

Permalink
Generate SSH keys for OpsMan VM
Browse files Browse the repository at this point in the history
These unique keys will be available in terraform output

[#137294557]
Signed-off-by: Raina Masand <rmasand@pivotal.io>
  • Loading branch information
Kalai Wei authored and rainmaker committed Jan 13, 2017
1 parent 303cbb6 commit 98a390b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,11 @@ output "wildcard_vm_storage_account" {
}

output "ops_manager_ssh_public_key" {
value = "${var.vm_admin_public_key}"
value = "${tls_private_key.ops_manager.public_key_openssh}"
}

output "ops_manager_ssh_private_key" {
value = "${var.vm_admin_private_key}"
value = "${tls_private_key.ops_manager.private_key_pem}"
}

output "ops_manager_public_ip" {
Expand Down
4 changes: 0 additions & 4 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,4 @@ variable "vm_admin_username" {}

variable "vm_admin_password" {}

variable "vm_admin_public_key" {}

variable "vm_admin_private_key" {}

variable "dns_suffix" {}
9 changes: 7 additions & 2 deletions vm.tf
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ resource "azurerm_virtual_machine" "ops_manager_vm" {

ssh_keys {
path = "/home/${var.vm_admin_username}/.ssh/authorized_keys"
key_data = "${var.vm_admin_public_key}"
key_data = "${tls_private_key.ops_manager.public_key_openssh}"
}
}
}
Expand Down Expand Up @@ -109,7 +109,12 @@ resource "azurerm_virtual_machine" "optional_ops_manager_vm" {

ssh_keys {
path = "/home/${var.vm_admin_username}/.ssh/authorized_keys"
key_data = "${var.vm_admin_public_key}"
key_data = "${tls_private_key.ops_manager.public_key_openssh}"
}
}
}

resource "tls_private_key" "ops_manager" {
algorithm = "RSA"
rsa_bits = "4096"
}

0 comments on commit 98a390b

Please sign in to comment.