The document presents an overview of creating AWS infrastructure using Terraform while emphasizing etiquette in sessions such as punctuality and submitting constructive feedback. It explains Infrastructure as Code (IAC), its benefits, and the differences between imperative and declarative approaches. The document also outlines Terraform as a tool for managing infrastructure and describes its key components, configuration files, and usage.
Lack of etiquetteand manners is a huge turn off.
KnolX Etiquettes
Punctuality
Respect Knolx session timings, you
are requested not to join sessions
after a 5 minutes threshold post
the session start time.
Feedback
Make sure to submit a constructive
feedback for all sessions as it is
very helpful for the presenter.
Silent Mode
Keep your mobile devices in silent
mode, feel free to move out of
session in case you need to attend
an urgent call.
Avoid Disturbance
Avoid unwanted chit chat during
the session.
3.
Our Agenda
01 Infrastructureas a Code
02 Imperative vs Declarative
03 Infrastructure as a Code key points
04 Why IAAC
05 Terraform
06 Terraform Components
07 Demo
4.
What is Infrastructureas a code?
Infrastructure as Code or IaC is the process of
provisioning and managing infrastructure defined
through code, instead of doing so with a manual
process.
As infrastructure is defined as code, it allows users to
easily edit and distribute configurations while
ensuring the desired state of the infrastructure. This
means you can create reproducible infrastructure
configurations.
5.
IMPERATIVE
Get base
Get sauce
Getcheese
# Make a Pizza
Get Toppings
Get the base ready
Add sauce to base
Add cheese
Add cheese
Add ingredients at top
Bake it
Infrastructure as aCode: Core concepts
Consistency
Each time you do something the result will
be same. The infrastructure setup reduces
the possibility of oversights and decreases
the chances of incompatibility issues with
the infrastructure.
Idempotency
If we haven’t changed anything about our
configuration, and we apply it again to the
same environment, nothing will change in
our environment because our defined
configuration matches the reality of the
infrastructure that exists.
Defined in code
Stored in
source control
Declarative or
imperative
Push or Pull
Terraform
Terraform is aninfrastructure as code (IaC) tool that
allows you to build, change, and version infrastructure
safely and efficiently. This includes low-level
components such as compute instances, storage, and
networking, as well as high-level components such as
DNS entries, SaaS features, etc. Terraform can manage
both existing service providers and custom in-house
solutions.
10.
Terraform Components
Terraform Executable
Itis a single executable written in GO
Terraform Files
It contains configuration and typically
have .tf extension
Terraform Plugins
It is used to interact with the
providers
Terraform State
It is used to maintain the state of the
configuration
11.
output "instance_ip_addr" {
value=
aws_instance.server.private_ip
}
variable "image_id" {
type = string
}
variable
"availability_zone_names" {
type = list(string)
default = ["us-east-1a"]
}
data "aws_ami" "example" {
most_recent = true
owners = ["self"]
tags = {
Name = "app-server"
}
}
resource "aws_instance" "" {
ami = "ami-a1b2c3d4"
instance_type = "t2.micro"
}
Terraform Configuration File Components
Variables
Output Data
Resource
Providers
Terraform
Configuration
Files
provider "google" {
alias = "europe"
region = "europe-west1"
}