mirror of
https://github.com/kasmtech/terraform.git
synced 2026-01-23 02:24:11 +00:00
Added SSH key generation feature to AWS and OCI
This commit is contained in:
parent
19816784af
commit
25f0dd183b
32 changed files with 277 additions and 17 deletions
|
|
@ -34,3 +34,9 @@ module "kasm" {
|
|||
admin_password = var.admin_password
|
||||
user_password = var.user_password
|
||||
}
|
||||
|
||||
output "ssh_key_info" {
|
||||
description = "SSH Keys to use with Kasm Deployment"
|
||||
value = module.standard.ssh_key_info
|
||||
sensitive = true
|
||||
}
|
||||
|
|
@ -24,7 +24,7 @@ resource "oci_core_instance" "kasm_instance" {
|
|||
}
|
||||
|
||||
metadata = {
|
||||
ssh_authorized_keys = var.ssh_authorized_keys
|
||||
ssh_authorized_keys = var.ssh_authorized_keys == "" ? tls_private_key.ssh_key[0].public_key_openssh : var.ssh_authorized_keys
|
||||
user_data = base64encode(templatefile("${path.module}/userdata/bootstrap.sh",
|
||||
{
|
||||
kasm_build_url = var.kasm_build_url
|
||||
|
|
|
|||
16
oci/single_server/module/ssh_keys.tf
Normal file
16
oci/single_server/module/ssh_keys.tf
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
resource "tls_private_key" "ssh_key" {
|
||||
count = var.ssh_authorized_keys == "" ? 1 : 0
|
||||
algorithm = "ED25519"
|
||||
}
|
||||
|
||||
output "ssh_key_info" {
|
||||
description = "SSH Keys for use with Kasm Deployment"
|
||||
value = <<-SSHKEYS
|
||||
SSH Keys:
|
||||
%{if var.ssh_authorized_keys == ""}
|
||||
Public Key: ${tls_private_key.ssh_key[0].public_key_openssh}
|
||||
Private Key:
|
||||
${tls_private_key.ssh_key[0].private_key_openssh}
|
||||
%{endif}
|
||||
SSHKEYS
|
||||
}
|
||||
|
|
@ -44,3 +44,9 @@ module "kasm" {
|
|||
database_password = var.database_password
|
||||
service_registration_token = var.service_registration_token
|
||||
}
|
||||
|
||||
output "ssh_key_info" {
|
||||
description = "SSH Keys to use with Kasm Deployment"
|
||||
value = module.standard.ssh_key_info
|
||||
sensitive = true
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ resource "oci_core_instance" "agent" {
|
|||
|
||||
|
||||
metadata = {
|
||||
ssh_authorized_keys = var.ssh_authorized_keys
|
||||
ssh_authorized_keys = var.ssh_authorized_keys == "" ? tls_private_key.ssh_key[0].public_key_openssh : var.ssh_authorized_keys
|
||||
user_data = base64encode(templatefile("${path.module}/userdata/agent_bootstrap.sh",
|
||||
{
|
||||
kasm_build_url = var.kasm_build_url
|
||||
|
|
|
|||
|
|
@ -25,6 +25,6 @@ resource "oci_core_instance" "bastion" {
|
|||
}
|
||||
|
||||
metadata = {
|
||||
ssh_authorized_keys = var.ssh_authorized_keys
|
||||
ssh_authorized_keys = var.ssh_authorized_keys == "" ? tls_private_key.ssh_key[0].public_key_openssh : var.ssh_authorized_keys
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ resource "oci_core_instance" "cpx" {
|
|||
|
||||
|
||||
metadata = {
|
||||
ssh_authorized_keys = var.ssh_authorized_keys
|
||||
ssh_authorized_keys = var.ssh_authorized_keys == "" ? tls_private_key.ssh_key[0].public_key_openssh : var.ssh_authorized_keys
|
||||
user_data = base64encode(templatefile("${path.module}/userdata/cpx_bootstrap.sh",
|
||||
{
|
||||
kasm_build_url = var.kasm_build_url
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ resource "oci_core_instance" "db" {
|
|||
}
|
||||
|
||||
metadata = {
|
||||
ssh_authorized_keys = var.ssh_authorized_keys
|
||||
ssh_authorized_keys = var.ssh_authorized_keys == "" ? tls_private_key.ssh_key[0].public_key_openssh : var.ssh_authorized_keys
|
||||
user_data = base64encode(templatefile("${path.module}/userdata/db_bootstrap.sh",
|
||||
{
|
||||
kasm_build_url = var.kasm_build_url
|
||||
|
|
|
|||
16
oci/standard/module/ssh_keys.tf
Normal file
16
oci/standard/module/ssh_keys.tf
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
resource "tls_private_key" "ssh_key" {
|
||||
count = var.ssh_authorized_keys == "" ? 1 : 0
|
||||
algorithm = "ED25519"
|
||||
}
|
||||
|
||||
output "ssh_key_info" {
|
||||
description = "SSH Keys for use with Kasm Deployment"
|
||||
value = <<-SSHKEYS
|
||||
SSH Keys:
|
||||
%{if var.ssh_authorized_keys == ""}
|
||||
Public Key: ${tls_private_key.ssh_key[0].public_key_openssh}
|
||||
Private Key:
|
||||
${tls_private_key.ssh_key[0].private_key_openssh}
|
||||
%{endif}
|
||||
SSHKEYS
|
||||
}
|
||||
|
|
@ -26,7 +26,7 @@ resource "oci_core_instance" "webapp" {
|
|||
}
|
||||
|
||||
metadata = {
|
||||
ssh_authorized_keys = var.ssh_authorized_keys
|
||||
ssh_authorized_keys = var.ssh_authorized_keys == "" ? tls_private_key.ssh_key[0].public_key_openssh : var.ssh_authorized_keys
|
||||
user_data = base64encode(templatefile("${path.module}/userdata/webapp_bootstrap.sh",
|
||||
{
|
||||
kasm_build_url = var.kasm_build_url
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue