SlideShare a Scribd company logo
Infrastructure as Code -
Terraformujeme cloud
Viliam Púčik
DevOps Tech Lead
ZOOM International
On Premise vs Cloud
On Premise
Cloud
Major Cloud Providers
Google
Cloud
Platform
Amazon
Web
Services
Microsoft
Azure
Complex
Infrastructure
Complex
Infrastructure
Development
Environment
Staging
Environment
Production
Environment
AWS Web Console
Infrastructure as Code
Infrastructure as Code
GCP
Cloud
Deployment
Manager
AWS
Cloud
Formation
Azure
Resource
Manager
HashiCorp
Terraform
(Open Source)
Terraform
A tool for building, changing, and versioning infrastructure safely
and efficiently. Building blocks:
●
Providers (AWS, GCP, Azure, MySQL, PostgreSQL,
Kubernetes, Helm, GitHub and hundred of others)
●
Resources, Data Sources (read-only)
●
Input, Local and Output variables
●
Expressions and Functions
https://www.terraform.io/
Terraform State
Terraform
Code
Cloud
State
Let's
Demo
Actual
Demo :)
Terraform Meta Arguments
●
depends_on - for specifying hidden dependencies
●
count - for creating multiple resource instances according
to a count
●
for_each - to create multiple instances according to a map
- or set of strings
●
provider - for selecting a non-default provider configuration
●
lifecycle - for lifecycle customizations
●
provisioner and connection - for taking extra actions after
resource creation
depends_on
resource "aws_instance" "bastion" {
vpc_security_group_ids = [
aws_security_group.bastion.id,
]
depends_on = [
aws_instance.web,
]
}
count
resource "aws_instance" "bastion" {
count = 10
}
count
variable "web_enabled" {
type = bool
default = false
}
resource "aws_instance" "web" {
count = var.web_enabled == true ? 1 : 0
}
for_each
variable "users" {
type = list(string)
default = ["admin", "developer", "manager"]
}
resource "aws_iam_user" "user" {
for_each = toset(var.users)
name = each.key
}
provider
provider "aws" {}
provider "aws" {
alias = "staging"
}
resource "aws_instance" "web" {
provider = aws.staging
}
lifecycle
resource "aws_instance" "web" {
lifecycle {
create_before_destroy = true
ignore_changes = [tags]
}
}
lifecycle
resource "aws_instance" "web" {
lifecycle {
prevent_destroy = true
}
}
provisioner
resource "null_resource" "id_rsa" {
provisioner "local-exec" {
working_dir = path.module
command = "ssh-keygen -N '' -f id_rsa"
}
}
provisioner
resource "aws_instance" "web" {
provisioner "remote-exec" {
inline = [
"sudo systemctl disable httpd",
]
}
}
provisioner
resource "aws_instance" "web" {
provisioner "file" {
source = "${path.module}conf/httpd.conf"
destination = "/etc/httpd/conf/httpd.conf"
}
}
provisioner
resource "aws_instance" "web" {
provisioner "file" {
...
connection {
type = "ssh"
user = "developer"
port = 2022
}
}
}
Terraform Modules
module "rds" {
source = "terraform-aws-modules/rds/aws"
version = "2.5.0"
# insert the 11 required variables here
}
https://registry.terraform.io/
Terragrunt
A thin wrapper for Terraform that provides extra tools for working
with multiple Terraform modules. For example:
●
Creates remote state and locking resources automatically
●
Passes extra CLI arguments every time you run certain
terraform commands
https://github.com/gruntwork-io/terragrunt
Questions?
Thank you!
https://a.openalt.cz/53
aws-vault
A tool to securely store and access AWS credentials in
(development) environments.
●
Encrypts AWS keys
●
Provides temporary, one time credentials
https://github.com/99designs/aws-vault
Terraform Pre-Commit Framework
Automatically, before each commit:
●
Formats Terraform code
●
Updates README.md with the description of:
– terraform input variables
– terraform output variables
https://github.com/antonbabenko/pre-commit-terraform

More Related Content

PDF
Terraforming the Kubernetes Land
PDF
Altitude SF 2017: Stories from TED
PDF
Infrastructure as Code in Google Cloud
PDF
Amazon Route53へのドメイン移管
PDF
Docker 1.12 (dockercon recap)
PDF
Ground Control to Nomad Job Dispatch
PDF
Rapid Infrastructure Provisioning
PPT
Frontend Servers and NGINX: What, Where and How
Terraforming the Kubernetes Land
Altitude SF 2017: Stories from TED
Infrastructure as Code in Google Cloud
Amazon Route53へのドメイン移管
Docker 1.12 (dockercon recap)
Ground Control to Nomad Job Dispatch
Rapid Infrastructure Provisioning
Frontend Servers and NGINX: What, Where and How

What's hot (19)

