SlideShare a Scribd company logo
Cloudnatives Irvine
Feb 2020
● Cloud Engineer, Kong
● Previously Zenedge, DreamHost, Blizzard
● Nginx/OpenResty, Terraform contributor
● Various shenanigans, holliganery, nogoodknickery
3
resource “aws_instance” “foo” {
count = 1
instance_type = “m5.large”
tags = [
“foo”
]
}
resource “aws_instance” “foo” {
count = 3
instance_type = “m5.large”
tags = [
“foo”
]
}
6
module "servers" {
source = "./app-cluster"
servers = 5
}
● Abstraction
● Parameterization
● Re-use
● Versioning
● Decoupling
8
9
● aws_acm_certificate
● aws_route53_record
● aws_acm_certificate_validation
● aws_kms_key
● aws_launch_configuration
● aws_autoscaling_group
● aws_lb
● aws_instance
● aws_iam_role_policy_attachment
● aws_kms_alias
● aws_kms_grant
● aws_subnet_ids
● aws_caller_identity
● aws_vpc
● aws_route53_zone
● aws_lb_listener
● aws_lb_target_group
● aws_route53_record
● aws_security_group_rule
● aws_vpc_endpoint_service
● aws_iam_policy
● aws_s3_bucket
● aws_iam_role
● aws_iam_service_linked_role
● aws_vpc_endpoint_service_allowed_
principal
● aws_route
● aws_db_subnet_group
● aws_elasticache_subnet_group
10
module "worker-pool" {
source = "worker"
servers = 3
volume_size = 20
instance_type = “m5.large”
}
module "batch-pool" {
source = "worker"
servers = 2
volume_size = 500
instance_type = “c5.xlarge”
}
12
13
● Testing internal implementation
● New feature sets
● Parameter/call design deprecation
● Provider lifecycle support
14
module "consul" {
source = "hashicorp/consul/aws"
version = "0.0.5"
servers = 3
}
Managing Terraform Module Versioning and Dependencies
17
● Terraform Registry
● Git (GitHub)
● Mercurial
module "vpc" {
source = "git@github.com:corp/tfmodule-vpc.git ?ref=master"
}
19
module "vpc" {
source = "git@github.com:corp/tfmodule-vpc.git?ref=${var.vpc-version}"
}
21
22
type module struct {
Source string `yaml:"source"`
Version string `yaml:"version"`
}
cmd := exec.Command("git", "clone",
"--single-branch", "--depth=1", "-b",
version, repository, moduleName)
$ cat kong/worker/env/dev/us-west-2.yml
module:
source: "git@github.com:Kong/tf-module.git"
version: "v0.23"
24
$ cat kong/worker/env/dev/us-west-2.yml
module:
source: "git@github.com:Kong/tf-module.git"
version: "v0.23"
$ cat kong/worker/env/dev/us-west-2.yml
module:
source: "git@github.com:Kong/tf-module.git"
version: "v0.23"
$ cat kong/worker/env/ dev/us-west-2.yml
module:
source: "git@github.com:Kong/tf-module.git"
version: "v0.23"
$ cat kong/worker/env/dev/ us-west-2.yml
module:
source: "git@github.com:Kong/tf-module.git"
version: "v0.23"
$ deploy.sh [module] [vpc] [region] [environment]
30
resource “aws_lb” “foo” {
...
}
output “lb_dns_name” {
value = aws_lb.foo.dns_name
}
module "foo" {
source = "../foo"
}
module “bar” {
source = “../bar”
lb = module.foo.lb_dns_name
}
Module Caller
● Terraform manages lifecycle/dependency
● State file size/sync time
● Circular dependencies
● Terraform lifecycle limitations
32
data “aws_lb” “foo” {
name = “foo”
}
resource “foo” “bar” {
value = data.aws_lb.foo.dns_name
}
● Smaller state file
● Shorter sync time
● Provider-based definition of infrastructure
● Problem: missing data at runtime...
34
35
36
37
module:
source: "git@github.com:Kong/tf-module.git"
version: "v0.23"
depends:
- vpc
- controller
● Each module has zero or more dependents
● Each module has zero or more dependencies
● Modules with no unresolved dependencies can execute
simultaneously
● … this is starting to sound a little familiar
38
Managing Terraform Module Versioning and Dependencies
● Collect all module dependencies
● Sort via tsort
● Apply modules in order of response
40
41
$ cat worker.yml
module:
source: "git@github.com:Kong/tf-module.git"
version: "v0.23"
depends:
- vpc
- controller
$ cat grafana.yml
module:
source: "git@github.com:Kong/tf-module.git"
version: "v0.23"
depends:
- worker
- prometheus
$ ./deps.sh
vpc
controller
worker
vault
es
bastion
prometheus
jenkins
httpbin
public-lb
logstash
grafana
$ deploy.sh [module] [vpc] [region] [environment]
$ for module in $(./deps.sh); do
deploy.sh [module] [vpc] [region] [environment]
done
● Small modules
● Version pinning (what do mean, no more go on green?)
● Indirect (data) dependencies
● Module vs caller - twice the commits!
45
46
47
48
module “job” {
source = “./kong/module/nomad-job”
resources = {
memory = 100
cpu = 100
}
image = “nginx”
count = 3
template {
...
}
ports {
...
}
}
50
module "job" {
source = "../nomad-job"
name = "grafana"
public = true
jobspec = templatefile(
format("%s/grafana.nomad.tmpl", path.module),
{
tag = "latest",
}
)
}
resource "aws_route53_record" "main" {
count = var.public == true ? 1 : 0
zone_id = data.aws_route53_zone.zone.zone_id
name = var.name
type = "A"
alias {
name = data.aws_lb.worker.dns_name
zone_id = data.aws_lb.worker.zone_id
evaluate_target_health = false
}
}
resource "aws_route53_record" "main" {
count = var.public == true ? 1 : 0
zone_id = data.aws_route53_zone.zone.zone_id
name = var.name
type = "A"
alias {
name = data.aws_lb.worker.dns_name
zone_id = data.aws_lb.worker.zone_id
evaluate_target_health = false
}
}
● Re-using existing deployment pipelines
● Very strong integration of Hashicorp tools
● Nomad-powered lifecycle management
○ Canary / blue-green
○ Native Consul integration
○ Native Vault integration
54
55

