Files
erp/iac/main.tf
2024-11-15 16:02:54 +01:00

33 lines
915 B
HCL

locals {
app = {
name = "erp"
product_name = "dolibarr" # unused
}
}
module "app_roles" {
source = "git::ssh://git@192.168.1.202:2222/arcodange-org/tools.git//hashicorp-vault/iac/modules/app_roles?depth=1&ref=main"
name = local.app.name
}
resource "random_password" "admin_initial_password" {
length = 32
}
resource "random_uuid" "dolibarr_id" { # used for encryption as well as when buying modules
lifecycle {
prevent_destroy = true
}
}
resource "vault_kv_secret_v2" "dolibarr_admin_setup" {
mount = module.app_roles.mount_paths.kvv2
name = format("%sconfig", module.app_roles.kvv2_path_prefix)
data_json = jsonencode(
{
DOLI_ADMIN_LOGIN = "admin",
DOLI_ADMIN_PASSWORD = random_password.admin_initial_password.result
DOLI_INSTANCE_UNIQUE_ID = random_uuid.dolibarr_id.result
}
)
}