SlideShare a Scribd company logo
Packer, Terraform & Jenkins
IaC & CD for small stacks
Simon McCartney
Twitter: @simonmcc
Packer, Terraform & Jenkins - DevOpsBelfast March 2019
Packer, Terraform & Jenkins - DevOpsBelfast March 2019
Packer, Terraform & Jenkins - DevOpsBelfast March 2019
Packer, Terraform & Jenkins - DevOpsBelfast March 2019
Background:
Isn’t this a solved problem?
Background:
Don’t containers solve
everything?
Making innovation easy
What does the pipeline look like?
•Simple master/!master path
Goal 1: Traceable Images
• What was this image built from?
• Project, branch, SHA, clean, dirty
• Store it inside the image and
externally via tags
Goal 2: Testable Images
• Validate that an image is good
• Chef’s InSpec for os/infra
• App/Service specific testing
Goal 3: Self Contained POC
• Monorepo FTW, single pipeline
• Minimal Jenkins Plugins
• Sanity wrappers for Terraform & Packer
• Terraform for the app
• Terraform for the build environment
Jenkins from day 1
•Write tools & wrappers that work by default
in Jenkins, easy path for non-interactive use
•Disposable Jenkins setup – no dirty clicking
Jenkins Configuration as Code, Job DSL &
Jenkinsfile, docker container for local
experiments
https://github.com/jenkins201/jenkins-container
Packer Wrapper – build.sh
•Modeled on base & app AMI
•Expose git SHA & clean/dirty state to packer
for including in tags etc (‘cos CLI building
should still be possible!)
•Only build base/app AMI when necessary
tf-wrapper.sh
•Terraform wrapper
•Map git branch to terraform workspace
•Map git branch to tfvars
•Expose git branch & sha to aid tagging &
building unique resources (RDS Instance
etc)
tf-wrapper.sh
•Configure terraform remote state
render backend_config.tf
AWS: create s3 bucket & DynamoDB
Azure: create Resource Group & Storage Account
Demo
Tips
•Watch out for account or globally unique
resources (that’s why we expose branch &
SHA1 to packer & terraform)
•SHA1 for images in this POC is weak – it’s
of a git object that “mostly” represents the
image build source.
•Jenkins aws-credentials & docker agent is
broken :(
Links
•https://github.com/simonmcc/cfgmgmtcmp-2019-
iac-ci-cd
•https://github.com/jenkins201/jenkins-container
•Twitter: @simonmcc
•https://www.axon.com
We’re hiring!
SRE, Remote UK & EU
Packer, Terraform & Jenkins - DevOpsBelfast March 2019
Packer, Terraform & Jenkins - DevOpsBelfast March 2019
Packer, Terraform & Jenkins - DevOpsBelfast March 2019

More Related Content

PPTX
Packer, Terraform & Jenkins
PPTX
Multitasking and Triggered Background Processing in Windows Phone 8.1
PDF
Driving Stage3D: A Post Mortem by Nate Beck and Jeremy Saenz
PDF
More Productivitiy with Spring Roo
PPTX
Electrode Native Platform
PDF
Oscon presentation
PPTX
Aleksey_Demedetskiy_Jenkins
PDF
JAZOON'13 - Stefan Saasen - Real World Git Workflows
Packer, Terraform & Jenkins
Multitasking and Triggered Background Processing in Windows Phone 8.1
Driving Stage3D: A Post Mortem by Nate Beck and Jeremy Saenz
More Productivitiy with Spring Roo
Electrode Native Platform
Oscon presentation
Aleksey_Demedetskiy_Jenkins
JAZOON'13 - Stefan Saasen - Real World Git Workflows

What's hot (10)

PDF
The Architect Way - JSCamp.asia 2012
PPT
Cross platform native development with appcelerator titanium (2014 devnexus)
PPTX
Zero to the Cloud with @NetflixOSS
PPSX
Yeoman - Santa Barbara JavaScript Meetup
PDF
Jenkins2: How Jenkins 2 works and how to automate it
PDF
STAQ Development Manual (Redacted)
PPTX
Android Functional UI Testing at Amplify
PDF
SplunkLive Brisbane Splunk for Developers
PDF
SplunkLive Melbourne Splunk for Developers
PPTX
2 years with Angular & Electron: Video Hub App 2
The Architect Way - JSCamp.asia 2012
Cross platform native development with appcelerator titanium (2014 devnexus)
Zero to the Cloud with @NetflixOSS
Yeoman - Santa Barbara JavaScript Meetup
Jenkins2: How Jenkins 2 works and how to automate it
STAQ Development Manual (Redacted)
Android Functional UI Testing at Amplify
SplunkLive Brisbane Splunk for Developers
SplunkLive Melbourne Splunk for Developers
2 years with Angular & Electron: Video Hub App 2
Ad

Similar to Packer, Terraform & Jenkins - DevOpsBelfast March 2019 (20)

PPTX
How Build Infrastructure Powers the Node.js Foundation
PDF
Jenkins-Koji plugin presentation on Python & Ruby devel group @ Brno
PDF
Documenting apps ti confnyc
PDF
TiConf NYC - Documenting Your Titanium Applications
PPTX
Build software like a bag of marbles, not a castle of LEGO®
PDF
OpNovember Water Cooler Talk: The Mystery of Domino on Docker - Part 1
PPTX
Mastering-Docker-for-Developers for .pptx
KEY
Using Jenkins with iOS projects
PDF
Containerizing Python: Building efficient containers for Python applications
PDF
Version your build process as you version your code
PDF
Standing on the Shoulders of Giants: How Community Shapes Development in Elli...
PPTX
PDE builds or Maven
PDF
MEAN Stack WeNode Barcelona Workshop
PPTX
Docker for developers - The big picture
PPTX
Continuous integration jenkins-installation in ec2 instace linux
PDF
Docker {at,with} SignalFx
PDF
Intro to ionic 2
KEY
Continuous Delivery Using Jenkins
PPTX
Microfrontends Monoreops & Trunkbased based
PDF
Docker at and with SignalFx
How Build Infrastructure Powers the Node.js Foundation
Jenkins-Koji plugin presentation on Python & Ruby devel group @ Brno
Documenting apps ti confnyc
TiConf NYC - Documenting Your Titanium Applications
Build software like a bag of marbles, not a castle of LEGO®
OpNovember Water Cooler Talk: The Mystery of Domino on Docker - Part 1
Mastering-Docker-for-Developers for .pptx
Using Jenkins with iOS projects
Containerizing Python: Building efficient containers for Python applications
Version your build process as you version your code
Standing on the Shoulders of Giants: How Community Shapes Development in Elli...
PDE builds or Maven
MEAN Stack WeNode Barcelona Workshop
Docker for developers - The big picture
Continuous integration jenkins-installation in ec2 instace linux
Docker {at,with} SignalFx
Intro to ionic 2
Continuous Delivery Using Jenkins
Microfrontends Monoreops & Trunkbased based
Docker at and with SignalFx
Ad

Recently uploaded (20)

PDF
Mushroom cultivation and it's methods.pdf
PDF
Encapsulation theory and applications.pdf
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
1 - Historical Antecedents, Social Consideration.pdf
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PDF
Heart disease approach using modified random forest and particle swarm optimi...
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PPTX
Tartificialntelligence_presentation.pptx
PPTX
A Presentation on Artificial Intelligence
PDF
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
PDF
Enhancing emotion recognition model for a student engagement use case through...
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
August Patch Tuesday
PDF
WOOl fibre morphology and structure.pdf for textiles
PDF
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
PDF
project resource management chapter-09.pdf
PDF
Accuracy of neural networks in brain wave diagnosis of schizophrenia
Mushroom cultivation and it's methods.pdf
Encapsulation theory and applications.pdf
Unlocking AI with Model Context Protocol (MCP)
1 - Historical Antecedents, Social Consideration.pdf
Assigned Numbers - 2025 - Bluetooth® Document
Heart disease approach using modified random forest and particle swarm optimi...
MIND Revenue Release Quarter 2 2025 Press Release
Tartificialntelligence_presentation.pptx
A Presentation on Artificial Intelligence
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
Enhancing emotion recognition model for a student engagement use case through...
Building Integrated photovoltaic BIPV_UPV.pdf
August Patch Tuesday
WOOl fibre morphology and structure.pdf for textiles
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
Digital-Transformation-Roadmap-for-Companies.pptx
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
project resource management chapter-09.pdf
Accuracy of neural networks in brain wave diagnosis of schizophrenia

Packer, Terraform & Jenkins - DevOpsBelfast March 2019

Editor's Notes

  • #3: Who are Axon – we’re a leading supplier of software & services to the blue light industry, also known as public safety, our first product was the Taser, something so good it became a verb, Taser continues to be an important product for us, but we also provide a Digital Evidence Management System that’s a key element to our body camera division, and that’s where I work, I’m an SRE at evidence.com, helping build & operate the platform that hosts our services all over the world, managing video footage and other evidential material for police forces and other blue light industries all over the world.
  • #7: If you google enough or have been going to infrastructure management conferences for a few years, it would be easy to think that VM image baking ios a solved problem, we’ve been talking about it for ages, there are tools that do some of the essentials, but in my opinion, there was still a lot left as an exercise for the student. I started a new job recently, and we have a infrastructure that’s state of the art for the year 2010, terraform for cloud based infrastructure, puppet & salt for long lived VMs configuration management, but this leads to pain & bad practices, like manually resizing VMs & editing the terraform to keep sync, adding VMs to cope with a demand spike is painful, removing them is even more painful, you've got puppet certs, manual DNS, discovery via hieradata, all solved problems in some way.
  • #8: Nope. Many of our services are moving to k8s managed containers, but not everything will, for good & bad reasons. There are also some environments & companies where they’re just not interested in the k8s & PaaS overhead, they just want somewhere better to run their LAMP stack apps that fits with their appetite for change.
  • #9: As my new work environment was a little cumbersome to innovate & iterate in, I decided to do a POC outside our internal constraints & came up with a model of a simple linux web app stack & concentrate on what tools I would need, what the Jenkins pipeline might look like if I wanted to build & test on a PR branch and deploy to production from master.
  • #11: Back to what triggered this in work, I was delighted when I found a GitHub repo in our org called ops/packer – yes I thought, somebody has already done the hard work, we had layered packer templates to build out various things, TeamCity build agents, base images for CentOS in our 2 main cloud providers. Then I looked at the AMIs & VHDs in our accounts – I had no idea where they came from, which template built them, from which branch, when? I started googling again, Netflix’s aminator has some hooks for some of that, but nothing concrete, and aminator is strictly AWS, we’re 90% Azure.
  • #12: The next challenge I had was proving that an image was actually good – how do I know that I haven’t just broken something or broken some security policy by tweaking something, or worse, an assumption on an installed package & that installed package changed a default, Chef’s InSpec tools allows you to do much of that, it’s also great at ensuring that you’re in compliance with security baselines, either internal or external (CIS), I’m not an InSpec expert, but I think we have a couple of Chef employees in the room who are actually paid to work on InSpec, so you should find them & poke them for more details if you’re interested.