deploy dolibarr

This commit is contained in:
2024-11-05 01:21:24 +01:00
parent 83b36bafc9
commit 5c08cc9cfd
26 changed files with 791 additions and 0 deletions

6
iac/backend.tf Normal file
View File

@@ -0,0 +1,6 @@
terraform {
backend "gcs" {
bucket = "arcodange-tf"
prefix = "erp/main"
}
}

32
iac/main.tf Normal file
View File

@@ -0,0 +1,32 @@
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
}
)
}

16
iac/providers.tf Normal file
View File

@@ -0,0 +1,16 @@
terraform {
required_providers {
vault = {
source = "vault"
version = "4.4.0"
}
}
}
provider vault {
address = "https://vault.arcodange.duckdns.org"
auth_login_jwt { # TERRAFORM_VAULT_AUTH_JWT environment variable
mount = "gitea_jwt"
role = "gitea_cicd_erp"
}
}