Skip to content
Merged
Changes from all 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
17 changes: 17 additions & 0 deletions lib/terraform/Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,20 @@ tasks:
msg: "Variables file does not exist: {{.TFVARS_FILE}}"
cmds:
- terraform apply -var-file {{.TFVARS_FILE}} {{.TF_ARGS}}

refresh:
desc: Refresh the Terraform state to match the real-world infrastructure (safer via apply -refresh-only).
summary: |
Refreshes the Terraform state for a specified environment, using a file to load the variables.
Note: Upstream deprecates `terraform refresh`; use `terraform apply -refresh-only` to review changes before writing state.
Requires a variables file specific to the environment to be present.
Usage: task terraform:refresh -- ENVIRONMENT [terraform apply -refresh-only arguments]
Example: task terraform:refresh -- automation
dir: "{{.USER_WORKING_DIR}}"
silent: true
vars: *vars
preconditions:
- sh: test -f {{.TFVARS_FILE}}
msg: "Variables file does not exist: {{.TFVARS_FILE}}"
cmds:
- terraform apply -refresh-only -var-file {{.TFVARS_FILE}} {{.TF_ARGS}}