Practical infrastructure challenge

Terraform Plan Review Challenge

Review a synthetic Terraform plan, identify replacement and update actions, reason about unknown values and write a small HCL configuration.

1. Review the proposed change

Catalog release review

A team requested a label change from development to test. The proposed plan also includes a release replacement, a new monitor record and removal of a legacy record. Examine the synthetic JSON excerpt before deciding what deserves further review.

These example resources use the built-in terraform_data lifecycle.

Plan excerpt: resource_changes
{
  "resource_changes": [
    {
      "address": "terraform_data.release",
      "change": {
        "actions": [
          "delete",
          "create"
        ],
        "before": {
          "triggers_replace": "v1"
        },
        "after": {
          "triggers_replace": "v2"
        },
        "replace_paths": [
          [
            "triggers_replace"
          ]
        ]
      }
    },
    {
      "address": "terraform_data.labels",
      "change": {
        "actions": [
          "update"
        ],
        "before": {
          "input": "development"
        },
        "after": {
          "input": "test"
        }
      }
    },
    {
      "address": "terraform_data.monitor",
      "change": {
        "actions": [
          "create"
        ],
        "after": {
          "input": "catalog"
        },
        "after_unknown": {
          "id": true,
          "output": true
        }
      }
    },
    {
      "address": "terraform_data.legacy",
      "change": {
        "actions": [
          "delete"
        ],
        "before": {
          "input": "retired"
        }
      }
    }
  ]
}

2. Analyze the plan

Loading the practice questions...

3. Construct a configuration

Create a string variable named release and a terraform_data resource named release_metadata. Store the variable using the resource's input argument. The goal is to change stored release metadata without deliberately triggering a replacement.

main.tfTerraform ยท HCL
Need a conceptual hint?

Distinguish storing a value from configuring a replacement trigger. Reference the declared input variable in the resource body.

Compare a reference example after attempting
variable "release" {
  type = string
}

resource "terraform_data" "release_metadata" {
  input = var.release
}

Compare your variable declaration, resource address and reference. Explain why the input argument serves the stated goal.

4. Explain your review

Describe which proposed changes fall outside the requested scope, the evidence you would examine, and why a plan cannot confirm successful execution. Revisit the exercise later and compare the two replacement action orders without consulting the answers.

Continue your learning

Explore the Terraform Plan Visualizer, module contract research, Associate 004 assessment and learning methodology.

Technical references