Skip to content

Introduction

This module is going to focus on some of the deeper advanced things you may come across whilst using Terraform, that you tend to encounter when running projects at scale across multiple environments.

Looking at using state management, workspaces, depends_on, lifecycles, ephemeral values, and testing - you will understand how you can tailor behavior and minimize disruptions when developing and deploying your Terraform apps.

  • Understand how Terraform manages state and it how it uses it for infrastructure tracking - but also how it can enable collaboration and reproducible deployments.
  • Understanding how workspaces can be used to give efficient environment isolation and management, allowing you to handle multiple deployment scenarios seamlessly.
  • Understanding depends_on, to gain the ability to control resource dependencies, ensuring correct order and consistency during provisioning.
  • Using lifecycles to provide fine-grained control over resource operations through their lifecycle, including preconditions and postconditions for asserting assumptions before and after resource changes.
  • Using removed blocks to safely stop managing resources without destroying them.
  • Use terraform test and check blocks to validate your infrastructure configurations.
  • Mock providers and override resources in tests so you can run them without cloud credentials or real infrastructure.
  • Understand ephemeral values and write-only arguments to handle secrets without them being stored in state files.