SlideShare a Scribd company logo
Building with Terraform
Volodymyr Tsap Provectus DevOps Meetup 2018
About Author
15 years supporting Linux for
money
8 years as a CTO in own
company SHALB.com
10 years Enterprise Business
Applications and SDK’s
support at Genesys
Introducing Terraform
● Infrastructure as a code tool
● Environment orchestration
● Reproducible stacks
● Same workflow for all providers
Configuration management in numbers
* https://devops-survey.io/DevopsSurveyResults2017.pdf
But why we need extra tool beside:
Ansible, Chef, Puppet, SaltStack?
Configuration Management vs. Orchestration
Conf Manager tools Orchestration tools
Steps to get the stack state
Install software
Manage config files
Adjust OS parameters
Manage firewalls
Describe desired stack state
Create and map EC2, ELB, SG
Manage cloud-specific
services
Manage security groups
Procedural vs. Declarative code style
Ansible
# Add 5 more
- ec2:
count: 5
image: aws-ami
Instance_type: t2.micro
Terraform
# Make sure that we have 5
resource "aws_instance"
"ec2ins" {
count = 5
ami = "aws-ami"
instance_type = "t2.micro"
}
Terraform is best for:
● Multi-tier applications
● Self-service infrastructure
● Production, development, and testing
environments
● Continuous delivery
Architecture. Agent-less
Terraform
Core
Plugins
Providers
AWS
GCE
K8
Upstream API’s
Sample of Supported Providers
Setting an Environment
To use with AWS
Download Binary. Install. Add AWS keys
That's All!
Syntax Highlights
Syntax Highlight. Provider Definition
Syntax Highlight. Resource Definition
Demo Samples
https://github.com/voatsap/provectus
Defining our first instance
## Define provider
provider "aws" {
region = "eu-central-1"
}
## Get instance AMI
data "aws_ami" "ubuntu" {
most_recent = true
filter {
name = "name"
values = ["ubuntu/images/hvm-ssd/ubuntu-*-16.04-amd64-server-*"
}
}
# Define the instance
resource "aws_instance" "test-ec2instance" {
ami = "${data.aws_ami.ubuntu.id}"
instance_type = "t2.micro"
}
Init Terraform and plan execution
Apply and launch our first instance
Sample 1. Graphing Sample Instance
Sample 2. Parametrizing with Variables
terraform.tfvars
# String
region = "eu-central-1"
# List
vpc_security_group_ids= [ "sg-84e649ed", "sg-90ea45fa" ]
# Map
instance_type = {
production = "t2.micro"
development = "m3.medium"
}
Sample 2. Map of Lists
# Map of Lists
vpc_security_group_ids_map = {
eu-central-1 = [ "sg-84e649ed", "sg-90ea45fa" ]
eu-west-1 = [ "sg-1d4ab664", "sg-90ea45fa" ]
}
Sample 2. Parametrizing with Variables.
# Define the instance
resource "aws_instance" "test-ec2instance" {
ami = "${data.aws_ami.ubuntu.id}"
vpc_security_group_ids = [ "${var.vpc_security_group_ids[1]}" ]
instance_type = "${lookup(var.instance_type, var.environment)}"
count = 2
}
Sample 2. Instance Graph
Sample 3. Build custom image using Packer
● Configure AMI using Packer xp-ami-
packer.json
● Install required software to our AMI provision-
ami.sh
● Build new AMI
● Attach to terraform
Sample 3. Provisioners
resource "aws_instance" "provectus-instance" {
provisioner "file" {
content = "$(provectus-{count.index + 1}}"
destination = "/etc/hostname"
}
provisioner "remote-exec" {
script = "files/bootstrap_ansible.sh"
}
#AWS user_data
user_data = <<EOF
#!/bin/bash
hostname provectus${count.index + 1} && hostname > /etc/hostname
EOF
}
Sample 3. Create RDS and config DB Endpoint
resource "aws_db_instance" "db-instance" {
allocated_storage = 10
engine = "mysql"
engine_version = "5.7.17"
instance_class = "db.t2.micro"
name = "wisehandsdb"
username = "root"
password = "dfe6iWTjxOgeY"
# Passing to app config
sed -i 's/mysql-database-endpoint/${aws_db_instance.db-
instance.username}:${aws_db_instance.db-
instance.password}@${aws_db_instance.db-
instance.endpoint}/${aws_db_instance.db-instance.name}/g'
/home/ubuntu/wisehands.me/conf/application.conf
Sample 3. Graphing Stack
Sample 4. Templates
data "template_file" "init" {
template = "${file("files/init.tpl")}"
count = "${length(var.instance_suffix)}"
vars {
dbendpoint="${aws_db_instance.db-instance.username}"
instancehostname="provectus-
${var.instance_suffix[count.index]"
}
}
files/init.tpl:
#!/bin/bash
echo ${instancehostname} > /etc/hostname
Sample 4. Create multiple resources
terraform.tfvars:
# Define instance suffix
instance_suffix = ["blue","green"]
instance.tf:
resource "aws_instance" "provectus-instance" {
ami = "${data.aws_ami.provectus-ami.id}"
name="provectus-${var.instance_suffix[count.index]}-
${count.index}
…
# Nubmer of instances
count = "${length(var.instance_suffix)}"
}
Sample 4. Adding IAM profile
# Define a policy
resource "aws_iam_policy" "ec2-ro-policy"
# STS AssumeRole Data
data "aws_iam_policy_document" "instance-assume-role-policy"
# Add EC2 instance role
resource "aws_iam_role" "ec2-instance-role"
# Attach policy to role
resource "aws_iam_policy_attachment" "ec2-policy-attachment"
# Create instance profile and attach the role
resource "aws_iam_instance_profile" "ec2-instance-profile"
Sample 4. Graphing an Environment
Sample 5. Building VPC. Define Variables
vpc_cidr = {
production = "10.10.0.0/16"
development = "10.3.0.0/16"
default_subnet_cidr_block = {
production = "10.10.0.0/22"
development = "10.3.0.0/22"
default_db_subnet_cidr_block = { … }
default_subnet_availability_zone = { … }
default_db_subnet_availability_zone = { … }
production = "eu-central-1b"
development = "eu-west-1b"
}
Sample 5. Building a Module
Sample 5. Launch Conf, ASG, Metrics
# Creating launch configuration
resource "aws_launch_configuration" "launch-provectus"
# Add Auto Scaling Group
resource "aws_autoscaling_group" "asg-provectus"
# Autoscale policy
resource "aws_autoscaling_policy" "scale_in_provectus"
# Autoscale Alarm Metrics
resource "aws_cloudwatch_metric_alarm"
metric_alarm_cpu_high_provectus"
Sample 5. LoadBalancers, DNS, Certificates
● Define a Load Balancer
● Create Route53 record
● Add Certificates via ACM
● Attach Cert to ELB
● Attach Route53 record to ELB
Sample 5. Finishing the Stack
Zoom: http://auth.shalb.com/sample5.png
Appendix A. Performing a rolling update
# Set the lifecycle for launch configuration and ASG
lifecycle { create_before_destroy = true }
# The launch configuration omit name definition
# allowing the terraform to set it
# ASG interpolates the LC name into its name so any changes
# force a replacement of the ASG.
name = "asg-${aws_launch_configuration.launch-
provectus.name}”
# Define the minimum node capacity per group
wait_for_elb_capacity =
“${var.instance_count_provectus_min}”
Terraform Hints
● Terraforming
● External data sources
● HTTP Data Source
● AWS Service Limits
● Delegate outputs via remote state
● .tfstate diff versioning via s3 snapshots
● erraform best practices
Terraform Drawbacks
● A big effort to import large infrastructure
● Plans could fail, even valid ones
● There is no rollback
● Eventual consistency because of async
● No manual intervention allowed
Terraform Summary
● DRY IaaC
● It’s Simple and human friendly
● Fast prototyping, quick implementation
● Cool for teamwork
● The next step in infrastructure management
Thank you!
Volodymyr Tsap
Co-founder/CTO at SHALB.com
Email: voa@shalb.com
Skype: volodymyr.tsap
Linkedin: voatsap
Facebook: volodymyr.tsap
https://github.com/voatsap/provectus

More Related Content

PDF
How to eat an elephant
PDF
Terraforming RDS
PPTX
Terraform day02
PPTX
Terraform at Scale
PDF
SUPER-scaling E-Commerce with Magento
PDF
Intro to Terraform
PPTX
Introduction To Terraform
PDF
Terraform: Cloud Configuration Management (WTC/IPC'16)
How to eat an elephant
Terraforming RDS
Terraform day02
Terraform at Scale
SUPER-scaling E-Commerce with Magento
Intro to Terraform
Introduction To Terraform
Terraform: Cloud Configuration Management (WTC/IPC'16)

What's hot (15)

PDF
Developing Terraform Modules at Scale - HashiTalks 2021
PPT
SharePoint Administration with PowerShell
PDF
Terraform: An Overview & Introduction
PPTX
Automation with Packer and TerraForm
PDF
Amazon Route53へのドメイン移管
PDF
Everything as Code with Terraform
ODP
Integrating icinga2 and the HashiCorp suite
PPTX
"Continuously delivering infrastructure using Terraform and Packer" training ...
PPTX
CON420 Infrastructure as code for containers
PPTX
Terraform Modules and Continuous Deployment
PPTX
Final terraform
PPTX
Infrastructure as Code: Introduction to Terraform
PPTX
Oracle on AWS RDS Migration - 성기명
PDF
Azure powershell management
ODP
Infrastructure as code with Puppet and Apache CloudStack
Developing Terraform Modules at Scale - HashiTalks 2021
SharePoint Administration with PowerShell
Terraform: An Overview & Introduction
Automation with Packer and TerraForm
Amazon Route53へのドメイン移管
Everything as Code with Terraform
Integrating icinga2 and the HashiCorp suite
"Continuously delivering infrastructure using Terraform and Packer" training ...
CON420 Infrastructure as code for containers
Terraform Modules and Continuous Deployment
Final terraform
Infrastructure as Code: Introduction to Terraform
Oracle on AWS RDS Migration - 성기명
Azure powershell management
Infrastructure as code with Puppet and Apache CloudStack
Ad

Similar to Dive into DevOps | March, Building with Terraform, Volodymyr Tsap (20)

PDF
Workshop Infrastructure as Code - Suestra
PDF
Infrastructure as Code with Terraform
PDF
AWS DevOps - Terraform, Docker, HashiCorp Vault
PDF
Introductory Overview to Managing AWS with Terraform
PDF
Infrastructure-as-code: bridging the gap between Devs and Ops
PDF
A Hands-on Introduction on Terraform Best Concepts and Best Practices
PDF
Terraform at Scale - All Day DevOps 2017
PPTX
terraform cours intéressant et super fort
PDF
Terraform introduction
PDF
Declarative & workflow based infrastructure with Terraform
PDF
DevOps Enabling Your Team
PDF
DevOps Braga #9: Introdução ao Terraform
PDF
Microservices with Terraform, Docker and the Cloud. IJug Chicago 2017-06-06
PDF
Microservices with Terraform, Docker and the Cloud. DevOps Wet 2018
PDF
Oracle Cloud - Infrastruktura jako kód
PPTX
RIMA-Infrastructure as a code with Terraform.pptx
PPTX
Reusable, composable, battle-tested Terraform modules
PPTX
Infrastructure as code, using Terraform
PPTX
DelEx Conference: Jenkins+Terragrunt+Terraform eco-system
PDF
Terraform -- Infrastructure as Code
Workshop Infrastructure as Code - Suestra
Infrastructure as Code with Terraform
AWS DevOps - Terraform, Docker, HashiCorp Vault
Introductory Overview to Managing AWS with Terraform
Infrastructure-as-code: bridging the gap between Devs and Ops
A Hands-on Introduction on Terraform Best Concepts and Best Practices
Terraform at Scale - All Day DevOps 2017
terraform cours intéressant et super fort
Terraform introduction
Declarative & workflow based infrastructure with Terraform
DevOps Enabling Your Team
DevOps Braga #9: Introdução ao Terraform
Microservices with Terraform, Docker and the Cloud. IJug Chicago 2017-06-06
Microservices with Terraform, Docker and the Cloud. DevOps Wet 2018
Oracle Cloud - Infrastruktura jako kód
RIMA-Infrastructure as a code with Terraform.pptx
Reusable, composable, battle-tested Terraform modules
Infrastructure as code, using Terraform
DelEx Conference: Jenkins+Terragrunt+Terraform eco-system
Terraform -- Infrastructure as Code
Ad

More from Provectus (20)

PPTX
Choosing the right IDP Solution
PPTX
Intelligent Document Processing in Healthcare. Choosing the Right Solutions.
PPTX
Choosing the Right Document Processing Solution for Healthcare Organizations
PPTX
MLOps and Data Quality: Deploying Reliable ML Models in Production
PPTX
AI Stack on AWS: Amazon SageMaker and Beyond
PPTX
Feature Store as a Data Foundation for Machine Learning
PPTX
MLOps and Reproducible ML on AWS with Kubeflow and SageMaker
PPTX
Cost Optimization for Apache Hadoop/Spark Workloads with Amazon EMR
PPTX
ODSC webinar "Kubeflow, MLFlow and Beyond — augmenting ML delivery" Stepan Pu...
PDF
"Building a Modern Data platform in the Cloud", Alex Casalboni, AWS Dev Day K...
PDF
"How to build a global serverless service", Alex Casalboni, AWS Dev Day Kyiv ...
PDF
"Automating AWS Infrastructure with PowerShell", Martin Beeby, AWS Dev Day Ky...
PDF
"Analyzing your web and application logs", Javier Ramirez, AWS Dev Day Kyiv 2...
PDF
"Resiliency and Availability Design Patterns for the Cloud", Sebastien Storma...
PDF
"Architecting SaaS solutions on AWS", Oleksandr Mykhalchuk, AWS Dev Day Kyiv ...
PDF
"Developing with .NET Core on AWS", Martin Beeby, AWS Dev Day Kyiv 2019
PDF
"How to build real-time backends", Martin Beeby, AWS Dev Day Kyiv 2019
PDF
"Integrate your front end apps with serverless backend in the cloud", Sebasti...
PDF
"Scaling ML from 0 to millions of users", Julien Simon, AWS Dev Day Kyiv 2019
PPTX
How to implement authorization in your backend with AWS IAM
Choosing the right IDP Solution
Intelligent Document Processing in Healthcare. Choosing the Right Solutions.
Choosing the Right Document Processing Solution for Healthcare Organizations
MLOps and Data Quality: Deploying Reliable ML Models in Production
AI Stack on AWS: Amazon SageMaker and Beyond
Feature Store as a Data Foundation for Machine Learning
MLOps and Reproducible ML on AWS with Kubeflow and SageMaker
Cost Optimization for Apache Hadoop/Spark Workloads with Amazon EMR
ODSC webinar "Kubeflow, MLFlow and Beyond — augmenting ML delivery" Stepan Pu...
"Building a Modern Data platform in the Cloud", Alex Casalboni, AWS Dev Day K...
"How to build a global serverless service", Alex Casalboni, AWS Dev Day Kyiv ...
"Automating AWS Infrastructure with PowerShell", Martin Beeby, AWS Dev Day Ky...
"Analyzing your web and application logs", Javier Ramirez, AWS Dev Day Kyiv 2...
"Resiliency and Availability Design Patterns for the Cloud", Sebastien Storma...
"Architecting SaaS solutions on AWS", Oleksandr Mykhalchuk, AWS Dev Day Kyiv ...
"Developing with .NET Core on AWS", Martin Beeby, AWS Dev Day Kyiv 2019
"How to build real-time backends", Martin Beeby, AWS Dev Day Kyiv 2019
"Integrate your front end apps with serverless backend in the cloud", Sebasti...
"Scaling ML from 0 to millions of users", Julien Simon, AWS Dev Day Kyiv 2019
How to implement authorization in your backend with AWS IAM

Recently uploaded (20)

PDF
KodekX | Application Modernization Development
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
Spectroscopy.pptx food analysis technology
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPT
Teaching material agriculture food technology
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PPTX
Big Data Technologies - Introduction.pptx
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
KodekX | Application Modernization Development
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Spectroscopy.pptx food analysis technology
Per capita expenditure prediction using model stacking based on satellite ima...
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Teaching material agriculture food technology
Advanced methodologies resolving dimensionality complications for autism neur...
The AUB Centre for AI in Media Proposal.docx
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
sap open course for s4hana steps from ECC to s4
Review of recent advances in non-invasive hemoglobin estimation
Reach Out and Touch Someone: Haptics and Empathic Computing
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
MIND Revenue Release Quarter 2 2025 Press Release
Big Data Technologies - Introduction.pptx
20250228 LYD VKU AI Blended-Learning.pptx

Dive into DevOps | March, Building with Terraform, Volodymyr Tsap

  • 1. Building with Terraform Volodymyr Tsap Provectus DevOps Meetup 2018
  • 2. About Author 15 years supporting Linux for money 8 years as a CTO in own company SHALB.com 10 years Enterprise Business Applications and SDK’s support at Genesys
  • 3. Introducing Terraform ● Infrastructure as a code tool ● Environment orchestration ● Reproducible stacks ● Same workflow for all providers
  • 4. Configuration management in numbers * https://devops-survey.io/DevopsSurveyResults2017.pdf
  • 5. But why we need extra tool beside: Ansible, Chef, Puppet, SaltStack?
  • 6. Configuration Management vs. Orchestration Conf Manager tools Orchestration tools Steps to get the stack state Install software Manage config files Adjust OS parameters Manage firewalls Describe desired stack state Create and map EC2, ELB, SG Manage cloud-specific services Manage security groups
  • 7. Procedural vs. Declarative code style Ansible # Add 5 more - ec2: count: 5 image: aws-ami Instance_type: t2.micro Terraform # Make sure that we have 5 resource "aws_instance" "ec2ins" { count = 5 ami = "aws-ami" instance_type = "t2.micro" }
  • 8. Terraform is best for: ● Multi-tier applications ● Self-service infrastructure ● Production, development, and testing environments ● Continuous delivery
  • 10. Sample of Supported Providers
  • 12. Download Binary. Install. Add AWS keys That's All!
  • 17. Defining our first instance ## Define provider provider "aws" { region = "eu-central-1" } ## Get instance AMI data "aws_ami" "ubuntu" { most_recent = true filter { name = "name" values = ["ubuntu/images/hvm-ssd/ubuntu-*-16.04-amd64-server-*" } } # Define the instance resource "aws_instance" "test-ec2instance" { ami = "${data.aws_ami.ubuntu.id}" instance_type = "t2.micro" }
  • 18. Init Terraform and plan execution
  • 19. Apply and launch our first instance
  • 20. Sample 1. Graphing Sample Instance
  • 21. Sample 2. Parametrizing with Variables terraform.tfvars # String region = "eu-central-1" # List vpc_security_group_ids= [ "sg-84e649ed", "sg-90ea45fa" ] # Map instance_type = { production = "t2.micro" development = "m3.medium" }
  • 22. Sample 2. Map of Lists # Map of Lists vpc_security_group_ids_map = { eu-central-1 = [ "sg-84e649ed", "sg-90ea45fa" ] eu-west-1 = [ "sg-1d4ab664", "sg-90ea45fa" ] }
  • 23. Sample 2. Parametrizing with Variables. # Define the instance resource "aws_instance" "test-ec2instance" { ami = "${data.aws_ami.ubuntu.id}" vpc_security_group_ids = [ "${var.vpc_security_group_ids[1]}" ] instance_type = "${lookup(var.instance_type, var.environment)}" count = 2 }
  • 25. Sample 3. Build custom image using Packer ● Configure AMI using Packer xp-ami- packer.json ● Install required software to our AMI provision- ami.sh ● Build new AMI ● Attach to terraform
  • 26. Sample 3. Provisioners resource "aws_instance" "provectus-instance" { provisioner "file" { content = "$(provectus-{count.index + 1}}" destination = "/etc/hostname" } provisioner "remote-exec" { script = "files/bootstrap_ansible.sh" } #AWS user_data user_data = <<EOF #!/bin/bash hostname provectus${count.index + 1} && hostname > /etc/hostname EOF }
  • 27. Sample 3. Create RDS and config DB Endpoint resource "aws_db_instance" "db-instance" { allocated_storage = 10 engine = "mysql" engine_version = "5.7.17" instance_class = "db.t2.micro" name = "wisehandsdb" username = "root" password = "dfe6iWTjxOgeY" # Passing to app config sed -i 's/mysql-database-endpoint/${aws_db_instance.db- instance.username}:${aws_db_instance.db- instance.password}@${aws_db_instance.db- instance.endpoint}/${aws_db_instance.db-instance.name}/g' /home/ubuntu/wisehands.me/conf/application.conf
  • 29. Sample 4. Templates data "template_file" "init" { template = "${file("files/init.tpl")}" count = "${length(var.instance_suffix)}" vars { dbendpoint="${aws_db_instance.db-instance.username}" instancehostname="provectus- ${var.instance_suffix[count.index]" } } files/init.tpl: #!/bin/bash echo ${instancehostname} > /etc/hostname
  • 30. Sample 4. Create multiple resources terraform.tfvars: # Define instance suffix instance_suffix = ["blue","green"] instance.tf: resource "aws_instance" "provectus-instance" { ami = "${data.aws_ami.provectus-ami.id}" name="provectus-${var.instance_suffix[count.index]}- ${count.index} … # Nubmer of instances count = "${length(var.instance_suffix)}" }
  • 31. Sample 4. Adding IAM profile # Define a policy resource "aws_iam_policy" "ec2-ro-policy" # STS AssumeRole Data data "aws_iam_policy_document" "instance-assume-role-policy" # Add EC2 instance role resource "aws_iam_role" "ec2-instance-role" # Attach policy to role resource "aws_iam_policy_attachment" "ec2-policy-attachment" # Create instance profile and attach the role resource "aws_iam_instance_profile" "ec2-instance-profile"
  • 32. Sample 4. Graphing an Environment
  • 33. Sample 5. Building VPC. Define Variables vpc_cidr = { production = "10.10.0.0/16" development = "10.3.0.0/16" default_subnet_cidr_block = { production = "10.10.0.0/22" development = "10.3.0.0/22" default_db_subnet_cidr_block = { … } default_subnet_availability_zone = { … } default_db_subnet_availability_zone = { … } production = "eu-central-1b" development = "eu-west-1b" }
  • 34. Sample 5. Building a Module
  • 35. Sample 5. Launch Conf, ASG, Metrics # Creating launch configuration resource "aws_launch_configuration" "launch-provectus" # Add Auto Scaling Group resource "aws_autoscaling_group" "asg-provectus" # Autoscale policy resource "aws_autoscaling_policy" "scale_in_provectus" # Autoscale Alarm Metrics resource "aws_cloudwatch_metric_alarm" metric_alarm_cpu_high_provectus"
  • 36. Sample 5. LoadBalancers, DNS, Certificates ● Define a Load Balancer ● Create Route53 record ● Add Certificates via ACM ● Attach Cert to ELB ● Attach Route53 record to ELB
  • 37. Sample 5. Finishing the Stack Zoom: http://auth.shalb.com/sample5.png
  • 38. Appendix A. Performing a rolling update # Set the lifecycle for launch configuration and ASG lifecycle { create_before_destroy = true } # The launch configuration omit name definition # allowing the terraform to set it # ASG interpolates the LC name into its name so any changes # force a replacement of the ASG. name = "asg-${aws_launch_configuration.launch- provectus.name}” # Define the minimum node capacity per group wait_for_elb_capacity = “${var.instance_count_provectus_min}”
  • 39. Terraform Hints ● Terraforming ● External data sources ● HTTP Data Source ● AWS Service Limits ● Delegate outputs via remote state ● .tfstate diff versioning via s3 snapshots ● erraform best practices
  • 40. Terraform Drawbacks ● A big effort to import large infrastructure ● Plans could fail, even valid ones ● There is no rollback ● Eventual consistency because of async ● No manual intervention allowed
  • 41. Terraform Summary ● DRY IaaC ● It’s Simple and human friendly ● Fast prototyping, quick implementation ● Cool for teamwork ● The next step in infrastructure management
  • 42. Thank you! Volodymyr Tsap Co-founder/CTO at SHALB.com Email: voa@shalb.com Skype: volodymyr.tsap Linkedin: voatsap Facebook: volodymyr.tsap https://github.com/voatsap/provectus