2. First steps

First Steps

Start your IDE in an empty project directory and launch a UNIX shell.

The upcoming labs will always refer to the root folder of your exercises. Store it in an environment variable to access it quicker:

export LAB_ROOT=`pwd`

Now create a new directory:

mkdir $LAB_ROOT/first_steps
cd $LAB_ROOT/first_steps

Create a new file named main.tf in your working directory and paste the following:

output "hello" {
  value = "Hello Terraform!"
}

Now run the commands

terraform init
terraform apply

Terraform asks for your confirmation, enter yes:

...
Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

Well done! You created your first “Hello World!” in Terraform.
The next chapters will explain what we’ve actually just done here - let’s move on!