Terraform Workflow

Learn how Terraform is invoked to read files and perform the required tasks.

The Terraform workflow (init —> plan —> apply)

In the previous section, you learned all about variables, main configurations, and metadata in TFSTATE files. As is, you’ve just built a bunch of text files. The real goal here is to create some resources! You need to invoke Terraform to read the files and get stuff done.

Initialization

Let’s assume you’ve already created some configuration files in a directory. Perhaps you’ve got a main.tf, a variables.tf, and a terraform.tfvars file inside there. You now need to tell Terraform that this directory has a set of configuration files in it. To do that, you will run terraform init. The init argument reads each configuration file and checks to see which providers you’ve chosen to use. It then downloads instructions for each provider.

Get hands-on with 1400+ tech skills courses.