PDF
Altitude SF 2017: Nomad and next-gen application architectures
ODP
AWS Jounrey at justgiving (manchester AWS meetup)
PPT
SharePoint Administration with PowerShell
PDF
Terraform in action
PDF
AWS Elastic Container Service - DockerHN
PDF
Intro to Scala.js - Scala UG Cologne
PDF
Intro to sbt-web
PDF
Terraform and cloud.ca
PDF
High Performance Ruby: Evented vs. Threaded
PPTX
Let us make clear the aws directconnect
PDF
Declarative & workflow based infrastructure with Terraform
PDF
AWS user group Serverless in September - Chris Johnson Bidler "Go Serverless ...
PDF
LAMP Stack (Reloaded) - Infrastructure as Code with Terraform & Packer
PDF
Hashidays London 2017 - Evolving your Infrastructure with Terraform By Nicki ...
PDF
Infrastructure as Code with Terraform
PDF
Terraform: Configuration Management for Cloud Services
PDF
Comparison nodejs frameworks using Polls API
PDF
GraphQL Los Angeles Meetup Slides
PDF
Paul Dix (Founder InfluxDB) - Organising Metrics at #DOXLON
Altitude SF 2017: Nomad and next-gen application architectures
AWS Jounrey at justgiving (manchester AWS meetup)
SharePoint Administration with PowerShell
Terraform in action
AWS Elastic Container Service - DockerHN
Intro to Scala.js - Scala UG Cologne
Intro to sbt-web
Terraform and cloud.ca
High Performance Ruby: Evented vs. Threaded
Let us make clear the aws directconnect
Declarative & workflow based infrastructure with Terraform
AWS user group Serverless in September - Chris Johnson Bidler "Go Serverless ...
LAMP Stack (Reloaded) - Infrastructure as Code with Terraform & Packer
Hashidays London 2017 - Evolving your Infrastructure with Terraform By Nicki ...
Infrastructure as Code with Terraform
Terraform: Configuration Management for Cloud Services
Comparison nodejs frameworks using Polls API
GraphQL Los Angeles Meetup Slides
Paul Dix (Founder InfluxDB) - Organising Metrics at #DOXLON
Ad

Similar to Infrastructure as code terraformujeme cloud (20)

PPTX
Infrastructure as code, using Terraform
PDF
PDF
Terraform introduction
PDF
Infrastructure as Code with Terraform
PDF
Terraform In Action Meap V10 Meap Scott Winkler
PDF
Infrastructure as Code with Terraform
PPTX
Infrastructure as Code with Terraform.pptx
PDF
Terraform: Infrastructure as Code
PDF
Provisioning infrastructure to AWS using Terraform – Exove
PDF
Terraform -- Infrastructure as Code
PDF
Introduction to IAC and Terraform
PDF
Building infrastructure as code using Terraform - DevOps Krakow
PPTX
Terraform Basics
PDF
Hashicorp-Terraform-Deep-Dive-with-no-Fear-Victor-Turbinsky-Texuna.pdf
PDF
Terraform-2.pdf
PDF
OSDC 2018 | Lifecycle of a resource. Codifying infrastructure with Terraform ...
PPTX
Terraform infraestructura como código
PPTX
Infrastructure-as-Code (IaC) using Terraform
PDF
A Hands-on Introduction on Terraform Best Concepts and Best Practices
PDF
Manage any AWS resources with Terraform 0.12 - April 2020
Infrastructure as code, using Terraform
Terraform introduction
Infrastructure as Code with Terraform
Terraform In Action Meap V10 Meap Scott Winkler
Infrastructure as Code with Terraform
Infrastructure as Code with Terraform.pptx
Terraform: Infrastructure as Code
Provisioning infrastructure to AWS using Terraform – Exove
Terraform -- Infrastructure as Code
Introduction to IAC and Terraform
Building infrastructure as code using Terraform - DevOps Krakow
Terraform Basics
Hashicorp-Terraform-Deep-Dive-with-no-Fear-Victor-Turbinsky-Texuna.pdf
Terraform-2.pdf
OSDC 2018 | Lifecycle of a resource. Codifying infrastructure with Terraform ...
Terraform infraestructura como código
Infrastructure-as-Code (IaC) using Terraform
A Hands-on Introduction on Terraform Best Concepts and Best Practices
Manage any AWS resources with Terraform 0.12 - April 2020
Ad

Recently uploaded (20)

PPTX
Why Generative AI is the Future of Content, Code & Creativity?
PPTX
Oracle Fusion HCM Cloud Demo for Beginners
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PDF
Salesforce Agentforce AI Implementation.pdf
PDF
CCleaner Pro 6.38.11537 Crack Final Latest Version 2025
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PDF
Autodesk AutoCAD Crack Free Download 2025
PDF
Cost to Outsource Software Development in 2025
PDF
iTop VPN 6.5.0 Crack + License Key 2025 (Premium Version)
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PDF
Download FL Studio Crack Latest version 2025 ?
PDF
Nekopoi APK 2025 free lastest update
PDF
Complete Guide to Website Development in Malaysia for SMEs
PDF
Tally Prime Crack Download New Version 5.1 [2025] (License Key Free
PDF
AutoCAD Professional Crack 2025 With License Key
PPTX
assetexplorer- product-overview - presentation
PPTX
Monitoring Stack: Grafana, Loki & Promtail
PDF
How to Make Money in the Metaverse_ Top Strategies for Beginners.pdf
PPTX
Advanced SystemCare Ultimate Crack + Portable (2025)
Why Generative AI is the Future of Content, Code & Creativity?
Oracle Fusion HCM Cloud Demo for Beginners
Design an Analysis of Algorithms I-SECS-1021-03
Salesforce Agentforce AI Implementation.pdf
CCleaner Pro 6.38.11537 Crack Final Latest Version 2025
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
Autodesk AutoCAD Crack Free Download 2025
Cost to Outsource Software Development in 2025
iTop VPN 6.5.0 Crack + License Key 2025 (Premium Version)
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
Download FL Studio Crack Latest version 2025 ?
Nekopoi APK 2025 free lastest update
Complete Guide to Website Development in Malaysia for SMEs
Tally Prime Crack Download New Version 5.1 [2025] (License Key Free
AutoCAD Professional Crack 2025 With License Key
assetexplorer- product-overview - presentation
Monitoring Stack: Grafana, Loki & Promtail
How to Make Money in the Metaverse_ Top Strategies for Beginners.pdf
Advanced SystemCare Ultimate Crack + Portable (2025)

Infrastructure as code terraformujeme cloud