Fediversity/launch/main.tf

113 lines
2.5 KiB
HCL

variable "terraform-nixos" {
type = string
}
variable "domain" {
type = string
default = "fediversity.net"
}
variable "mastodon" {
type = object({
enable = bool
})
default = {
enable = false
}
}
variable "pixelfed" {
type = object({
enable = bool
})
default = {
enable = false
}
}
variable "peertube" {
type = object({
enable = bool
})
default = {
enable = false
}
}
variable "initialUser" {
type = object({
displayName = string
username = string
email = string
# TODO: mark (nested) credentials as sensitive
# https://discuss.hashicorp.com/t/is-it-possible-to-mark-an-attribute-of-an-object-as-sensitive/24649/2
password = string
})
default = {
displayName = "Testy McTestface"
username = "test"
email = "test@test.com"
password = "testtest"
}
}
# TODO: could this straight-up be added in the child module instead?
variable "ssh_private_key_file" {
type = string
description = "Path to private key used to connect to the target_host"
default = ""
}
variable "deploy_environment" {
type = map(string)
description = "Extra environment variables to be set during deployment."
default = {}
}
# module "garage" {
# source = "./vm"
# count = var.mastodon.enable || var.pixelfed.enable || var.peertube.enable ? 1 : 0
# domain = var.domain
# hostname = "test01"
# config = "garage"
# initialUser = var.initialUser
# terraform-nixos = var.terraform-nixos
# ssh_private_key_file = var.ssh_private_key_file
# deploy_environment = var.deploy_environment
# }
module "mastodon" {
source = "./vm"
count = var.mastodon.enable ? 1 : 0
domain = var.domain
hostname = "test06"
config = "mastodon"
initialUser = var.initialUser
terraform-nixos = var.terraform-nixos
ssh_private_key_file = var.ssh_private_key_file
deploy_environment = var.deploy_environment
}
module "pixelfed" {
source = "./vm"
count = var.pixelfed.enable ? 1 : 0
domain = var.domain
hostname = "test04"
config = "pixelfed"
initialUser = var.initialUser
terraform-nixos = var.terraform-nixos
ssh_private_key_file = var.ssh_private_key_file
deploy_environment = var.deploy_environment
}
module "peertube" {
source = "./vm"
count = var.peertube.enable ? 1 : 0
domain = var.domain
hostname = "test03"
config = "peertube"
initialUser = var.initialUser
terraform-nixos = var.terraform-nixos
ssh_private_key_file = var.ssh_private_key_file
deploy_environment = var.deploy_environment
}