SlideShare a Scribd company logo
HashiCorp User Group Oslo
20.11.2017
https://meetup.com/Oslo-HashiCorp-User-Group/
Food sponsor:
Agenda - initial commit
1. About this user group
2. Terraform questions & problems
3. Terraform Q&A
Want to be a speaker?
Send an email - anton@antonbabenko.com
About this user group
This HashiCorp User Group Oslo is the place
where interested people gather once every
couple months to learn from each other  about
HashiCorp products— what we do, how we do
it, and how can we do it differently. While I
generally strive to make such meetups
interesting for the participants, I am often
against the repetitive talks which can be found
online easily.
Latest editition: 20.11.2017
Anton Babenko,
CEO at Betajob
linkedin.com/in/antonbabenko
github.com/antonbabenko
anton@antonbabenko.com
Keywords: All-5 AWS certified, DevOps,
infrastructure as code, automation, open-source,
community member and events organiser,
Terraform modules, solution architectures,
serverless.
About me
Terraform Q&A - HashiCorp User Group Oslo
Featuring...
Read also -
https://www.hashicorp.com/tao-of-hashicorp
Featuring...
Write, Plan, and Create Infrastructure as Code
Terraform 101 (main.tf)
provider "aws" { region = "eu-west-1" }
resource "random_pet" "bucket" {}
resource "aws_s3_bucket" "app" {
bucket = "hi-${random_pet .bucket. id}"
website {
index_document = "index.html"
}
}
data "template_file" "index" {
template = "${file("index.html")}"
vars {
BUCKET = "${aws_s3_bucket .app.website_endpoint }"
}
}
resource "aws_s3_bucket_object" "object" {
bucket = "${aws_s3_bucket .app.id}"
key = "index.html"
content = "${data. template_file .index.rendered }"
etag = "${md5(data. template_file .index.rendered )}"
content_type = "text/html"
acl = "public-read"
}
output "app_website_endpoint" {
value = "${aws_s3_bucket .app.website_endpoint }"
}
index.html can access:
${BUCKET}
$ terraform init
$ terraform plan
$ terraform apply
Apply complete! Resources: 3 added, 0
changed, 0 destroyed.
Outputs:
app_website_endpoint =
hi-feasible-basilisk.s3-website-eu-west-1.a
mazonaws.com
Frequent Terraform Questions (FTQ)
Why Terraform and not AWS CloudFormation/Azure
ARM templates/Google Cloud Deployment
Manager?
Terraform manages 70+ providers, has easier syntax (HCL), has native support for modules
and remote states, has team-work features. Terraform is an open-source project (640 - AWS
provider, 1100 - core).
https://medium.com/@piotrgospodarek/cloudformation-vs-terraform-990318d6a7de
https://cloudonaut.io/cloudformation-vs-terraform/
https://www.slideshare.net/AntonBabenko/continuously-delivering-infrastructure-using-terrafo
rm-and-packer-training-material
Tord P.: What is the point of using these tools if
you’re running AWS only, e.g. isn’t Terraform just a
an unnecessary abstraction, why not stick to
CloudFormation?
Terraform manages 70+ providers, has easier syntax (HCL), has native support for modules
and remote states, has team-work features. Terraform is an open-source project.
Abstractions (primitives and modules) are necessary and easily available (Terraform
Registry).
What are the most common tools/solutions out there?
● Terraform Module Registry to discover modules for common infrastructure
configurations for any provider - https://registry.terraform.io/ (I maintain verified AWS
modules there)
● Thin wrapper for Terraform that provides extra tools for working with multiple Terraform
modules - https://github.com/gruntwork-io/terragrunt
● Terraform linter for detecting errors that can not be detected by `terraform plan` -
https://github.com/wata727/tflint
● Terraform version manager - https://github.com/kamatama41/tfenv
This list is much longer, really…
How to handle secrets in Terraform?
1. Can you accept secrets to be saved in state file in plaintext? Probably not.
a. AWS IAM password & access secret keys - use PGP as keybase.io
b. AWS RDS - set dummy password and change after DB is created
c. AWS RDS - use iam_database_authentication_enabled = true
d. EC2 instance user-data + AWS KMS
2. Other options:
a. Secure remote state location (S3 bucket policy, KMS key)
How to get started?
1. Install and getting started - https://www.terraform.io/intro/getting-started/install.html
2. Get infrastructure modules from Terraform Registry. For example, AWS modules -
https://registry.terraform.io/modules/terraform-aws-modules
3. Follow instructions in README.md, check examples, open issues and pull requests.
Frequent Terraform Problems (FTP)
Upgraded Terraform version, and there is a breaking
bug, so I want to rollback, but I can’t because state
file has been upgraded already.
● State file should be versioned (!), download previous version of state file, run “terraform
state push old_version.tfstate”
● Lock terraform version, lock module and providers version (new in 0.11)
● Read upgrade guides and CHANGELOG.md files:
○ https://www.terraform.io/upgrade-guides/0-11.html
○ https://github.com/hashicorp/terraform/blob/master/CHANGELOG.md
○ https://github.com/terraform-providers/terraform-provider-aws/blob/master/CHANG
ELOG.md
What is your Terraform question or problem?
PS: Maybe something about testing? Versioning? Code structure? Working as a
team? CI/CD? Automation? Integration with other tools? https://modules.tf/ ? Code
generation? Missing tools/features? Syntax sugar (features and types of
variables)? How to contribute?
Thanks!
https://www.terraform.io/
https://github.com/terraform-aws-modules/
https://www.slideshare.net/AntonBabenko/continuously-delivering-infrastructure-using-terrafo
rm-and-packer-training-material
https://github.com/arun-gupta/kubernetes-aws-workshop/issues/135 - "Add Terraform
template for cluster creation”

