fix: misc adjustments

main
Ricard Illa 2023-07-05 12:43:44 +02:00
parent 0996da06be
commit 6054b2c6a9
4 changed files with 19 additions and 16 deletions

View File

@ -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}}

14
main.tf
View File

@ -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" {

View File

@ -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

View File

@ -7,7 +7,7 @@ terraform {
}
}
resource "minio_s3_bucket" "state_terraform_s3" {
resource "minio_s3_bucket" "terraform_bucket" {
bucket = "terraform"
acl = "private"
}