• Skip to main content
  • Skip to header right navigation
  • Skip to site footer

Roger Perkin

Learn Network Automation

  • Network Automation
    • Ansible Network Automation
      • Ansible Hosts File
      • What is Ansible?
    • Python Network Automation
      • Python for Network Engineers
    • Python Tutorial for Beginners
    • Terraform
    • pyATS
    • Docker
    • GIT
  • Cisco
    • ISE
    • SD WAN Training
    • Password Recovery
    • Software-Upgrade-Guides
    • BGP
    • Data Center
    • WIRELESS
  • CCIE
  • Blog
  • About
    • My Red Special Guitar
  • COURSES

Terraform Tutorial

Home » Network Automation » Terraform

Terraform Tutorial for Beginners

Terraform is an open-source infrastructure as code software tool created by Hashicorp. Used to define and provision infrastructure using a declaritive configuration language know as Hashicorp Configuration Language (HCL) or JSON – https://en.wikipedia.org/wiki/Terraform_(software)

Infrastructure as Code

Infrastructure as code is the concept of managing your infrastructure in a single file or files that define how you want your infrastructure to look like. i.e if you want to provision 50 servers in AWS with certain sizes and functions and different networking, firewalls and load balancers etc. You could go in to the AWS console and provision these one at a time by hand, or you could define everything in a single file which via Terraform (or another cloud provisioning tool) push these changes to AWS.

Having all the infrastructure defined in this one file means you can enforce state and ensure your infrastructure is always configured correctly.

This file or files can now be version controlled with something like Git so you can roll back any changes and you have full visibility of anything that is happening to your infrastructure.

This is the basic concept of Infrastructure as Code or IaC.

Terraform’s Purpose

Terraform is a multi platform tool that can take these files and make the connections to different infrastructure and push the changes requested or deletions.

It is mainly focused on cloud environments, but can also provision networking resources like Cisco ACI F5 load balancers or ASAv firewalls.

Check out my post – Terraform vs Ansible – a comparison which is commonly made

Terraform Providers

Terraform works on the concept of Providers.

A provider is code that understands how to interact with a certain infrastructure. i.e if you wanted to provision an EC2 resource in AWS you don’t need to know how to code the API to interact with the AWS console, you simply add the AWS provider into your file, Terraform downloads the correct code when you set everything up and then you just enter your access credentials.

A full list of Terraform providers can be found on the Registry.
https://registry.terraform.io/browse/providers

Terraform Resources

Resources are the most important part of the Terraform language, they describe each and every part of an infrastructure.

A resource block declares a resource with a local name.

In the example below the resource is aws_instance and the local name is web.

resource "aws_instance" "web" {
  ami           = "ami-a1b2c3d4"
  instance_type = "t2.micro"
}

Terraform Modules

Modules allow you to group multiple resources together.

So you can put multiple resources together and package them into a module and then call that module.

It’s the same concept as packages in Python.

Terraform Variables

Input variables allow you to feed in parameters to a Terraform module.

Terraform Workspaces

Workspaces function like separate working directories and a workspace contains everything Terraform needs to manage a collection of infrastructure.

Terraform Cloud manages infrastructure collections with workspaces instead of directories.

Terraform Enterprise

Enterprise is a self-hosted version of Terraform Cloud. It allows enterprises to run a private instance of the Terraform Cloud application.

The main benefit is security, audit logging and no resource limits

Terraform Certification

Once you have got the basics under your belt you might want to get HashiCorp certified to prove your knowledge of the product.

The Terraform Associate exam is the starting point: https://www.hashicorp.com/certification/terraform-associate

There are some great free learning resources here: https://www.hashicorp.com/certification/terraform-associate

If you just want to learn more about Terraform there are many tutorials here: https://learn.hashicorp.com/terraform

Terraform Books

One of the best books to learn Terraform is “Terraform up and running” by Yevgeniy Brikma, Second Edition published by Oreily

So get started and download Terraform and start your journey into Infrastructure as Code with Terraform!

Page Contents

  • Terraform Tutorial for Beginners
  • Infrastructure as Code
  • Terraform’s Purpose
  • Terraform Providers
  • Terraform Resources
  • Terraform Modules
  • Terraform Variables
  • Terraform Workspaces
  • Terraform Enterprise
  • Terraform Certification
  • Terraform Books
Category: Terraform
Previous Post: « How to install Ansible AWX
Next Post: Netmiko python logo »

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Sidebar

Hi I'm Roger Perkin,
Based in the UK working as a Technical Architect focussed on Network Automation CCIE #50038
About Roger | Twitter | Linkedin

Recent Posts

  • How to install VMWare tools on Ubuntu 20.04
  • Ansible Tutorial for Beginners with Playbook Example
  • Hashicorp Vault Tutorial
  • Ansible Tower vs Ansible Automation Platform
  • Cisco Certified DevNet Expert Getting Started Guide

Topics

Network Automation
Ansible
Python for Network Automation
CCIE
Cisco ISE
F5 Certification
BGP
OSPF

Git for Network Engineers

Ansible vs Nornir

Start learning today with my Network Automation Courses

Master Ansible, Python, Git, Nornir, Jenkins and more..


Buy me a coffeeBuy me a coffee

ansible training course

Have you seen my YouTube Channel?

YouTube Subscribe

Let’s get started

Take a look at my premium courses on Ansible, Nornir & Git or buy them all with the Network Automation Bundle!

Network Automation Courses

Navigation

Home

Blog

About

Contact

Network Tools

Python VENV Tutorial

Contact

Get in touch with me here

[email protected]

  • Facebook
  • Instagram
  • Twitter
  • LinkedIn
  • YouTube
Buy me a coffeeBuy me a coffee

YouTube

Don’t forget to take a look at my YouTube Channel

youtube button

Tech

Best Vertical Mouse for RSI

Copyright © 2022 · Roger Perkin · All Rights Reserved · Powered by Mai Theme