Add subdomain variable to terraform

Tested by running against a new DO cluster. Readme updated with the new variable name and a
brief description of it

Signed-off-by: Simon Emms <simon@simonemms.com>
This commit is contained in:
Simon Emms 2020-08-24 13:05:05 +01:00 committed by Alex Ellis
parent 68ac4dfecb
commit 16a8d2ac6c
3 changed files with 9 additions and 3 deletions

View File

@ -10,6 +10,7 @@
| ------------ | ------------------- | --------------- |
| `do_token` | Digitalocean API token | None |
| `do_domain` | Public domain used for the faasd gateway | None |
| `do_subdomain` | Public subdomain used for the faasd gateway | `faasd` |
| `letsencrypt_email` | Email used by when ordering TLS certificate from Letsencrypt | `""` |
| `do_create_record` | When set to `true`, a new DNS record will be created. This works only if your domain (`do_domain`) is managed by Digitalocean | `false` |
| `do_region` | Digitalocean region for creating the droplet | `fra1` |

View File

@ -8,6 +8,10 @@ variable "do_token" {
variable "do_domain" {
description = "Your public domain"
}
variable "do_subdomain" {
description = "Your public subdomain"
default = "faasd"
}
variable "letsencrypt_email" {
description = "Email used to order a certificate from Letsencrypt"
}
@ -43,7 +47,7 @@ data "template_file" "cloud_init" {
vars = {
gw_password=random_password.password.result,
ssh_key=data.local_file.ssh_key.content,
faasd_domain_name="faasd.${var.do_domain}"
faasd_domain_name="${var.do_subdomain}.${var.do_domain}"
letsencrypt_email=var.letsencrypt_email
}
}
@ -70,7 +74,7 @@ output "droplet_ip" {
}
output "gateway_url" {
value = "https://faasd.${var.do_domain}/"
value = "https://${var.do_subdomain}.${var.do_domain}/"
}
output "password" {
@ -78,5 +82,5 @@ output "password" {
}
output "login_cmd" {
value = "faas-cli login -g https://faasd.${var.do_domain}/ -p ${random_password.password.result}"
value = "faas-cli login -g https://${var.do_subdomain}.${var.do_domain}/ -p ${random_password.password.result}"
}

View File

@ -1,3 +1,4 @@
do_token = ""
do_domain = ""
do_subdomain = ""
letsencrypt_email = ""