𝔖 Scriptorium
✦   LIBER   ✦

📁

Terraform Cookbook: Efficiently define, launch, and manage Infrastructure as Code across various cloud platforms

✍ Scribed by Mikael Krief


Publisher
Packt Publishing
Year
2020
Tongue
English
Leaves
360
Category
Library

⬇  Acquire This Volume

No coin nor oath required. For personal study only.

✦ Synopsis


Discover how to manage and scale your infrastructure using Infrastructure as Code (IaC) with Terraform

Key Features

  • Get up and running with the latest version of Terraform, v0.13
  • Design and manage infrastructure that can be shared, tested, modified, provisioned, and deployed
  • Work through practical recipes to achieve zero-downtime deployment and scale your infrastructure effectively

Book Description

HashiCorp Configuration Language (HCL) has changed how we define and provision a data center infrastructure with the launch of Terraform―one of the most popular and powerful products for building Infrastructure as Code. This practical guide will show you how to leverage HashiCorp's Terraform tool to manage a complex infrastructure with ease.

Starting with recipes for setting up the environment, this book will gradually guide you in configuring, provisioning, collaborating, and building a multi-environment architecture. Unlike other books, you'll also be able to explore recipes with real-world examples to provision your Azure infrastructure with Terraform. Once you've covered topics such as Azure Template, Azure CLI, Terraform configuration, and Terragrunt, you'll delve into manual and automated testing with Terraform configurations. The next set of chapters will show you how to manage a balanced and efficient infrastructure and create reusable infrastructure with Terraform modules. Finally, you'll explore the latest DevOps trends such as continuous integration and continuous delivery (CI/CD) and zero-downtime deployments.

By the end of this book, you'll have developed the skills you need to get the most value out of Terraform and manage your infrastructure effectively.

What you will learn

  • Understand how to install Terraform for local development
  • Get to grips with writing Terraform configuration for infrastructure provisioning
  • Use Terraform for advanced infrastructure use cases
  • Understand how to write and use Terraform modules
  • Discover how to use Terraform for Azure infrastructure provisioning
  • Become well-versed in testing Terraform configuration
  • Execute Terraform configuration in CI/CD pipelines
  • Explore how to use Terraform Cloud

Who this book is for

This book is for developers, operators, and DevOps engineers looking to improve their workflow and use Infrastructure as Code. Experience with Microsoft Azure, Jenkins, shell scripting, and DevOps practices is required to get the most out of this Terraform book.

Table of Contents

  1. Setting Up the Terraform Environment
  2. Writing Terraform Configuration
  3. Building Dynamic Environments with Terraform
  4. Using the Terraform CLI
  5. Sharing Terraform Configuration with Modules
  6. Provisioning Azure Infrastructure with Terraform
  7. Deep Diving into Terraform
  8. Using Terraform Cloud to Improve Collaboration

✦ Table of Contents


