Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ includes:
mixins: lib/mixins
os: lib/os-modules
snaplet: lib/snaplet
terraform:
taskfile: lib/terraform
aliases: [tf]
tf:
taskfile: lib/tf
toolbox: lib/toolbox

tasks: {}
10 changes: 5 additions & 5 deletions aqua.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---
registries:
- type: standard
ref: v4.78.0 # renovate: depName=aquaproj/aqua-registry
ref: v4.433.0 # renovate: depName=aquaproj/aqua-registry
packages:
- name: go-task/task@v3.31.0
- name: TomWright/dasel@v2.4.1
- name: stedolan/jq@jq-1.7.1
- name: go-task/task@v3.45.4
- name: TomWright/dasel@v2.8.1
- name: stedolan/jq@jq-1.8.1
tags: [cursor]
- name: cli/cli@v2.74.2
- name: cli/cli@v2.83.0
tags: [gh]
10 changes: 6 additions & 4 deletions lib/terraform/Taskfile.yml → lib/tf/Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ tasks:
sh: echo "{{.BACKEND_CONFIG_PATH}}/{{.ENV}}.backend.tf"
TFVARS_FILE:
sh: echo "{{.TFVARS_PATH}}/{{.ENV}}.tfvars"
TF_CMD:
sh: '[ "${USE_TERRAFORM}" = "true" ] && echo "terraform" || echo "tofu"'

init:
desc: Initialize Terraform working directory with a backend configuration file.
Expand All @@ -39,7 +41,7 @@ tasks:
- sh: test -f {{.BACKEND_CONFIG_FILE}}
msg: "Backend configuration file does not exist: {{.BACKEND_CONFIG_FILE}}"
cmds:
- terraform init -backend-config {{.BACKEND_CONFIG_FILE}} {{.TF_ARGS}}
- "{{.TF_CMD}} init -backend-config {{.BACKEND_CONFIG_FILE}} {{.TF_ARGS}}"

plan:
desc: Generate a Terraform execution plan Terraform loading variable values from the given file.
Expand All @@ -56,7 +58,7 @@ tasks:
- sh: test -f {{.TFVARS_FILE}}
msg: "Variables file does not exist: {{.TFVARS_FILE}}"
cmds:
- terraform plan -var-file {{.TFVARS_FILE}} {{.TF_ARGS}}
- "{{.TF_CMD}} plan -var-file {{.TFVARS_FILE}} {{.TF_ARGS}}"

apply:
desc: Create or update infrastructure according to Terraform configuration files in the current directory.
Expand All @@ -73,7 +75,7 @@ tasks:
- sh: test -f {{.TFVARS_FILE}}
msg: "Variables file does not exist: {{.TFVARS_FILE}}"
cmds:
- terraform apply -var-file {{.TFVARS_FILE}} {{.TF_ARGS}}
- "{{.TF_CMD}} apply -var-file {{.TFVARS_FILE}} {{.TF_ARGS}}"

refresh:
desc: Refresh the Terraform state to match the real-world infrastructure (safer via apply -refresh-only).
Expand All @@ -90,4 +92,4 @@ tasks:
- sh: test -f {{.TFVARS_FILE}}
msg: "Variables file does not exist: {{.TFVARS_FILE}}"
cmds:
- terraform apply -refresh-only -var-file {{.TFVARS_FILE}} {{.TF_ARGS}}
- "{{.TF_CMD}} apply -refresh-only -var-file {{.TFVARS_FILE}} {{.TF_ARGS}}"