From da23af464fe0e3d53be597a814abc5f85f91e560 Mon Sep 17 00:00:00 2001 From: Tung Bui Date: Tue, 13 Aug 2024 23:42:05 +0700 Subject: [PATCH 1/2] Add terraform cmds --- README.md | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/README.md b/README.md index 7ff398e..ed1b60b 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,7 @@ This repository is a collection of the most commonly used command-line commands - [Kubernetes Commands](#kubernetes-commands) - [Helm Commands](#helm-commands) - [Ansible Commands](#ansible-commands) +- [Terraform Commands](#terraform-commands) --- @@ -281,3 +282,42 @@ ansible-playbook playbook.yml -vvv ``` [Back to top 🔝](#cli-commands-reference) + +## Terraform Commands + +```bash +# Initialize a Terraform configuration directory +terraform init + +# Plan the changes required by the Terraform configuration +terraform plan + +# Create a Terraform execution plan and save it to a file (recommended) +terraform plan -out=tfplan.out + +# Apply the changes required by the Terraform configuration +terraform apply + +# Apply the changes automatically (use with your own risk, suitable for automation tasks) +terraform apply --auto-aprove + +# Destroy all the resources managed by Terraform +terraform destroy + +# Validate the Terraform configuration files +terraform validate + +# Format Terraform configuration files +terraform fmt + +# Show the current state of Terraform-managed infrastructure +terraform show + +# Refresh the state file with the real infrastructure +terraform refresh + +# List the available Terraform providers +terraform providers +``` + +[Back to top 🔝](#cli-commands-reference) From 6d38edeb14f2e8ba688ca2f77e2f5c3ae328c43d Mon Sep 17 00:00:00 2001 From: Tung Bui Date: Tue, 13 Aug 2024 23:43:15 +0700 Subject: [PATCH 2/2] Add terraform cmds.1 --- README.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index ed1b60b..104b82f 100644 --- a/README.md +++ b/README.md @@ -292,12 +292,15 @@ terraform init # Plan the changes required by the Terraform configuration terraform plan -# Create a Terraform execution plan and save it to a file (recommended) -terraform plan -out=tfplan.out - # Apply the changes required by the Terraform configuration terraform apply +# Create a Terraform execution plan and save it to a file (recommended) +terraform plan -out="tfplan.out" + +# Apply the changes from saved plan +terraform apply "tfplan.out" + # Apply the changes automatically (use with your own risk, suitable for automation tasks) terraform apply --auto-aprove