Cover
Title Page
Copyright and Credits
Foreword
Dedication
About Packt
Contributors
Table of Contents
Preface
Chapter 01: Setting Up the Terraform Environment
Technical requirements
Downloading and installing Terraform manually
Getting ready
How to do it…
How it works…
Installing Terraform using a script on Linux
Getting ready
How to do it…
How it works…
There's more…
See also
Installing Terraform using a script on Windows
Getting ready
How to do it…
How it works…
There's more…
See also
Executing Terraform in a Docker container
Getting ready
How to do it…
How it works…
There's more…
See also
Writing Terraform configuration in VS Code
Getting ready
How to do it…
How it works…
There's more…
See also
Migrating your Terraform configuration to Terraform 0.13
Getting ready
How to do it…
How it works…
There's more…
See also
Chapter 02: Writing Terraform Configuration
Technical requirements
Configuring Terraform and the provider version to use
Getting ready
How to do it…
How it works…
There's more…
See also
Manipulating variables
Getting ready
How to do it…
How it works…
There's more…
See also
Using local variables for custom functions
Getting ready
How to do it…
How it works…
See also
Using outputs to expose Terraform provisioned data
Getting ready
How to do it…
How it works…
There's more…
See also
Provisioning infrastructure in multiple environments
Getting ready
How to do it…
How it works…
See also
Obtaining external data with data sources
Getting ready
How to do it…
How it works…
There's more…
See also
Using external resources from other state files
Getting ready
How to do it…
How it works…
There's more…
See also
Querying external data with Terraform
Getting ready
How to do it…
How it works…
There's more…
See also
Calling Terraform built-in functions
Getting ready
How to do it…
How it works…
See also
Writing conditional expressions
Getting ready
How to do it…
How it works…
See also
Manipulating local files with Terraform
Getting ready
How to do it…
How it works…
There's more…
See also
Executing local programs with Terraform 
Getting ready
How to do it…
How it works…
There's more…
See also
Generating passwords with Terraform
Getting ready
How to do it…
How it works…
See also
Chapter 03: Building Dynamic Environments with Terraform
Technical requirements
Provisioning multiple resources with the count property
Getting ready
How to do it…
How it works…
There's more…
See also
Using a table of key-value variables with maps
Getting ready
How to do it…
How it works…
There's more…
See also
Looping over object collections
Getting ready
How to do it…
How it works…
There's more…
See also
Generating multiple blocks with dynamic expressions
Getting ready
How to do it…
How it works…
There's more…
See also
Chapter 04: Using the Terraform CLI
Technical requirements
Keeping your Terraform configuration clean
Getting ready
How to do it…
How it works…
There's more…
See also
Validating the code syntax
Getting ready
How to do it…
How it works…
There's more…
See also
Destroying infrastructure resources
Getting ready
How to do it…
How it works…
There's more…
See also
Using workspaces for managing environments
Getting ready
How to do it…
How it works…
There's more…
See also
Importing existing resources
Getting ready
How to do it…
How it works…
There's more…
See also
Exporting the output in JSON
Getting ready
How to do it…
How it works…
There's more…
See also
Tainting resources
Getting ready
How to do it…
How it works…
There's more…
See also
Generating the graph dependencies
Getting ready
How to do it…
How it works…
See also
Debugging the Terraform execution
Getting ready
How to do it…
How it works…
There's more…
See also
Chapter 05: Sharing Terraform Configuration with Modules
Technical requirements
Creating a Terraform module and using it locally
Getting ready
How to do it…
How it works…
There's more…
See also
Using modules from the public registry
Getting ready
How to do it…
How it works…
There's more…
See also
Sharing a Terraform module using GitHub
Getting ready
How to do it…
How it works…
There's more…
See also
Using another file inside a custom module
Getting ready
How to do it…
How it works…
There's more…
See also
Using the Terraform module generator
Getting ready
How to do it…
How it works…
There's more…
See also
Generating module documentation
Getting ready
How to do it…
How it works…
There's more…
See also
Using a private Git repository for sharing a Terraform module
Getting ready
How to do it…
How it works…
There's more…
See also
Applying a Terrafile pattern for using modules
Getting ready
How to do it…
How it works…
There's more…
See also
Testing Terraform module code with Terratest
Getting ready
How to do it…
How it works…
There's more…
See also
Building CI/CD for Terraform modules in Azure Pipelines
Getting ready
How to do it…
How it works…
There's more…
See also
Building a workflow for Terraform modules using GitHub Actions
Getting ready
How to do it…
How it works…
There's more…
See also
Chapter 06: Provisioning Azure Infrastructure with Terraform
Technical requirements
Using Terraform in Azure Cloud Shell
Getting ready
How to do it…
How it works…
There's more…
See also
Protecting the Azure credential provider
Getting ready
How to do it…
How it works…
There's more...
See also
Protecting the state file in the Azure remote backend
Getting ready
How to do it…
How it works…
There's more…
See also
Executing ARM templates in Terraform
Getting ready
How to do it…
How it works…
There's more…
See also
Executing Azure CLI commands in Terraform
Getting ready
How to do it…
How it works…
There's more…
See also
Using Azure Key Vault with Terraform to protect secrets
Getting ready
How to do it…
How it works…
There's more…
See also
Getting a list of Azure resources in Terraform
Getting ready
How to do it…
How it works…
There's more…
See also
Provisioning and configuring an Azure VM with Terraform
Getting ready
How to do it…
How it works…
There's more…
See also
Building Azure serverless infrastructure with Terraform
Getting ready
How to do it…
How it works…
There's more…
See also
Generating a Terraform configuration for existing Azure infrastructure
Getting ready
How to do it…
How it works…
There's more…
See also
Chapter 07: Deep Diving into Terraform
Technical requirements
Creating an Ansible inventory with Terraform
Getting ready
How to do it…
How it works…
There’s more…
See also
Testing the Terraform configuration using kitchen-terraform
Getting ready
How to do it…
How it works…
There’s more…
See also
Preventing resources from getting destroyed
Getting ready
How to do it…
How it works…
There’s more…
See also
Zero-downtime deployment with Terraform
Getting ready
How to do it…
How it works…
There’s more…
See also
Detecting resources deleted by the plan command
Getting ready
How to do it…
How it works…
There’s more…
See also
Managing Terraform configuration dependencies using Terragrunt
Getting ready
How to do it…
How it works…
There’s more…
See also
Using Terragrunt as a wrapper for Terraform
Getting ready
How to do it…
How it works…
See also
Building CI/CD pipelines for Terraform configurations in Azure Pipelines
Getting ready
How to do it…
How it works…
There's more…
See also
Working with workspaces in CI/CD
Getting ready
How to do it…
How it works…
There's more…
See also
Chapter 08: Using Terraform Cloud to Improve Collaboration
Technical requirements
Using the remote backend in Terraform Cloud
Getting ready
How to do it…
How it works…
There's more…
See also
Using Terraform Cloud as a private module registry
Getting ready
How to do it…
How it works…
There's more…
See also
Executing Terraform configuration remotely in Terraform Cloud
Getting ready
How to do it…
How it works…
There's more…
See also
Automating Terraform Cloud using APIs
Getting ready
How to do it…
How it works…
There's more…
See also
Testing the compliance of Terraform configurations using Sentinel
Getting ready
How to do it…
How it works…
There's more…
See also
Using cost estimation for cloud cost resources governance
Getting ready
How to do it…
How it works…
There's more…
See also
Other Books You May Enjoy
Index


