Move Guacamole setup to Helm
parent
e662f8c97d
commit
27d1b8434b
110
main.tf
110
main.tf
|
|
@ -16,11 +16,6 @@ terraform {
|
||||||
source = "telmate/proxmox"
|
source = "telmate/proxmox"
|
||||||
version = "~> 2.9.8"
|
version = "~> 2.9.8"
|
||||||
}
|
}
|
||||||
guacamole = {
|
|
||||||
source = "techBeck03/guacamole"
|
|
||||||
version = "~> 1.4.1"
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
backend "kubernetes" {
|
backend "kubernetes" {
|
||||||
secret_suffix = "tfstate"
|
secret_suffix = "tfstate"
|
||||||
|
|
@ -45,12 +40,6 @@ provider "keycloak" {
|
||||||
url = "https://keycloak.${var.domain_suffix}"
|
url = "https://keycloak.${var.domain_suffix}"
|
||||||
}
|
}
|
||||||
|
|
||||||
provider "guacamole" {
|
|
||||||
url = "https://guacamole.${var.domain_suffix}/guacamole"
|
|
||||||
token = var.guacamole_token
|
|
||||||
data_source = var.guacamole_datasource
|
|
||||||
}
|
|
||||||
|
|
||||||
provider "proxmox" {
|
provider "proxmox" {
|
||||||
pm_api_url = var.proxmox_api_url
|
pm_api_url = var.proxmox_api_url
|
||||||
pm_api_token_id = var.proxmox_token_id
|
pm_api_token_id = var.proxmox_token_id
|
||||||
|
|
@ -149,6 +138,87 @@ resource "helm_release" "gitea" {
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
resource "keycloak_openid_client" "guac_client" {
|
||||||
|
realm_id = keycloak_realm.realm.id
|
||||||
|
client_id = "guac"
|
||||||
|
|
||||||
|
enabled = true
|
||||||
|
|
||||||
|
access_type = "CONFIDENTIAL"
|
||||||
|
standard_flow_enabled = true
|
||||||
|
implicit_flow_enabled = true
|
||||||
|
valid_redirect_uris = [
|
||||||
|
"https://guac.${var.domain_suffix}/*"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "random_password" "guac_db_pw" {
|
||||||
|
length = 16
|
||||||
|
special = false
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "random_password" "guac_db_admin_pw" {
|
||||||
|
length = 16
|
||||||
|
special = false
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "helm_release" "guacpg" {
|
||||||
|
name = "guacpg"
|
||||||
|
namespace = var.guac_namespace
|
||||||
|
repository = "https://charts.bitnami.com/bitnami/"
|
||||||
|
chart = "postgresql"
|
||||||
|
create_namespace = true
|
||||||
|
values = [
|
||||||
|
<<EOT
|
||||||
|
global:
|
||||||
|
storageClass: ${var.storageclass}
|
||||||
|
auth:
|
||||||
|
username: guacamole
|
||||||
|
password: ${random_password.guac_db_pw.result}
|
||||||
|
postgresPassword: ${random_password.guac_db_admin_pw.result}
|
||||||
|
database: guacamole
|
||||||
|
EOT
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "helm_release" "guac" {
|
||||||
|
name = "guac"
|
||||||
|
namespace = var.guac_namespace
|
||||||
|
repository = "https://charts.beryju.org"
|
||||||
|
chart = "guacamole"
|
||||||
|
create_namespace = true
|
||||||
|
values = [
|
||||||
|
<<EOT
|
||||||
|
guacamole:
|
||||||
|
settings:
|
||||||
|
OPENID_AUTHORIZATION_ENDPOINT: https://keycloak.${var.domain_suffix}/realms/${var.keycloak_realm}/protocol/openid-connect/auth
|
||||||
|
OPENID_JWKS_ENDPOINT: https://keycloak.${var.domain_suffix}/realms/${var.keycloak_realm}/protocol/openid-connect/certs
|
||||||
|
OPENID_ISSUER: https://keycloak.${var.domain_suffix}/realms/${var.keycloak_realm}
|
||||||
|
OPENID_CLIENT_ID: ${keycloak_openid_client.guac_client.client_id}
|
||||||
|
OPENID_REDIRECT_URI: https://guac.${var.domain_suffix}/
|
||||||
|
ingress:
|
||||||
|
enabled: true
|
||||||
|
annotations:
|
||||||
|
traefik.ingress.kubernetes.io/router.middlewares: default-redirect-https@kubernetescrd
|
||||||
|
cert-manager.io/cluster-issuer: letsencrypt-prod
|
||||||
|
hosts:
|
||||||
|
- host: guac.${var.domain_suffix}
|
||||||
|
paths:
|
||||||
|
- /
|
||||||
|
tls:
|
||||||
|
- secretName: guac-tls
|
||||||
|
hosts:
|
||||||
|
- guac.${var.domain_suffix}
|
||||||
|
postgres:
|
||||||
|
hostname: guacpg-postgresql
|
||||||
|
password: ${random_password.guac_db_pw.result}
|
||||||
|
EOT
|
||||||
|
]
|
||||||
|
depends_on = [
|
||||||
|
helm_release.guacpg
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
resource "keycloak_openid_client" "nautobot_client" {
|
resource "keycloak_openid_client" "nautobot_client" {
|
||||||
realm_id = keycloak_realm.realm.id
|
realm_id = keycloak_realm.realm.id
|
||||||
client_id = "nautobot"
|
client_id = "nautobot"
|
||||||
|
|
@ -470,21 +540,3 @@ resource "proxmox_vm_qemu" "vyos_router" {
|
||||||
${var.ssh_key}
|
${var.ssh_key}
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "guacamole_connection_group" "routers" {
|
|
||||||
parent_identifier = "ROOT"
|
|
||||||
name = "Routers"
|
|
||||||
type = "organizational"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
resource "guacamole_connection_ssh" "vyos_vms" {
|
|
||||||
for_each = { for x in proxmox_vm_qemu.vyos_router: x.name => x }
|
|
||||||
name = each.value.name
|
|
||||||
parent_identifier = guacamole_connection_group.routers.identifier
|
|
||||||
parameters {
|
|
||||||
hostname = each.value.default_ipv4_address
|
|
||||||
username = "vyos"
|
|
||||||
private_key = var.ssh_private_key
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
4
vars.tf
4
vars.tf
|
|
@ -58,6 +58,10 @@ variable "guacamole_datasource" {
|
||||||
default = "mysql"
|
default = "mysql"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
variable "guac_namespace" {
|
||||||
|
default = "guac"
|
||||||
|
}
|
||||||
|
|
||||||
variable "ssh_key" {
|
variable "ssh_key" {
|
||||||
default = <<-EOT
|
default = <<-EOT
|
||||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