More Related Content

PDF
AWS 환경에서 MySQL BMT
PDF
FLiP Into Trino
PDF
MongoDB Performance Tuning
PDF
ClickHouse Data Warehouse 101: The First Billion Rows, by Alexander Zaitsev a...
PPT
Logstash
PPT
WebLogic Scripting Tool Overview
PPTX
Understand oracle real application cluster
PPTX
AWS 환경에서 MySQL BMT
FLiP Into Trino
MongoDB Performance Tuning
ClickHouse Data Warehouse 101: The First Billion Rows, by Alexander Zaitsev a...
Logstash
WebLogic Scripting Tool Overview
Understand oracle real application cluster

What's hot (20)

PDF
Introduction to influx db
PDF
Oracle Performance Tuning Fundamentals
PDF
My first 90 days with ClickHouse.pdf
PDF
Getting Started with Confluent Schema Registry
PDF
Data Quality With or Without Apache Spark and Its Ecosystem
PPTX
AWS CloudWatch
PDF
Collaborative Editing Tools for Alfresco
PPTX
Zookeeper 활용 nifi clustering
PDF
ksqlDB로 실시간 데이터 변환 및 스트림 처리
PDF
Configuration management II - Terraform
PDF
Oracle DB를 AWS로 이관하는 방법들 - 서호석 클라우드 사업부/컨설팅팀 이사, 영우디지탈 :: AWS Summit Seoul 2021
PPTX
Elastic Stack Introduction
PDF
Deploying Flink on Kubernetes - David Anderson
PDF
[AWS Dev Day] 앱 현대화 | DevOps 개발자가 되기 위한 쿠버네티스 핵심 활용 예제 알아보기 - 정영준 AWS 솔루션즈 아키...
PPTX
SOQL & SOSL for Admins
PDF
Redis - Usability and Use Cases
PDF
SpringBoot 3 Observability
PDF
Fault Tolerance 패턴
PDF
Mastering PostgreSQL Administration
 
