parameterize CA script
This commit is contained in:
parent
dee050c05a
commit
71870c1fda
3 changed files with 8 additions and 2 deletions
|
@ -2,11 +2,11 @@
|
|||
set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
|
||||
eval "$(jq -r '@sh "PUBKEY=\(.pubkey) HOST=\(.host) CAHOST=\(.cahost)"')"
|
||||
eval "$(jq -r '@sh "PUBKEY=\(.pubkey) HOST=\(.host) CAHOST=\(.cahost) CASCRIPT=\.(.cascript)"')"
|
||||
|
||||
# TODO: Can this be done more eye-pleasingly?
|
||||
set +e
|
||||
CERT=$(ssh -o ConnectTimeout=3 -o ConnectionAttempts=1 root@$CAHOST '/root/ca.sh host "'"$PUBKEY"'" "'"$HOST"'".dmz')
|
||||
CERT=$(ssh -o ConnectTimeout=3 -o ConnectionAttempts=1 root@$CAHOST '"'"$CASCRIPT"'" host "'"$PUBKEY"'" "'"$HOST"'".dmz')
|
||||
retval=$?
|
||||
set -e
|
||||
|
||||
|
|
1
main.tf
1
main.tf
|
@ -38,6 +38,7 @@ data "external" "cert" {
|
|||
pubkey = trimspace(data.tls_public_key.debian.public_key_openssh)
|
||||
host = var.name
|
||||
cahost = var.ca_host
|
||||
cascript = var.ca_script
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -37,6 +37,11 @@ variable "ca_host" {
|
|||
description = "Host to contact when fetching a SSH host certificate."
|
||||
}
|
||||
|
||||
variable "ca_script" {
|
||||
type = string
|
||||
description = "Script to call when fetching a SSH host certificate."
|
||||
}
|
||||
|
||||
variable "domain_name" {
|
||||
type = string
|
||||
default = null
|
||||
|
|
Reference in a new issue