From 6054b2c6a98973b695d98919fbe91dfb50868a66 Mon Sep 17 00:00:00 2001 From: Ricard Illa Date: Wed, 5 Jul 2023 12:43:44 +0200 Subject: [PATCH] fix: misc adjustments --- justfile | 5 +++-- main.tf | 14 ++++++++------ modules/minio/main.tf | 14 +++++++------- modules/minio_buckets/main.tf | 2 +- 4 files changed, 19 insertions(+), 16 deletions(-) diff --git a/justfile b/justfile index 753cf4a..9ba146d 100644 --- a/justfile +++ b/justfile @@ -7,10 +7,11 @@ export VULTR_API_KEY := `pass vultr.com/api_key` export HETZNER_DNS_API_TOKEN := `pass hetzner.com/tokens/terraform` export MINIO_PASSWORD := `pass minio.monotremata.xyz/terraform` -init: +init *ARGS: terraform init \ -backend-config="access_key=terraform" \ - -backend-config="secret_key=$MINIO_PASSWORD" + -backend-config="secret_key=$MINIO_PASSWORD" \ + {{ARGS}} plan *ARGS: terraform plan {{ARGS}} diff --git a/main.tf b/main.tf index 54782b2..5746bb2 100644 --- a/main.tf +++ b/main.tf @@ -9,6 +9,7 @@ terraform { skip_metadata_api_check = true skip_region_validation = true } + required_providers { kubernetes = { source = "hashicorp/kubernetes" @@ -102,12 +103,13 @@ module "vps" { } module "minio" { - source = "./modules/minio" - minio_root_user = var.minio_root_user - minio_root_password = var.minio_root_password - minio_url = "minio.monotremata.xyz" - minio_console_url = "minio-console.monotremata.xyz" - minio_host_path = "/mnt/k3s_volumes/minio" + source = "./modules/minio" + minio_storage_capacity = "200Gi" + minio_root_user = var.minio_root_user + minio_root_password = var.minio_root_password + minio_url = "minio.monotremata.xyz" + minio_console_url = "minio-console.monotremata.xyz" + minio_host_path = "/mnt/k3s_volumes/minio" } module "minio_buckets" { diff --git a/modules/minio/main.tf b/modules/minio/main.tf index a1bceed..a4d58b5 100644 --- a/modules/minio/main.tf +++ b/modules/minio/main.tf @@ -15,29 +15,29 @@ resource "kubernetes_namespace" "minio_namespace" { } # terraform import module.minio.kubernetes_persistent_volume.minio-pv minio-pv -resource "kubernetes_persistent_volume" "minio-pv" { +resource "kubernetes_persistent_volume" "minio-storage-pv" { metadata { - name = "minio-pv" + name = "minio-storage-pv" } spec { capacity = { storage = var.minio_storage_capacity } access_modes = ["ReadWriteOnce"] storage_class_name = "local" persistent_volume_source { - host_path { path = var.minio_host_path } + host_path { path = format("%s/storage", var.minio_host_path) } } } } # terraform import module.minio.kubernetes_persistent_volume_claim.minio-pvc minio/minio-pvc -resource "kubernetes_persistent_volume_claim" "minio-pvc" { +resource "kubernetes_persistent_volume_claim" "minio-storage-pvc" { metadata { - name = "minio-pvc" + name = "minio-storage-pvc" namespace = kubernetes_namespace.minio_namespace.metadata[0].name } spec { storage_class_name = "local" - volume_name = kubernetes_persistent_volume.minio-pv.metadata[0].name + volume_name = kubernetes_persistent_volume.minio-storage-pv.metadata[0].name access_modes = ["ReadWriteOnce"] resources { requests = { storage = var.minio_storage_capacity } @@ -121,7 +121,7 @@ resource "kubernetes_deployment" "minio-deployment" { volume { name = "storage" persistent_volume_claim { - claim_name = kubernetes_persistent_volume_claim.minio-pvc.metadata[0].name + claim_name = kubernetes_persistent_volume_claim.minio-storage-pvc.metadata[0].name } } automount_service_account_token = false diff --git a/modules/minio_buckets/main.tf b/modules/minio_buckets/main.tf index 45955be..546dac6 100644 --- a/modules/minio_buckets/main.tf +++ b/modules/minio_buckets/main.tf @@ -7,7 +7,7 @@ terraform { } } -resource "minio_s3_bucket" "state_terraform_s3" { +resource "minio_s3_bucket" "terraform_bucket" { bucket = "terraform" acl = "private" }