More Related Content

PDF
Building infrastructure as code using Terraform - DevOps Krakow
PDF
Terraform @Base
PPTX
Final terraform
PPTX
Terraform
PPTX
Comprehensive Terraform Training
PDF
Terraform in deployment pipeline
PDF
Scaling terraform
PDF
What you see is what you get for AWS infrastructure
Building infrastructure as code using Terraform - DevOps Krakow
Terraform @Base
Final terraform
Terraform
Comprehensive Terraform Training
Terraform in deployment pipeline
Scaling terraform
What you see is what you get for AWS infrastructure

What's hot (20)

PPTX
Infrastructure as Code: Introduction to Terraform
PDF
Terraform modules and some of best-practices - March 2019
PDF
How to test infrastructure code: automated testing for Terraform, Kubernetes,...
PPTX
Terraform day1
PPTX
Terraform
PDF
Developing Terraform Modules at Scale - HashiTalks 2021
PDF
Terraform modules and best-practices - September 2018
PPTX
Reusable, composable, battle-tested Terraform modules
PDF
Declarative & workflow based infrastructure with Terraform
PDF
AWS DevOps - Terraform, Docker, HashiCorp Vault
PDF
Terraform in action
PDF
Terraform Introduction
PPTX
Terraform
PDF
Terraform - Taming Modern Clouds
PDF
Terraform at Scale - All Day DevOps 2017
PPTX
Terraform on Azure
PPTX
Infrastructure-as-Code (IaC) Using Terraform (Advanced Edition)
PPTX
Terraform Modules and Continuous Deployment
PDF
Case Study: Using Terraform and Packer to deploy go applications to AWS
PPTX
Terraform modules restructured
Infrastructure as Code: Introduction to Terraform
Terraform modules and some of best-practices - March 2019
How to test infrastructure code: automated testing for Terraform, Kubernetes,...
Terraform day1
Terraform
Developing Terraform Modules at Scale - HashiTalks 2021
Terraform modules and best-practices - September 2018
Reusable, composable, battle-tested Terraform modules
Declarative & workflow based infrastructure with Terraform
AWS DevOps - Terraform, Docker, HashiCorp Vault
Terraform in action
Terraform Introduction
Terraform
Terraform - Taming Modern Clouds
Terraform at Scale - All Day DevOps 2017
Terraform on Azure
Infrastructure-as-Code (IaC) Using Terraform (Advanced Edition)
Terraform Modules and Continuous Deployment
Case Study: Using Terraform and Packer to deploy go applications to AWS
Terraform modules restructured
Ad

Similar to Terraform Q&A - HashiCorp User Group Oslo (20)

PPTX
Terraform Abstractions for Safety and Power
PDF
Instant download Terraform in Depth (MEAP V01) Robert Hafner pdf all chapter
PDF
Terraform 0.12 + Terragrunt
PDF
Manage any AWS resources with Terraform 0.12 - April 2020
PDF
Terraform vs Pulumi
PPTX
[AWSKRUG 아키텍처 모임] 세일즈부스트 인프라스트럭처 사례 공유
PPT
20100707 e z_rmll_gig_v1
PDF
Oracle Cloud - Infrastruktura jako kód
ODP
Drupal Efficiency - Coding, Deployment, Scaling
PDF
Collaborative Terraform with Atlantis
PDF
Terraform Best Practices - DevOps Unicorns 2019
PPTX
Terraform training 🎒 - Basic
PDF
DevOps in Droplr
PDF
Scaleable PHP Applications in Kubernetes
ODP
Drupal Efficiency using open source technologies from Sun
ODP
PHP: The Beginning and the Zend
PDF
Terraform in Depth (MEAP V01) Robert Hafner
PDF
Terraform in Depth (MEAP V01) Robert Hafner
PPTX
Oracle on AWS partner webinar series
PDF
Terraform AWS modules and some best practices - September 2019
Terraform Abstractions for Safety and Power
Instant download Terraform in Depth (MEAP V01) Robert Hafner pdf all chapter
Terraform 0.12 + Terragrunt
Manage any AWS resources with Terraform 0.12 - April 2020
Terraform vs Pulumi
[AWSKRUG 아키텍처 모임] 세일즈부스트 인프라스트럭처 사례 공유
20100707 e z_rmll_gig_v1
Oracle Cloud - Infrastruktura jako kód
Drupal Efficiency - Coding, Deployment, Scaling
Collaborative Terraform with Atlantis
Terraform Best Practices - DevOps Unicorns 2019
Terraform training 🎒 - Basic
DevOps in Droplr
Scaleable PHP Applications in Kubernetes
Drupal Efficiency using open source technologies from Sun
PHP: The Beginning and the Zend
Terraform in Depth (MEAP V01) Robert Hafner
Terraform in Depth (MEAP V01) Robert Hafner
Oracle on AWS partner webinar series
Terraform AWS modules and some best practices - September 2019
Ad

