SlideShare a Scribd company logo
How secure are your Terraform sensitive values?
HOW SECURE ARE YOUR
TERRAFORM
SENSITIVE VALUES?_
Marko Bevc
SECURE
ENOUGH?_
“Security through obscurity should
never be the only security
mechanism!”
ABOUT
ME_ ●
Senior Consultant at The Scale Factory (DevOps consultancy, AWS
advanced consulting partner and K8s service provider)
●
Ops background: Senior IT infrastructure engineer and System
Architect (extensive Linux and virtualization experience)
●
Certifications and competencies: AWS, CKA, RHEL, HCTA
●
Open source contributor and supporter
●
Fan of automation/simplifying things, hiking, cycling and travelling
@_MarkoB
https://www.linkedin.com/in/marko-bevc/
TOPICS
COVERED_ ●
Terraform workflows (security aspect and exposure,
attack vector and risks)
●
Sensitive values leaks & prevention
●
Demo and code examples
●
Conclusions and takeaways
INFRASTRUCTURE
TF WORKFLOW
OVERVIEW_
DATA
REGULAR
PROCESSES
REGULAR
PROCESSES
WORKLOADS
network
WORKFLOWS
EXPOSURE_
• Workflow types:
–CLI (OSS binary) and wrappers (TerraGrunt)
–Automated pipeline runs (Atlantis, GitHub Actions,
CircleCI)
–Managed SaaS offering (TFC)
• Results in shift of exposure points:
–code and repository
–state/lock
–execution environment and sensitive values
–security perimeter & responsibility!
SECRETS IN
CODE_
• Most “obvious” pitfall to avoid
• Hard-coded secretes/ sensitive values in code
• Terraform repository scanning, code reviews and good team
security awareness/culture
• Remediation:
– Dynamically inject from environment
– Stored externally in a sealed environment (Vault/HCP, AWS
SecretsManager/SSM, Google, etc.) with encryption at rest +
transit
– Randomization to reduce risk points (human factor*)
• Is this enough?
#1
KEEPING
STATE SECURE_
●
More interesting and most important security aspect
●
Even if using external secrets (injected or secure
solution) Terraform needs to keep state current in order
to detect changes
●
Solution: ensure state is safe (encryption at rest/transit
and access control)
●
Native encryption in the state is hard - deprecated!
#2
OUTPUT AND
AUDIT TRAIL_
• Usually forgotten
• Logging and backups can also reveal sensitive information
• Terraform 0.14+ has a concept of ‘sensitive’ values (variables,
providers), but it is not encrypting or obscuring it in the state!
• Responsibility might differ in workflows
• Keeping clean logs and trails is a good practice (also personal
information)
• Also don’t forget about log encryption and control access
#3
variable "db-pass" {
type = string
description = "Default DB password"
default = null
sensitive = true
}
resource "aws_db_instance" "db" {
allocated_storage = 10
allow_major_version_upgrade = true
apply_immediately = true
storage_type = "gp2"
engine = "mariadb"
engine_version = "10.5"
instance_class = "db.t2.micro"
name = "mydb"
username = "username"
password = var.db-pass
skip_final_snapshot = true
}
example.tf
TIME FOR
DEMO!_
CONCLUSIONS_
& TAKEAWAYS
●
Security is hard!
●
Protect your crown jewels:
– repository code
– state
– output/logs
●
Use multiple layers of security, scan code and defence in depth
(tfsec, checkov, AWS Config, Cloud custodian, Prowler)
●
Familiarise people with responsibilities and procedure - not just
technical problem
●
Avoid weak links in the IaC security chain
●
Resources:
– https://www.scalefactory.com/blog/2020/12/02/are-we-there-yet-terraform-0.14/
– https://www.terraform.io/docs/extend/best-practices/sensitive-state.html
– https://blog.gruntwork.io/a-comprehensive-guide-to-managing-secrets-in-your-terraform-code-
1d586955ace1
– https://geekflare.com/aws-vulnerability-scanner/
– https://thorsten-hans.com/six-golden-rules-of-infrastructure-as-code-iac
– https://docs.aws.amazon.com/secretsmanager/latest/userguide/intro.html
– https://www.terraform.io/cloud
– https://www.vaultproject.io/
– https://www.hashicorp.com/cloud-platform
FURTHER
READING_
KEEP IN
TOUCH_
https://www.scalefactory.com/
@_MarkoB
@mbevc1
@mbevc1
https://www.linkedin.com/in/marko-bevc/
https://www.scalefactory.com/
Web:
Twitter:
GitHub:
GitLab:
LinkedIn:

