liveBook · Manning

Dry run

As explained in Infrastructure as Code, Patterns and Practices: With examples in Python and Terraform

A dry run is an execution mode that analyzes and reports expected changes without applying them to the target resources.

A dry run analyzes infrastructure-as-code changes and reports expected effects before applying them to target resources. It can expose dependencies, such as a server changing when its network changes, without altering live infrastructure. section 1.5.2

Use a dry run as an operational checkpoint:

  • Define or modify the infrastructure configuration. section 1.5.2
  • Generate a preview of additions, changes, removals, and affected dependencies. section 1.5.2
  • Inspect the preview for unintended changes before applying it. section 10.2.1
  • Use the preview or resulting state as test input when configuration alone omits computed values. section 6.2.2

Terraform preview and configuration tests

Terraform can save a plan and render it as JSON: terraform plan -out=dry_run && terraform show -json dry_run > dry_run.json. Tests can then inspect infrastructure metadata such as a network name, subnet count, and IP ranges without deploying the network. During refactoring, a successful no-change plan confirms that imported resources still match the configuration. section 6.2.2 section 10.2.1

Table 1.1 Examples of provisioning tools and providers (view table figure)

Tool

Provider

AWS CloudFormation

Amazon Web Services

Google Cloud Deployment Manager

Google Cloud Platform

Azure Resource Manager

Microsoft Azure

Bicep

Microsoft Azure

HashiCorp Terraform

Various (for a complete list, see www.terraform.io/docs/providers/index.html)

Pulumi

Various (for a complete list, see www.pulumi.com/docs/intro/cloud-providers/)

AWS Cloud Development Kit

Amazon Web Services

Kubernetes manifests

Kubernetes (container orchestrator)

Compare provisioning tools and the providers they support before choosing a dry-run workflow. section 1.5.2

How Infrastructure as Code, Patterns and Practices: With examples in Python and Terraform covers it

How deep it goes
Explains previews, dependencies, JSON inspection, testing, and refactoring checks, but leaves dry-run formats and standards broadly unspecified.
Examples
Uses Terraform plans, JSON dry-run files, pytest checks, subnet configurations, and no-change refactoring plans.
What it assumes
Assumes familiarity with infrastructure-as-code configuration and testing while treating deployment as avoidable during preview.
What you can do after
Diagnoses unintended infrastructure changes and validates configuration before deployment or migration.
How it connects
Connects infrastructure as code with provisioning, dependency management, unit testing, idempotency, state, and refactoring.

Also explained in

Compare how 3 books explain dry run →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Infrastructure as Code, Patterns and Practices: With examples in Python and Terraform. The section links point to the parts of the book it draws on.