Leverage Terraform's capabilities to reuse code, write modules, automate deployments, and manage infrastructure state

Key Features

  • Perform complex enterprise-grade infrastructure deployments using Terraform v1.0, the latest version of Terraform
  • Learn to scale your infrastructure without introducing added deployment complexities
  • Understand how to overcome infrastructure deployment challenges

Book Description

Terraform is a highly sought-after technology for orchestrating infrastructure provisioning. This book is a complete reference guide to enhancing your infrastructure automation skills, offering up-to-date coverage of the HashiCorp infrastructure automation certification exam. This book is written in a clear and practical way with self-assessment questions and mock exams that will help you from a HashiCorp infrastructure automation certification exam perspective. This book covers end-to-end activities with Terraform, such as installation, writing its configuration file, Terraform modules, backend configurations, data sources, and infrastructure provisioning. You'll also get to grips with complex enterprise infrastructures and discover how to create thousands of resources with a single click. As you advance, you'll get a clear understanding of maintaining infrastructure as code (IaC) in Repo/GitHub, along with learning how to create, modify, and remove infrastructure resources as and when needed. Finally, you'll learn about Terraform Cloud and Enterprise and their enhanced features.

By the end of this book, you'll have a handy, up-to-date desktop reference guide along with everything you need to pass the HashiCorp Certified: Terraform Associate exam with confidence.

What you will learn

  • Effectively maintain the life cycle of your infrastructure using Terraform 1.0
  • Reuse Terraform code to provision any cloud infrastructure
  • Write Terraform modules on multiple cloud providers
  • Use Terraform workflows with the Azure DevOps pipeline
  • Write Terraform configuration files for AWS, Azure, and Google Cloud
  • Discover ways to securely store Terraform state files
  • Understand Policy as Code using Terraform Sentinel
  • Gain an overview of Terraform Cloud and Terraform Enterprise

Who this book is for

This book is for experienced cloud engineers, DevOps engineers, system administrators, and solution architects interested in developing industry-grade skills with Terraform. You will also find this book useful if you want to pass the HashiCorp Certified: Terraform Associate exam. Basic command-line skills and prior knowledge of cloud environments and their services are required before getting started with this book.

Table of Contents

  1. HashiCorp Infrastructure Automation Certification Guide
  2. Contributors
  3. About the author
  4. About the reviewers
  5. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
    4. Download the example code files
    5. Code in Action
    6. Download the color images
    7. Conventions used
    8. Get in touch
    9. Share Your Thoughts
  6. Section 1: The Basics
  7. Chapter 1: Getting to Know IaC
    1. Technical requirements
    2. Introduction to IaC
    3. Advantages of IaC
    4. Simple and speedy
    5. Configuration consistency
    6. Risk minimization
    7. Increased efficiency in software development
    8. Cost savings
    9. Introduction to Terraform
    10. What is Terraform?
    11. Features of Terraform
    12. Terraform use cases
    13. A comparison with other IaC
    14. CloudFormation versus Terraform
    15. Azure ARM templates versus Terraform
    16. Google Cloud Deployment Manager versus Terraform
    17. An understanding of Terraform architecture
    18. Terraform Core
    19. Terraform plugins
    20. Summary
    21. Questions
    22. Further reading
  8. Chapter 2: Terraform Installation Guide
    1. Technical requirements
    2. Installing Terraform on Windows
    3. Downloading Terraform
    4. Installing Terraform on Linux
    5. Downloading Terraform
    6. Installing Terraform on macOS
    7. Downloading Terraform
    8. Summary
    9. Questions
    10. Further reading
  9. Section 2: Core Concepts
  10. Chapter 3: Getting Started with Terraform
    1. Technical requirements
    2. Introducing Terraform providers
    3. Terraform providers
    4. Knowing about Terraform resources
    5. Terraform resources
    6. Understanding Terraform variables
    7. Terraform variables
    8. Understanding Terraform output
    9. Terraform output
    10. Understanding Terraform data
    11. Terraform data sources
    12. Summary
    13. Questions
    14. Further reading
  11. Chapter 4: Deep Dive into Terraform
    1. Technical requirements
    2. Introducing the Terraform backend
    3. Terraform state
    4. The purpose of the Terraform state file
    5. Terraform backend types
    6. Understanding Terraform provisioners
    7. Terraform provisioner use cases
    8. Terraform provisioner types
    9. Understanding Terraform loops
    10. The count expression
    11. The for_each expression
    12. The for expression
    13. Understanding Terraform functions
    14. Understanding Terraform debugging
    15. Summary
    16. Questions
    17. Further reading
  12. Chapter 5: Terraform CLI
    1. Technical requirements
    2. Introduction to the Terraform CLI
    3. Integrating with Azure
    4. Authentication using a Service Principal and a Client Secret
    5. Provisioning Azure services using Terraform
    6. Integrating with AWS
    7. Authentication using an access key ID and secret
    8. Provisioning AWS services using Terraform
    9. Integrating with GCP
    10. Authentication using a Google service account by storing credentials in a separate file
    11. Provisioning GCP services using Terraform
    12. Understanding the Terraform CLI commands
    13. Summary
    14. Questions
    15. Further reading
  13. Chapter 6: Terraform Workflows
    1. Technical requirements
    2. Understanding the Terraform life cycle
    3. Terraform init
    4. Terraform validate
    5. Terraform plan
    6. Terraform apply
    7. Terraform destroy
    8. Understanding Terraform workflows using Azure DevOps
    9. Summary
    10. Questions
    11. Further reading
  14. Chapter 7: Terraform Modules
    1. Technical requirements
    2. Understanding Terraform modules
    3. source
    4. version
    5. Writing Terraform modules for Azure
    6. Writing Terraform modules for AWS
    7. Writing Terraform modules for GCP
    8. Publishing Terraform modules
    9. Key requirements
    10. Publishing a module
    11. Summary
    12. Questions
    13. Further reading
  15. Section 3: Managing Infrastructure with Terraform
  16. Chapter 8: Terraform Configuration Files
    1. Technical requirements
    2. Understanding Terraform configuration files
    3. Terraform native configuration syntax
    4. Terraform override file
    5. JSON configuration syntax
    6. Data types
    7. Terraform style conventions
    8. Writing Terraform configuration files for GCP
    9. Writing Terraform configuration files for AWS
    10. Writing Terraform configuration files for Azure
    11. Summary
    12. Questions
    13. Further reading
  17. Chapter 9: Understanding Terraform Stacks
    1. Technical requirements
    2. Understanding Terraform stacks
    3. Writing Terraform stacks for GCP
    4. Writing Terraform stacks for AWS
    5. Writing Terraform stacks for Azure
    6. Summary
    7. Questions
    8. Further reading
  18. Chapter 10: Terraform Cloud and Terraform Enterprise
    1. Technical requirements
    2. Introducing Terraform Cloud
    3. Terraform Cloud workflow
    4. Understanding Terraform Enterprise
    5. Overviewing Terraform Sentinel
    6. Comparing different Terraform features
    7. Summary
    8. Questions
    9. Further reading
  19. Chapter 11: Terraform Glossary
  20. Assessments
    1. Chapter 1
    2. Chapter 2
    3. Chapter 3
    4. Chapter 4
    5. Chapter 5
    6. Chapter 6
    7. Chapter 7
    8. Chapter 8
    9. Chapter 9
    10. Chapter 10
    11. Why subscribe?
  21. Other Books You May Enjoy
    1. Packt is searching for authors like you
    2. Share Your Thoughts