More Related Content

PDF
Terraform 0.13: Rise of the modules
PPTX
Nomad + Flatcar: a harmonious marriage of lightweights
PDF
Altitude SF 2017: Nomad and next-gen application architectures
PDF
Hey Terraform, build me GCP Infrastructure
PDF
Altitude SF 2017: Stories from TED
PDF
Nomad Multi-Cloud
ODP
Devoxx 2016 talk: Going Global with Nomad and Google Cloud Platform
PPTX
Effective terraform
Terraform 0.13: Rise of the modules
Nomad + Flatcar: a harmonious marriage of lightweights
Altitude SF 2017: Nomad and next-gen application architectures
Hey Terraform, build me GCP Infrastructure
Altitude SF 2017: Stories from TED
Nomad Multi-Cloud
Devoxx 2016 talk: Going Global with Nomad and Google Cloud Platform
Effective terraform

What's hot (20)

PDF
Getting Started with Consul
PDF
2020-02-20 - HashiTalks 2020 - HashiCorp Vault configuration as code via Hash...
PDF
Containment without Containers: Running Windows Microservices on Nomad
PPTX
HBaseConEast2016: Practical Kerberos with Apache HBase
PPTX
Openstack study-nova-02
PDF
London HUG 8/3 - Nomad
PPTX
Microservices with docker swarm and consul
PDF
Consul: Service-oriented at Scale
PDF
Ground Control to Nomad Job Dispatch
PDF
Terraform: An Overview & Introduction
PDF
Migratory Workloads Across Clouds with Nomad
PPTX
Building Microservices with Spring Cloud and Netflix OSS
PDF
Openstack Scheduler and Scalability Issue
PPTX
OpenStack Keystone with LDAP
PDF
Deploying Docker Containers at Scale with Mesos and Marathon
PDF
Geode on Docker
PDF
Service Discovery 101
PPTX
02 terraform core concepts
ODP
Divide and conquer: resource segregation in the OpenStack cloud
PDF
Real-Time Data Processing Pipeline & Visualization with Docker, Spark, Kafka ...
Getting Started with Consul
2020-02-20 - HashiTalks 2020 - HashiCorp Vault configuration as code via Hash...
Containment without Containers: Running Windows Microservices on Nomad
HBaseConEast2016: Practical Kerberos with Apache HBase
Openstack study-nova-02
London HUG 8/3 - Nomad
Microservices with docker swarm and consul
Consul: Service-oriented at Scale
Ground Control to Nomad Job Dispatch
Terraform: An Overview & Introduction
Migratory Workloads Across Clouds with Nomad
Building Microservices with Spring Cloud and Netflix OSS
Openstack Scheduler and Scalability Issue
OpenStack Keystone with LDAP
Deploying Docker Containers at Scale with Mesos and Marathon
Geode on Docker
Service Discovery 101
02 terraform core concepts
Divide and conquer: resource segregation in the OpenStack cloud
Real-Time Data Processing Pipeline & Visualization with Docker, Spark, Kafka ...
Ad

Similar to How secure are your Terraform sensitive values? (20)