More from Anton Babenko (17)

PDF
What you see is what you get for AWS infrastructure
PDF
Terraform AWS modules and some best-practices - May 2019
PDF
Gotchas using Terraform in a secure delivery pipeline
PDF
Описание инфраструктуры с Terraform на будущее
PDF
Preview of Terraform 0.12 + modules.tf - Kiev HUG meetup
PDF
Terraform modules and (some of) best practices
PDF
Terraform modules and (some of) best practices
PDF
"I’ve heard you know infrastructure"
PPTX
"Continuously delivering infrastructure using Terraform and Packer" training ...
PDF
Continuous delivery in AWS
PDF
Tools exist for a reason
PPTX
AWS CodeDeploy - basic intro
PPTX
Managing AWS infrastructure using CloudFormation
PPTX
Designing for elasticity on AWS - 9.11.2015
PPTX
Recap of AWS re:invent 2015
PPTX
Designing for elasticity on AWS
PDF
Build & deploy PHP application (intro level)
What you see is what you get for AWS infrastructure
Terraform AWS modules and some best-practices - May 2019
Gotchas using Terraform in a secure delivery pipeline
Описание инфраструктуры с Terraform на будущее
Preview of Terraform 0.12 + modules.tf - Kiev HUG meetup
Terraform modules and (some of) best practices
Terraform modules and (some of) best practices
"I’ve heard you know infrastructure"
"Continuously delivering infrastructure using Terraform and Packer" training ...
Continuous delivery in AWS
Tools exist for a reason
AWS CodeDeploy - basic intro
Managing AWS infrastructure using CloudFormation
Designing for elasticity on AWS - 9.11.2015
Recap of AWS re:invent 2015
Designing for elasticity on AWS
Build & deploy PHP application (intro level)

Recently uploaded (20)

PDF
Design an Analysis of Algorithms I-SECS-1021-03
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PPTX
Materi-Enum-and-Record-Data-Type (1).pptx
PPTX
Operating system designcfffgfgggggggvggggggggg
DOCX
The Five Best AI Cover Tools in 2025.docx
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PDF
System and Network Administration Chapter 2
PDF
PTS Company Brochure 2025 (1).pdf.......
PPT
Introduction Database Management System for Course Database
PPTX
Online Work Permit System for Fast Permit Processing
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PPTX
Transform Your Business with a Software ERP System
PDF
Softaken Excel to vCard Converter Software.pdf
PDF
Digital Strategies for Manufacturing Companies
PPT
JAVA ppt tutorial basics to learn java programming
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PPTX
ISO 45001 Occupational Health and Safety Management System
PPTX
Materi_Pemrograman_Komputer-Looping.pptx
Design an Analysis of Algorithms I-SECS-1021-03
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
Materi-Enum-and-Record-Data-Type (1).pptx
Operating system designcfffgfgggggggvggggggggg
The Five Best AI Cover Tools in 2025.docx
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
System and Network Administration Chapter 2
PTS Company Brochure 2025 (1).pdf.......
Introduction Database Management System for Course Database
Online Work Permit System for Fast Permit Processing
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
How to Migrate SBCGlobal Email to Yahoo Easily
Transform Your Business with a Software ERP System
Softaken Excel to vCard Converter Software.pdf
Digital Strategies for Manufacturing Companies
JAVA ppt tutorial basics to learn java programming
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
Design an Analysis of Algorithms II-SECS-1021-03
ISO 45001 Occupational Health and Safety Management System
Materi_Pemrograman_Komputer-Looping.pptx