PDF
Introduction to Apache Beam
Introduction to influx db
Oracle Performance Tuning Fundamentals
My first 90 days with ClickHouse.pdf
Getting Started with Confluent Schema Registry
Data Quality With or Without Apache Spark and Its Ecosystem
AWS CloudWatch
Collaborative Editing Tools for Alfresco
Zookeeper 활용 nifi clustering
ksqlDB로 실시간 데이터 변환 및 스트림 처리
Configuration management II - Terraform
Oracle DB를 AWS로 이관하는 방법들 - 서호석 클라우드 사업부/컨설팅팀 이사, 영우디지탈 :: AWS Summit Seoul 2021
Elastic Stack Introduction
Deploying Flink on Kubernetes - David Anderson
[AWS Dev Day] 앱 현대화 | DevOps 개발자가 되기 위한 쿠버네티스 핵심 활용 예제 알아보기 - 정영준 AWS 솔루션즈 아키...
SOQL & SOSL for Admins
Redis - Usability and Use Cases
SpringBoot 3 Observability
Fault Tolerance 패턴
Mastering PostgreSQL Administration
 
Introduction to Apache Beam
Ad

Similar to Managing Terraform Module Versioning and Dependencies (20)

PPTX
introduction to node.js
PPTX
Distributed Automation(2018) - London Test Automation in Devops Meetup
PDF
Automating Complex Setups with Puppet
PDF
Integrating ChatGPT with Apache Airflow
PPTX
Introduction to kubernetes
PDF
10 things i wish i'd known before using spark in production
PDF
Automating complex infrastructures with Puppet
PDF
Our Puppet Story (GUUG FFG 2015)
PDF
Building the Enterprise infrastructure with PostgreSQL as the basis for stori...
PPTX
Kubernetes Navigation Stories – DevOpsStage 2019, Kyiv
PDF
Testing kubernetes and_open_shift_at_scale_20170209
PDF
FIWARE Tech Summit - Docker Swarm Secrets for Creating Great FIWARE Platforms
PDF
Monitoring Docker at Scale - Docker San Francisco Meetup - August 11, 2015
KEY
Grabbing the PostgreSQL Elephant by the Trunk
PDF
Kubernetes - Starting with 1.2
PPTX
Orchestration tool roundup kubernetes vs. docker vs. heat vs. terra form vs...
PPTX
Uri Cohen & Dan Kilman, GigaSpaces - Orchestration Tool Roundup - OpenStack l...
PDF
Live deployment, ci, drupal
PPTX
Monitoring_with_Prometheus_Grafana_Tutorial
PPTX
Managing and Scaling Puppet - PuppetConf 2014
introduction to node.js
Distributed Automation(2018) - London Test Automation in Devops Meetup
Automating Complex Setups with Puppet
Integrating ChatGPT with Apache Airflow
Introduction to kubernetes
10 things i wish i'd known before using spark in production
Automating complex infrastructures with Puppet
Our Puppet Story (GUUG FFG 2015)
Building the Enterprise infrastructure with PostgreSQL as the basis for stori...
Kubernetes Navigation Stories – DevOpsStage 2019, Kyiv
Testing kubernetes and_open_shift_at_scale_20170209
FIWARE Tech Summit - Docker Swarm Secrets for Creating Great FIWARE Platforms
Monitoring Docker at Scale - Docker San Francisco Meetup - August 11, 2015
Grabbing the PostgreSQL Elephant by the Trunk
Kubernetes - Starting with 1.2
Orchestration tool roundup kubernetes vs. docker vs. heat vs. terra form vs...
Uri Cohen & Dan Kilman, GigaSpaces - Orchestration Tool Roundup - OpenStack l...
Live deployment, ci, drupal
Monitoring_with_Prometheus_Grafana_Tutorial
Managing and Scaling Puppet - PuppetConf 2014
Ad

