This chapter will go over some basic of Terraform introducing the learner to key concepts
Terraform Best Practices: https://www.terraform-best-practices.com/
terraform init
to initialize your project and pull latest providers and
modulesterraform plan
to generate output of planned changes which you may optionally
saveterraform validate
to ensure that types and values are presents and that
required attributes are presentterraform apply
to execcute and provision the infrastructure from the plan
created in the previous commandterraform destroy
to destroy remote infrastructureUsage: terraform [global options] <subcommand> [args]
The available commands for execution are listed below.
Main commands:
init Prepare your working directory for other commands
validate Check whether the configuration is valid
plan Show changes required by the current configuration
apply Create or update infrastructure
destroy Destroy previously-created infrastructure
Global options (use these before the subcommand, if any):
-chdir=DIR Switch to a different working directory before executing the
given subcommand.
-help Show this help output, or the help for a specified subcommand.
-version An alias for the "version" subcommand.
Terraform uses Change Automation in the form of Execution Plans and Resources Graphs to apply and review complex ChangeSets
What is Change Management?
What is Change Automation?
An Execution Plan is a manual review of what resources will be add, changed, or
destroyed before you apply changes. [terraform apply
]
Usage: terraform [global options] apply [options] [PLAN]
Creates or updates infrastructure according to Terraform configuration
files in the current directory.
By default, Terraform will generate a new plan and present it for your
approval before taking any action. You can optionally provide a plan
file created by a previous call to "terraform plan", in which case
Terraform will take the actions described in that plan without any
confirmation prompt.
You can visualize the execution plan using the terraform graph
command, which
will output a GraphViz file. This will show you the relationships between all of
the planned infrastructure in your configuration.
terraform graph | dot - Tsvg > graph.svg