diff --git a/bin/terraform.sh b/bin/terraform.sh deleted file mode 100755 index ff7874d..0000000 --- a/bin/terraform.sh +++ /dev/null @@ -1,74 +0,0 @@ -#!/bin/sh - -NS=terraforms -TF_VARS_SECRET=homelab-tfvars -TFVAR_FILE_NAME=var.auto.tfvars.json -LOCAL_TF_VARS=./terraform/$TFVAR_FILE_NAME - -save_tfvars() { - echo "$LOCAL_TF_VARS ... > kubectl -n $NS create secret/$TF_VARS_SECRET" - kubectl -n $NS create secret generic $TF_VARS_SECRET \ - --save-config \ - --dry-run=client \ - --from-file=var.auto.tfvars.json=$LOCAL_TF_VARS \ - -o yaml | kubectl apply -f - -} - -get_tfvars() { - echo "kubectl -n $NS get secret/$TF_VARS_SECRET ... > $LOCAL_TF_VARS" - kubectl -n $NS get secret/$TF_VARS_SECRET \ - -o jsonpath="{.data['var\.auto\.tfvars\.json']}" \ - | base64 -d > $LOCAL_TF_VARS -} - -plan() { - pushd ./terraform || exit 1 - terraform plan -} - -apply() { - pushd ./terraform || exit 1 - save_tfvars - terraform apply -} - -init() { - pushd ./terraform || exit 1 - get_tfvars - terraform init -} -help() { - echo "My Awesome Terraform Wrapper!" - echo "" - echo " a|apply) apply terraform in ./terraform folder" - echo " p|plan) plan terraform in ./terraform folder" - echo " i|init) download latest tfvars and init ./terraform folder" - echo " s|save-tfvars) save tfvars to k8s ns" - echo " g|get-tfvars) downloads tfvars from k8s ns" - echo " h|help) display this help" - echo "" -} -case $1 in - a|apply) - apply - ;; - p|plan) - plan - ;; - i|init) - init - ;; - s|save-tfvars) - save_tfvars - ;; - g|get-tfvars) - get_tfvars - ;; - h|help) - help - ;; - *) - echo "invalid input '$1'!" - help - ;; -esac \ No newline at end of file diff --git a/modules.tf b/modules.tf index b393f0e..6035b9a 100644 --- a/modules.tf +++ b/modules.tf @@ -1,21 +1,21 @@ -resource "helm_release" "local-chart-infrastructure" { - name = "infrastructure" - chart = "charts/infrastructure" - namespace = "default" - set = [{ - name = "ns.metallb" - value = module.k8s-helm-charts.namespaces.plugins.metallb - }] - values = [file("./values.yaml")] - timeout = 120 - force_update = true -}` +# resource "helm_release" "local-chart-infrastructure" { +# name = "infrastructure" +# chart = "charts/infrastructure" +# namespace = "default" +# set = [{ +# name = "ns.metallb" +# value = module.k8s-helm-charts.namespaces.plugins.metallb +# }] +# values = [file("./values.yaml")] +# timeout = 120 +# force_update = true +# }` -module "k8s-helm-charts" { - source = "./tf-modules/k8s-helm-charts" -} +# module "k8s-helm-charts" { +# source = "./tf-modules/k8s-helm-charts" +# } -output "ns" { - value = module.k8s-helm-charts.namespaces -} +# output "ns" { +# value = module.k8s-helm-charts.namespaces +# } diff --git a/provider.tf b/provider.tf index 4b485e1..cc44319 100644 --- a/provider.tf +++ b/provider.tf @@ -21,13 +21,19 @@ terraform { } cloudflare = { source = "cloudflare/cloudflare" - version = "5.1.0" + version = "5.2.0" } } } -provider "helm" {} -provider "kubernetes" {} +provider "helm" { + kubernetes { + config_context = "homelab" + } +} +provider "kubernetes" { + config_context = "homelab" +} provider "http" {} provider "cloudflare" { api_token = var.cloudflare.api_token