First commit

This commit is contained in:
2025-01-27 17:26:43 -06:00
commit bedae897ca
9 changed files with 84 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
**/*.auto.tfvars

0
README.md Normal file
View File

0
config.tf Normal file
View File

View File

@@ -0,0 +1,22 @@
global:
defaultStorageClass: standard
postgresql:
auth:
username: ${postgres_user}
password: ${postgres_password}
primary:
extraEnvVars:
- name: VELA_USER
value: ${vela_user}
- name: VELA_PASSWORD
value: ${vela_password}
initdb:
scripts:
user: ${postgres_user}
password: ${postgres_password}
db_init_script.sh: |
PGPASSWORD=$${POSTGRES_PASSWORD} psql -U $${POSTGRES_USER} <<-END
CREATE USER $${VELA_USER} WITH PASSWORD '$${VELA_PASSWORD}';
SELECT 'CREATE DATABASE vela WITH OWNER $${VELA_USER}' WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = 'vela')\gexec
GRANT ALL PRIVILEGES ON DATABASE vela TO $${VELA_USER};
END

0
main.tf Normal file
View File

15
postgres.tf Normal file
View File

@@ -0,0 +1,15 @@
resource "helm_release" "postgresql" {
name = "postgresql"
repository = "https://charts.bitnami.com/bitnami"
chart = "postgresql"
namespace = "default"
create_namespace = false
version = "15.5.23"
values = [templatefile("${path.module}/helm_values/postgresql.yaml", {
postgres_user = "${var.POSTGRES_USER}"
postgres_password = "${var.POSTGRES_PASSWORD}"
vela_user = "${var.VELA_USER}"
vela_password = "${var.VELA_PASSWORD}"
})]
}

16
providers.tf Normal file
View File

@@ -0,0 +1,16 @@
provider "helm" {
kubernetes {
config_path = "~/.kube/config"
config_context = "minikube"
}
}
provider "kubectl" {
config_path = "~/.kube/conifg"
config_context = "minikube"
}
provider kubernetes {
config_path = "~/.kube/config"
config_context = "minikube"
}

15
terraform.tf Normal file
View File

@@ -0,0 +1,15 @@
terraform {
required_providers {
helm = {
source = "hashicorp/helm"
}
kubectl = {
source = "gavinbunney/kubectl"
}
kubernetes = {
source = "hashicorp/kubernetes"
}
}
}

15
variables.tf Normal file
View File

@@ -0,0 +1,15 @@
variable "POSTGRES_USER" {
type = string
}
variable "POSTGRES_PASSWORD" {
type = string
}
variable "VELA_USER" {
type = string
}
variable "VELA_PASSWORD" {
type = string
}