Terraform Q&A - HashiCorp User Group Oslo

  • 1. HashiCorp User Group Oslo 20.11.2017 https://meetup.com/Oslo-HashiCorp-User-Group/
  • 2. Food sponsor: Agenda - initial commit 1. About this user group 2. Terraform questions & problems 3. Terraform Q&A Want to be a speaker? Send an email - [email protected]
  • 3. About this user group This HashiCorp User Group Oslo is the place where interested people gather once every couple months to learn from each other  about HashiCorp products— what we do, how we do it, and how can we do it differently. While I generally strive to make such meetups interesting for the participants, I am often against the repetitive talks which can be found online easily. Latest editition: 20.11.2017 Anton Babenko, CEO at Betajob linkedin.com/in/antonbabenko github.com/antonbabenko [email protected] Keywords: All-5 AWS certified, DevOps, infrastructure as code, automation, open-source, community member and events organiser, Terraform modules, solution architectures, serverless. About me
  • 6. Featuring... Write, Plan, and Create Infrastructure as Code
  • 7. Terraform 101 (main.tf) provider "aws" { region = "eu-west-1" } resource "random_pet" "bucket" {} resource "aws_s3_bucket" "app" { bucket = "hi-${random_pet .bucket. id}" website { index_document = "index.html" } } data "template_file" "index" { template = "${file("index.html")}" vars { BUCKET = "${aws_s3_bucket .app.website_endpoint }" } } resource "aws_s3_bucket_object" "object" { bucket = "${aws_s3_bucket .app.id}" key = "index.html" content = "${data. template_file .index.rendered }" etag = "${md5(data. template_file .index.rendered )}" content_type = "text/html" acl = "public-read" } output "app_website_endpoint" { value = "${aws_s3_bucket .app.website_endpoint }" } index.html can access: ${BUCKET} $ terraform init $ terraform plan $ terraform apply Apply complete! Resources: 3 added, 0 changed, 0 destroyed. Outputs: app_website_endpoint = hi-feasible-basilisk.s3-website-eu-west-1.a mazonaws.com
  • 9. Why Terraform and not AWS CloudFormation/Azure ARM templates/Google Cloud Deployment Manager? Terraform manages 70+ providers, has easier syntax (HCL), has native support for modules and remote states, has team-work features. Terraform is an open-source project (640 - AWS provider, 1100 - core). https://medium.com/@piotrgospodarek/cloudformation-vs-terraform-990318d6a7de https://cloudonaut.io/cloudformation-vs-terraform/ https://www.slideshare.net/AntonBabenko/continuously-delivering-infrastructure-using-terrafo rm-and-packer-training-material
  • 10. Tord P.: What is the point of using these tools if you’re running AWS only, e.g. isn’t Terraform just a an unnecessary abstraction, why not stick to CloudFormation? Terraform manages 70+ providers, has easier syntax (HCL), has native support for modules and remote states, has team-work features. Terraform is an open-source project. Abstractions (primitives and modules) are necessary and easily available (Terraform Registry).
  • 11. What are the most common tools/solutions out there? ● Terraform Module Registry to discover modules for common infrastructure configurations for any provider - https://registry.terraform.io/ (I maintain verified AWS modules there) ● Thin wrapper for Terraform that provides extra tools for working with multiple Terraform modules - https://github.com/gruntwork-io/terragrunt ● Terraform linter for detecting errors that can not be detected by `terraform plan` - https://github.com/wata727/tflint ● Terraform version manager - https://github.com/kamatama41/tfenv This list is much longer, really…
  • 12. How to handle secrets in Terraform? 1. Can you accept secrets to be saved in state file in plaintext? Probably not. a. AWS IAM password & access secret keys - use PGP as keybase.io b. AWS RDS - set dummy password and change after DB is created c. AWS RDS - use iam_database_authentication_enabled = true d. EC2 instance user-data + AWS KMS 2. Other options: a. Secure remote state location (S3 bucket policy, KMS key)
  • 13. How to get started? 1. Install and getting started - https://www.terraform.io/intro/getting-started/install.html 2. Get infrastructure modules from Terraform Registry. For example, AWS modules - https://registry.terraform.io/modules/terraform-aws-modules 3. Follow instructions in README.md, check examples, open issues and pull requests.
  • 15. Upgraded Terraform version, and there is a breaking bug, so I want to rollback, but I can’t because state file has been upgraded already. ● State file should be versioned (!), download previous version of state file, run “terraform state push old_version.tfstate” ● Lock terraform version, lock module and providers version (new in 0.11) ● Read upgrade guides and CHANGELOG.md files: ○ https://www.terraform.io/upgrade-guides/0-11.html ○ https://github.com/hashicorp/terraform/blob/master/CHANGELOG.md ○ https://github.com/terraform-providers/terraform-provider-aws/blob/master/CHANG ELOG.md
  • 16. What is your Terraform question or problem? PS: Maybe something about testing? Versioning? Code structure? Working as a team? CI/CD? Automation? Integration with other tools? https://modules.tf/ ? Code generation? Missing tools/features? Syntax sugar (features and types of variables)? How to contribute?