Sling Academy
Home/DevOps/Terraform Tutorials

Terraform Tutorials


Terraform is an open-source infrastructure as code software tool created by HashiCorp. It allows users to define and provision data center infrastructure using a high-level configuration language known as HashiCorp Configuration Language (HCL), or optionally JSON. Terraform manages external resources (such as public cloud infrastructure, private cloud infrastructure, network appliances, software as a service, and more) with a ‘plan and apply’ model, automating the deployment and maintenance of infrastructure through code.

By enabling infrastructure to be expressed as code, Terraform facilitates automation, versioning, and collaboration. It tracks state and manages dependencies between resources to ensure that infrastructure is deployed in a predictable and reliable manner. Terraform supports multiple cloud providers, allowing for efficient management of cross-cloud resources through a single workflow.

This series of tutorials helps you learn Terraform from basic to advanced, from the surface to the deep ground.

1 What is Infrastructure as Code (IaC)?

2 What is Terraform and how does it work?

3 When NOT to use Terraform (and what to use instead)

4 3 ways to install Terraform on Windows

5 3 ways to install Terraform on Mac

6 Methods to Install Terraform on Ubuntu

7 How to execute Terraform in a Docker container

8 Terraform CLI commands: The complete cheat sheet

9 3 ways to switch between different versions of Terraform

10 How to upgrade Terraform provider versions

11 Terraform & AWS: Deploying a Single Server

12 Terraform & AWS: How to deploy a cluster of web servers

13 Terraform: How to add alias to a provider

14 Terraform: Managing multiple environments (dev, staging, production)

15 Terraform: Store and retrieve secrets the right way (4 approaches)

16 Terraform: How to manipulate variables

17 How to use local variables to simplify your Terraform code

18 How to use outputs to expose Terraform provisioned resources

19 Using YAML with Terraform: A Practical Guide (with examples)

20 How to write conditional logic in Terraform

21 How to generate random values in Terraform

22 Terraform: How to generate passwords

23 Terraform & AWS: How to deploy a load balancer

24 Terraform: Understanding State and State Files (with Examples)

25 Understanding terraform_remote_state data source: Explained with examples

26 Terraform Module Inputs and Outputs: A Complete Guide (with examples)

27 Terraform Module Loading: How to load modules from different sources

28 3 ways to use loops in Terraform (with examples)

29 Terraform: How to achieve zero-downtime deployments

30 Using ‘count’ in Terraform to create multiple resources

31 What are plan, apply, and destroy in Terraform?

32 Using Plan Files in Terraform: A Practical Guide

33 Terraform: How to work with multiple AWS regions and availability zones

34 Terraform: How to work with multiple AWS accounts

35 Terraform: How to work with multiple different cloud providers

36 Terraform Production-Grade Infrastructure Modules: A Complete Guide

37 Terraform: How to write unit tests for your infrastructure code

38 Terraform: How to perform integration tests

39 Terraform Workflow for Teams: A Complete Guide

40 Do I have to learn Terraform to get a DevOps job?

41 How to manage Terraform resource dependencies

42 Understanding precondition checks in Terraform

43 Working with postcondition checks in Terraform

44 Using maps in Terraform: A complete guide

45 How to iterate over a map in Terraform

46 How to filter a map in Terraform

47 Terraform: How to execute shell/bash scripts

48 Terraform: How to sync files and folders

49 How to share a Terraform module with the community (GitHub, Terraform Registry)

50 How to add comments to your Terraform code

51 How to use Terraform module generator tools

52 How to auto generate Terraform documentation

53 Using Terraform with Kubernetes: A Practical Guide

54 Terraform: How to prevent accidental deletion of resources

55 How to use Terraform templates

56 How to use Terragrunt to manage Terraform config

57 Using Rover to visualize Terraform resource dependencies

58 Using Terraform and GitHub Actions for CI/CD pipelines

59 Terraform: Working with the terraform_login command

60 Terraform: How to generate SSH keys

61 Terraform: How to generate self-signed SSL certificates

62 Terraform Error: The provider ‘aws’ does not support resource type ‘aws_instance’

63 Terraform: How to trigger a Lambda function on resource creation

64 Terraform Error – MalformedPolicyDocument: Has prohibited field Resource

65 Using Terraform ‘state list’ command to list resources

66 Terraform: Using ‘state show’ command to show resource details

67 Terraform: How to update the lock file

68 How to use environment variables in Terraform

69 Terraform: Caching plan files for faster deployments

70 Terraform: How to find the index of an element in a list

71 Terraform: How to find the Min/Max value in a list

72 Terraform: 3 ways to round a number

73 Terraform Error – Invalid value for ‘number’ parameter: cannot parse ‘x’ as int

74 Terraform: How to remove new line characters from a string

75 Terraform JSON Parsing Errors: Causes and Solutions

76 Using Terraform with Git branches to manage environments

77 How to mix strings with variables in Terraform

78 Terraform: How to split a string into a list

79 Terraform: How to join list elements into a string

80 Using Regular Expressions in Terraform: A Practical Guide

81 Terraform: How to check if a string contains a substring

82 Terraform: How to replace all occurrences of a substring in a string

83 Terraform: How to add/remove elements from a list

84 Terraform: How to uppercase/lowercase a string

85 Terraform: Removing leading and trailing whitespace from a string

86 Sorting Lists in Terraform: A Practical Guide

87 Terraform: How to calculate the sum/average/product of a list

88 Terraform: How to get the length of a list

89 Terraform: How to create a map from two lists (keys and values)

90 Base64 Encoding/Decoding in Terraform: A Practical Guide

91 JSON encoding/decoding in Terraform: Explained with examples

92 Terraform: Read CSV data and convert it into a list of maps

93 How to perform URL encoding/decoding in Terraform

94 Terraform: How to read YAML data and convert it into a map

95 Terraform: How to convert relative paths to absolute paths

96 Terraform: How to get the current working directory

97 Terraform: How to extract filename/extension from a path

98 Terraform: How to convert timestamp to date and vice versa

99 Terraform: How to compare 2 dates

100 Terraform: How to add a duration to a date

101 Terraform: How to compare two strings case-insensitively

102 Using bcrypt() and md5() functions in Terraform

103 SHA1, SHA256, and SHA512 in Terraform: A Practical Guide

104 How to generate UUIDs in Terraform

105 Using try() and coalesce() functions in Terraform (with examples)

106 Terraform: How to convert string to date and timestamp

107 Terraform: How to convert a number to a string and vice versa

108 Terraform: 3 Ways to Remove Duplicates from a List

109 Terraform: How to Merge 2 Maps

110 Terraform: How to concatenate lists