💾 Archived View for ibannieto.info › stuff › terraform.gmi captured on 2023-06-14 at 14:06:30. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2023-03-20)

-=-=-=-=-=-=-

ibannieto's capsule

Home

Terraform

Initialize:

terraform init

Plan:

terraform plan

Apply (with review, interactive):

terraform apply

Apply without approval (non interactive):

terraform apply --auto-approve

Write a plan for review:

terraform plan -out=plan.out

Format terraform files:

terraform fmt

Format all terraform files inside this directory:

terraform fmt --recursive myproject/

Validate files:

terraform validate

Run terraform tests with terratest:

terratest

Run infrastructure tests with checkov:

checkov -d

Run dependency graph UI with rover:

rover -tfPath /usr/bin/terraform -tfVarsFile ${TERRAFORM_VARS_FILE} -tfVar AWS_REGION=eu-west-1

Terraform graph using dot:

terraform graph -plan=plan.out

Check drifting between your infrastructure and your code:

drifctl

Run security tests with tfsec:

tfsec .

Destroy the current project by removing all resources described in the code (CAUTION):

terraform destroy

Clean your terraform cache inside your project:

rm -rf .terraform

AWS

GCP

Tips

Back