Terraform Basics
Terraform Basics
COURSE
2025
Module# 1
(Introduction)
Course Objective
Challenges with Traditional
IT infrastructure
2025
STARTUP
BUSINESS PLAN
Presented By
Aaron Loeb
Why Terraform?
Declarative
Terraform State
Terraform Import
HCL Basics
Terraform
Providers
Input
Variables
List
Variable
Map
Variable
List of
a Type
Map of
a Type
Set
Set is same as of list only key
difference is that sets don’t have
duplicate values.
Objects
With objects we can create complex
data structures using all the variable
data types
Tuples
Tuples are similar to list but consists
of sequence of elements. The only
key difference is that it can use
elements of different variable types.
Using
Variables
Passing directly
Resource
Attributes
Output
Variables
Sample commands
Module# 3
(Terraform State)
Terraform state are the state of process that has been done when we initiate
terraform commands.
Terraform init: Use to download necessary plugins.
Terraform plan: Generate output of execution plan.
Terraform apply: Create resources as expected in plan command.
Purpose of
State
Terraform State
consideration
Terraform Commands
Data Sources
Data sources allows terraform to read attribute from the resources that are
out of terraform control.
Meta Argument
Count
For Each
Method #1
Method #2
The key difference between for_each and count is that whenever count is
applied it destroys all the resources but for_each only destroyed the
changed resources.
Version
Constraints
It is used when we make sure that our terraform file will use a specific
version of provider when we run terraform init command
Method #1 Method #2
Method #1 of creating
IAM with Terraform
Using Policy with EOF parameters.
Method #1 of creating
IAM with Terraform
Using policy from a different file.
AWS S3 with
Terraform
AWS Dynamo DB
with Terraform
Module# 6
(Remote State)
Remote State
State Locking
Terraform State
Commands
Terraform state commands are use to manipulate
terraform state.
Module# 7
(Terraform Provisioners)
AWS EC2 with
Terraform
Local Exec: Used to run bash script from the local machine.
Failure Behavior: Destroy resource if failed
Module# 8
(Terraform Import, Taint & Debug)
Taint
You can untaint a resource using untaint command, so terraform dont try
to recreate it on terraform apply.
Debugging
Disable Logs
Terraform
Import
Terraform import is use to import resources completely into the
managment and operation of terraform
Module# 9
(Terraform Modules)
Terraform
Import
Benefits:
Reusability. Low risk (less
human error). Simpler
configuration files.
Standardize configuration.
Make Terraform
Function
We have use some functions so far like length, file, list to set
Numeric Functions:
Use to transform and manipulate numerical
type data.
Ceil returns greater than or closer number.
Floor return less than or closer number.
String Functions:
Use to transform and manipulate String type
data values.
Collection Functions:
Use for collection data types such as list, set
and maps.
Map Functions:
Use for Map data types.
Conditional
Expression
IF-ELSE