Scenario inputs & environment differences

Use one configuration in two environments

Lesson 9 of 20 · 12 min · Module 3: Protect boundaries and reuse intent

Keep deliberate environment differences explicit instead of copying entire configurations.

Start this lesson →

Free. No installation: you write and run the code in your browser, and it is checked automatically.

By the end, you’ll be able to…

  • Keep shared intent in one place
  • Supply the environment-specific value

The idea

Terraform accepts .tf.json as an alternative configuration representation. Here, built-in terraform_data values make state and plan concepts inspectable without provisioning a cloud resource.

01Keep shared intent in one place

Duplicated configuration can drift when a repair is copied into only one environment. Shared structure and explicit input differences make review easier.

02Supply the environment-specific value

The scenario override replaces the replicas default without changing the source declaration. The image still uses its default because no override was supplied.

03Protect production separation

Sharing configuration does not mean sharing every credential or state store. Real environments need deliberate access and state boundaries.

Your turn

Declare image string default notes:1.0 and replicas number default 1. Reference both in app input. The scenario supplies replicas=3; the resolved model must keep that number and the default image.

What the checks look for

  • Declares both input types
  • Applies the override without losing the default
Try it in the editor →

Take this with you

Reuse configuration intent while keeping environment boundaries explicit.

Go a little further

Describe how you would keep production state separate from development state.

Learn Infrastructure & Operations for free

20 short lessons with real code and instant checks.

See the whole course →