Ravindra BagaleCourses & study guides मराठी

Ravi Sir's Cards › DevOps

Chapter 38: Terraform CLI Commands fmt validate plan apply state and more: Cards

मराठी cards · Open the chapter

Revision cards

fmt and validate: the free checks. Small mistakes waste a full plan or a review round. Two free commands catch them in seconds.
Revision card 1 of 7: fmt and validate: the free checks · Download PNG · Open card page

Lesson: 38.1 fmt and validate — the free checks

plan, show and saved plan files. If you plan, wait, then run apply again, the cloud may have changed, and apply may do something different from what was reviewed.
Revision card 2 of 7: plan, show and saved plan files · Download PNG · Open card page

Lesson: 38.2 plan, show and saved plan files

apply, destroy, and why -target is an emergency tool. -target applies only one resource. It skips the rest, so state and code can stay out of sync.
Revision card 3 of 7: apply, destroy, and why -target is an emergency tool · Download PNG · Open card page

Lesson: 38.3 apply and destroy — and why -target is an emergency tool

state list, show, mv and rm. Sometimes you must look inside state or repair it. Editing the JSON file by hand can corrupt it.
Revision card 4 of 7: state list, show, mv and rm · Download PNG · Open card page

Lesson: 38.4 state list, show, mv and rm

terraform output: read results from state. Scripts and people need values like URLs and IPs without opening the console.
Revision card 5 of 7: terraform output: read results from state · Download PNG · Open card page

Lesson: 38.5 output — read results from state

taint versus -replace. Sometimes a resource is broken inside but its code has not changed, so Terraform sees nothing to do.
Revision card 6 of 7: taint versus -replace · Download PNG · Open card page

Lesson: 38.6 taint versus -replace

refresh-only and graph. When people change things outside Terraform, you need to see the difference without changing anything.
Revision card 7 of 7: refresh-only and graph · Download PNG · Open card page

Lesson: 38.7 refresh-only and graph

Interview cards

What do terraform fmt and terraform validate check? fmt fixes formatting: indentation and alignment. validate checks the code itself: syntax, argument names, types and references. Neither calls AWS.
Interview card 1 of 7: What do terraform fmt and terraform validate check? · Download PNG · Open card page

Lesson: 38.1 fmt and validate — the free checks

Why save a plan with -out before applying in CI? A saved plan file records exact changes. terraform apply tfplan applies only those changes. Without it, apply makes a new plan, which may differ if code or cloud changed.
Interview card 2 of 7: Why save a plan with -out before applying in CI? · Download PNG · Open card page

Lesson: 38.2 plan, show and saved plan files

Why is terraform apply -target risky? -target applies only the named resource and its dependencies. Other changes in code are skipped, so code and state stay out of sync, and the next full plan can surprise you.
Interview card 3 of 7: Why is terraform apply -target risky? · Download PNG · Open card page

Lesson: 38.3 apply and destroy — and why -target is an emergency tool

What does terraform state rm do? state rm removes a resource from Terraform’s state only. The real resource keeps running in the cloud, but Terraform no longer manages it.
Interview card 4 of 7: What does terraform state rm do? · Download PNG · Open card page

Lesson: 38.4 state list, show, mv and rm

How do scripts read Terraform outputs? terraform output -raw name prints one value without quotes, good for shell. -json prints all outputs as JSON for tools. Both read from state, with no plan.
Interview card 5 of 7: How do scripts read Terraform outputs? · Download PNG · Open card page

Lesson: 38.5 output — read results from state

What replaced terraform taint, and why? terraform apply -replace=ADDRESS replaced taint. taint marked state immediately, without review; -replace shows the replacement in a plan first.
Interview card 6 of 7: What replaced terraform taint, and why? · Download PNG · Open card page

Lesson: 38.6 taint versus -replace

What is terraform plan -refresh-only used for? It shows how the real cloud differs from the state, without proposing changes to resources. apply -refresh-only then saves the real values into state.
Interview card 7 of 7: What is terraform plan -refresh-only used for? · Download PNG · Open card page

Lesson: 38.7 refresh-only and graph

Comparison cards

terraform fmt vs terraform validate. fmt: formats Terraform files to the standard style.validate: checks the code is valid (syntax, names, types).
Comparison card 1 of 3: terraform fmt vs terraform validate · Download PNG · Open card page

Lesson: Chapter 38: Terraform CLI Commands fmt validate plan apply state and more

terraform taint vs -replace. Both force Terraform to recreate one resource.taint: old command that marks state.-replace: an option on plan and apply.
Comparison card 2 of 3: terraform taint vs -replace · Download PNG · Open card page

Lesson: Chapter 38: Terraform CLI Commands fmt validate plan apply state and more

refresh-only vs normal apply. apply -refresh-only: copies real cloud values into state.normal apply: changes real resources to match the code.
Comparison card 3 of 3: refresh-only vs normal apply · Download PNG · Open card page

Lesson: Chapter 38: Terraform CLI Commands fmt validate plan apply state and more