📜 SIMILAR VOLUMES


Terraform Cookbook: Efficiently define,
✍ Mikael Krief 📂 Library 🏛 Packt Publishing 🌐 English

<p><span>Discover how to manage and scale your infrastructure using Infrastructure as Code (IaC) with Terraform</span></p><h4><span>Key Features</span></h4><ul><li><span><span>Get up and running with the latest version of Terraform, v0.13</span></span></li><li><span><span>Design and manage infrastru

Terraform Cookbook: Efficiently define,
✍ Mikael Krief; Mitchell Hashimoto 📂 Library 📅 2020 🏛 Packt Publishing Ltd 🌐 English

Discover how to manage and scale your infrastructure using Infrastructure as Code (IaC) with Terraform Key Features Get up and running with the latest version of Terraform, v0.13 Design and manage infrastructure that can be shared, tested, modified, provisioned, and deployed Work through practical r

Infrastructure as Code for Beginners: De
✍ Russ McKendrick 📂 Library 🏛 Packt Publishing 🌐 English

<p><span>Master Infrastructure as Code (IaC) and streamline your DevOps workflows using Terraform and Ansible</span></p><p><span>Purchase of the print or Kindle book includes a free eBook in the PDF format</span></p><h4><span>Key Features</span></h4><ul><li><span><span>Employ effective strategies an

Infrastructure as Code for Beginners: De
✍ Russ McKendrick 📂 Library 📅 2023 🏛 Packt Publishing 🌐 English

Master Infrastructure as Code (IaC) and streamline your DevOps workflows using Terraform and Ansible Key Features • Employ effective strategies and approach IaC projects efficiently by diving deep into its fundamentals • Understand the working of Terraform and Ansible and integrate them into yo

Terraform: Up and Running: Writing Infra
✍ Yevgeniy Brikman 📂 Library 📅 2022 🏛 O'Reilly Media 🌐 English

<p><span>Terraform has become a key player in the DevOps world for defining, launching, and managing infrastructure as code (IaC) across a variety of cloud and virtualization platforms, including AWS, Google Cloud, Azure, and more. This hands-on third edition, expanded and thoroughly updated for ver

Terraform: Up and Running: Writing Infra
✍ Yevgeniy Brikman 📂 Library 📅 2022 🏛 O'Reilly Media 🌐 English

Terraform has become a key player in the DevOps world for defining, launching, and managing infrastructure as code (IaC) across a variety of cloud and virtualization platforms, including AWS, Google Cloud, Azure, and more. This hands-on third edition, expanded and thoroughly updated for version 1.0