PDF
Embedding security into your Terraform code
PDF
Building Cloud Applications Based On Zero Trust
PPTX
Hashicorp-Certified-Terraform-Associate_V1
PPTX
"Cryptography, Data Protection, and Security For Start-Ups In The Post Snowde...
PPTX
DevOops Redux Ken Johnson Chris Gates - AppSec USA 2016
PPTX
Hashicorp-Certified-Terraform-Associate-v3-edited.pptx
PDF
Managing secrets at scale
PDF
Zero Trust Networks Evan Gilman Doug Barth
PDF
Zero Trust Networks Evan Gilman Doug Barth
PPTX
Automating your AWS Security Operations
PDF
Security for AWS: Journey to Least Privilege
PPTX
Security for AWS : Journey to Least Privilege (update)
PPTX
API Security: Assume Possible Interference
PDF
Beginning AWS Security 1st Edition Tasha Penwell
PPTX
Cloud Security or: How I Learned to Stop Worrying & Love the Cloud
PDF
Security As Code Devsecops Patterns With Aws 1st Bk Sarthak Das
PPTX
001 - Get acquainted with the AWS platform -- hide01.ir.pptx
PDF
Information Security in AWS - Dave Walker
PDF
Hashicorp-Terraform-Deep-Dive-with-no-Fear-Victor-Turbinsky-Texuna.pdf
PDF
Terraform-2.pdf
Embedding security into your Terraform code
Building Cloud Applications Based On Zero Trust
Hashicorp-Certified-Terraform-Associate_V1
"Cryptography, Data Protection, and Security For Start-Ups In The Post Snowde...
DevOops Redux Ken Johnson Chris Gates - AppSec USA 2016
Hashicorp-Certified-Terraform-Associate-v3-edited.pptx
Managing secrets at scale
Zero Trust Networks Evan Gilman Doug Barth
Zero Trust Networks Evan Gilman Doug Barth
Automating your AWS Security Operations
Security for AWS: Journey to Least Privilege
Security for AWS : Journey to Least Privilege (update)
API Security: Assume Possible Interference
Beginning AWS Security 1st Edition Tasha Penwell
Cloud Security or: How I Learned to Stop Worrying & Love the Cloud
Security As Code Devsecops Patterns With Aws 1st Bk Sarthak Das
001 - Get acquainted with the AWS platform -- hide01.ir.pptx
Information Security in AWS - Dave Walker
Hashicorp-Terraform-Deep-Dive-with-no-Fear-Victor-Turbinsky-Texuna.pdf
Terraform-2.pdf
Ad

More from Marko Bevc (9)

PDF
Using HCP Waypoint
PDF
Efficient Kubernetes scaling using Karpenter
PDF
Nodeless scaling with Karpenter
PDF
Seamless scaling of Kubernetes nodes
PDF
Who is afraid of privileged containers ?
PDF
Who is afraid of privileged containers ?
PDF
Terraform 0.13: Rise of the modules
PDF
Who is afraid of privileged containers ?
PDF
Commodified IaC using Terraform Cloud
Using HCP Waypoint
Efficient Kubernetes scaling using Karpenter
Nodeless scaling with Karpenter
Seamless scaling of Kubernetes nodes
Who is afraid of privileged containers ?
Who is afraid of privileged containers ?
Terraform 0.13: Rise of the modules
Who is afraid of privileged containers ?
Commodified IaC using Terraform Cloud

Recently uploaded (20)

PDF
Nekopoi APK 2025 free lastest update
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PDF
medical staffing services at VALiNTRY
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PDF
Digital Systems & Binary Numbers (comprehensive )
PDF
System and Network Administraation Chapter 3
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PPTX
Transform Your Business with a Software ERP System
PPTX
history of c programming in notes for students .pptx
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PPTX
Reimagine Home Health with the Power of Agentic AI​
PPTX
assetexplorer- product-overview - presentation
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PPT
Introduction Database Management System for Course Database
PDF
Design an Analysis of Algorithms II-SECS-1021-03
Nekopoi APK 2025 free lastest update
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
medical staffing services at VALiNTRY
Design an Analysis of Algorithms I-SECS-1021-03
How to Migrate SBCGlobal Email to Yahoo Easily
Digital Systems & Binary Numbers (comprehensive )
System and Network Administraation Chapter 3
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Transform Your Business with a Software ERP System
history of c programming in notes for students .pptx
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
How to Choose the Right IT Partner for Your Business in Malaysia
Reimagine Home Health with the Power of Agentic AI​
assetexplorer- product-overview - presentation
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
Which alternative to Crystal Reports is best for small or large businesses.pdf
Introduction Database Management System for Course Database
Design an Analysis of Algorithms II-SECS-1021-03

How secure are your Terraform sensitive values?