More from Nebulaworks (19)

PDF
Dynamic Policy Enforcement for Microservice Environments
PDF
Overcoming scalability issues in your prometheus ecosystem
PDF
Why we chose Argo Workflow to scale DevOps at InVision
PDF
Methods to stay focused & productive amidst COVID-19!
PDF
Embracing service-level-objectives of your microservices in your Cl/CD
PDF
Embacing service-level-objectives of your microservices in your Cl/CD
PDF
Deploying to Day N Operations of Kubernetes and Containerized Apps
PDF
Trunk based development for Beginners
PDF
Distributed tracing with service meshes and tracing spans across polyglot Mic...
PDF
Kubernetes for Beginners
PDF
End to End immutable infrastructure testing
PDF
Building Modern Teams and Software
PDF
Kuberntes Ingress with Kong
PDF
A Hands-on Introduction on Terraform Best Concepts and Best Practices
PDF
The App Developer's Kubernetes Toolbox
PDF
Building a Container Platform with docker swarm
PDF
Effective Micoservice Design & Containers
PDF
Fast Tracking Dev Teams to Container Adoption
PDF
Nebulaworks | Optimize Your DevOps Game
Dynamic Policy Enforcement for Microservice Environments
Overcoming scalability issues in your prometheus ecosystem
Why we chose Argo Workflow to scale DevOps at InVision
Methods to stay focused & productive amidst COVID-19!
Embracing service-level-objectives of your microservices in your Cl/CD
Embacing service-level-objectives of your microservices in your Cl/CD
Deploying to Day N Operations of Kubernetes and Containerized Apps
Trunk based development for Beginners
Distributed tracing with service meshes and tracing spans across polyglot Mic...
Kubernetes for Beginners
End to End immutable infrastructure testing
Building Modern Teams and Software
Kuberntes Ingress with Kong
A Hands-on Introduction on Terraform Best Concepts and Best Practices
The App Developer's Kubernetes Toolbox
Building a Container Platform with docker swarm
Effective Micoservice Design & Containers
Fast Tracking Dev Teams to Container Adoption
Nebulaworks | Optimize Your DevOps Game

Recently uploaded (20)

PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PPTX
Reimagine Home Health with the Power of Agentic AI​
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PPTX
ai tools demonstartion for schools and inter college
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PDF
Softaken Excel to vCard Converter Software.pdf
PDF
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PDF
wealthsignaloriginal-com-DS-text-... (1).pdf
PPTX
Computer Software and OS of computer science of grade 11.pptx
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PPTX
Operating system designcfffgfgggggggvggggggggg
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
Reimagine Home Health with the Power of Agentic AI​
How to Choose the Right IT Partner for Your Business in Malaysia
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
Navsoft: AI-Powered Business Solutions & Custom Software Development
ai tools demonstartion for schools and inter college
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
Upgrade and Innovation Strategies for SAP ERP Customers
Internet Downloader Manager (IDM) Crack 6.42 Build 41
Softaken Excel to vCard Converter Software.pdf
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
wealthsignaloriginal-com-DS-text-... (1).pdf
Computer Software and OS of computer science of grade 11.pptx
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
VVF-Customer-Presentation2025-Ver1.9.pptx
Which alternative to Crystal Reports is best for small or large businesses.pdf
Operating system designcfffgfgggggggvggggggggg

Managing Terraform Module Versioning and Dependencies