IT 3110 : DevOps Automation


Terraform Intro

See this video - here

What is infrastructure as code?

Advantages of Terraform


See the page here

You want to make sure that you follow the video or manual instructions so that you get the latest version of terraform. (If you install from ubuntu repo, it will be outdated).

To enable auto tab completion:

More about AWS management

Create a ~/.aws/credentials file. If you read the section of your account details (from aws educate), it says to copy and paste stuff into that file.

create a terraform configuration file

I had to make sure that my config file was:

Config file explained

Config file explained (Providers)

Config file explained

The format is generally:

   resource "provider-type" "name" {

Terraform commands



Change state


More examples

Terraform expressions

In the previous example, we had to attach the sg to the instance, but at creation time we don’t actually know the id’s for any of these. An expression allows us to select the approprate sg by accessing other parts of your code.

A resource attribute reference is a type of expression that we used in the example <Provider>_<type>.<name>.<attribute>. In the example it was,

Best practice

Check your tf files into git… but not any credentials.