teluzia.Cloud Engineer · Day 94
CHAPTER 14 · ADVANCED TERRAFORM

Development/production environments

4–5 hours including independent practice3 topics
LET’S MAKE THIS SIMPLE

What you’re learning today

Environment separation is keeping rehearsal and opening night in different rooms, with separate keys and inventories. Development and production need explicit separation of state, credentials, and resources. Workspaces separate state instances but are not automatically a strong security boundary. Distinct AWS accounts and backend access policies can provide stronger isolation when the risk warrants them. Share reusable modules while supplying environment-specific capacity, naming, and policy choices through reviewed inputs. Avoid unexplained differences that make development behavior unrelated to production. Some security and topology properties should remain consistent even when nonproduction uses smaller scale.

Think of it this way

Environment separation is keeping rehearsal and opening night in different rooms, with separate keys and inventories.

TOPIC 01 / 03Step by step

State and account isolation

Development and production need explicit separation of state, credentials, and resources. Workspaces separate state instances but are not automatically a strong security boundary. Distinct AWS accounts and backend access policies can provide stronger isolation when the risk warrants them. For example, development uses a learning account and dev state key; production uses another account and a restricted prod key.

WORKED EXAMPLE
Development uses a learning account and dev state key; production uses another account and a restricted prod key.

A developer switches to a development workspace while still using a production administrator profile. The state selection changed, but the credential authority did not. Workspaces can separate state instances; they do not automatically provide separate accounts, network boundaries, or permission sets. Verify both state context and AWS identity before changes.

Isolation limits interference and blast radius. A workspace selects a state instance within a configuration/backend arrangement. An account provides an AWS resource and identity boundary. Stronger separation may use different accounts, backend policies, and pipeline roles. This adds administration but reduces the chance that a local mistake affects production. A shared module can still serve both environments without sharing their state. Explicitly name owners, keys, and permitted credentials, and document what prevents development automation from accessing production. Naming folders differently is useful organization, but enforcement must come from actual state selection and access controls.

Why this matters

Development uses a learning account and dev state key; production uses another account and a restricted prod key.

A common trap

Do not overlook this operational distinction: Distinct AWS accounts and backend access policies can provide stronger isolation when the risk warrants them.

Read all topics in this lesson

A complete reference to revisit alongside the guided steps above.

State and account isolation

Development and production need explicit separation of state, credentials, and resources. Workspaces separate state instances but are not automatically a strong security boundary. Distinct AWS accounts and backend access policies can provide stronger isolation when the risk warrants them. For example, development uses a learning account and dev state key; production uses another account and a restricted prod key.

WORKED EXAMPLE
Development uses a learning account and dev state key; production uses another account and a restricted prod key.

A developer switches to a development workspace while still using a production administrator profile. The state selection changed, but the credential authority did not. Workspaces can separate state instances; they do not automatically provide separate accounts, network boundaries, or permission sets. Verify both state context and AWS identity before changes.

Isolation limits interference and blast radius. A workspace selects a state instance within a configuration/backend arrangement. An account provides an AWS resource and identity boundary. Stronger separation may use different accounts, backend policies, and pipeline roles. This adds administration but reduces the chance that a local mistake affects production. A shared module can still serve both environments without sharing their state. Explicitly name owners, keys, and permitted credentials, and document what prevents development automation from accessing production. Naming folders differently is useful organization, but enforcement must come from actual state selection and access controls.

Why this matters

Development uses a learning account and dev state key; production uses another account and a restricted prod key.

A common trap

Do not overlook this operational distinction: Distinct AWS accounts and backend access policies can provide stronger isolation when the risk warrants them.

Configuration differences and parity

Share reusable modules while supplying environment-specific capacity, naming, and policy choices through reviewed inputs. Avoid unexplained differences that make development behavior unrelated to production. Some security and topology properties should remain consistent even when nonproduction uses smaller scale. For example, dev has one app replica for affordability, but database access remains restricted and credentials remain outside source control.

WORKED EXAMPLE
Dev has one app replica for affordability, but database access remains restricted and credentials remain outside source control.

Development uses one app replica to save cost while production uses three across zones. Both still require private database access and credentials outside source. Those are deliberate scale differences, not excuses for unrelated security behavior. A module input file should explain why each divergence exists and what it prevents development from proving.

Parity means relevant behavior remains comparable. Environment configuration supplies intentional differences. A configuration drift is an untracked divergence from the intended setup. Perfect parity can be expensive, while excessive simplification hides failures that appear only during production release. Keep essential request contracts and access boundaries consistent, then test availability or scale requirements in a suitable controlled environment. Do not copy production passwords to achieve realism. Record which outcomes the smaller environment can validate and which require separate evidence, so a passing development test does not claim protection against failures its topology cannot simulate.

Why this matters

Dev has one app replica for affordability, but database access remains restricted and credentials remain outside source control.

A common trap

Do not overlook this operational distinction: Some security and topology properties should remain consistent even when nonproduction uses smaller scale.

Promotion and change controls

Promote the same tested code or module revision through environments, using separate configuration and approvals appropriate to each. Record account identity and backend before changes. A filename saying prod is not proof that a command targets production or that the operator should have permission. For example, a pipeline records the reviewed revision and exact account ID before generating the production plan.

WORKED EXAMPLE
A pipeline records the reviewed revision and exact account ID before generating the production plan.

A release commits one module revision, generates a development plan, and validates the resulting application. Promotion to production uses the same reviewed source revision but its own variables, identity, and backend. The production plan is still reviewed because different capacity or topology can create different actions. Copying the development plan file blindly is not environment promotion.

Promotion advances a reviewed version through environments. Preflight verifies the actual execution target. Approval authorizes a concrete proposed change under the team's policy. Record exact source and artifact identities alongside account, region, and state location. Separate pipeline privileges so test jobs cannot freely change production. An environment gate can reduce accidental deployment, but it must be configured and tied to trustworthy triggers. A green development result provides useful evidence, yet cannot predict production-specific quotas, dependencies, or access behavior without targeted validation.

Why this matters

A pipeline records the reviewed revision and exact account ID before generating the production plan.

A common trap

Do not overlook this operational distinction: A filename saying prod is not proof that a command targets production or that the operator should have permission.

KEEP THESE WITH YOU

Today’s takeaways

State and account isolation: Development and production need explicit separation of state, credentials, and resources. Workspaces separate state instances but are not automatically a strong security boundary. Distinct AWS accounts and backend access policies can provide stronger isolation when the risk warrants them.

Configuration differences and parity: Share reusable modules while supplying environment-specific capacity, naming, and policy choices through reviewed inputs. Avoid unexplained differences that make development behavior unrelated to production. Some security and topology properties should remain consistent even when nonproduction uses smaller scale.

Promotion and change controls: Promote the same tested code or module revision through environments, using separate configuration and approvals appropriate to each. Record account identity and backend before changes. A filename saying prod is not proof that a command targets production or that the operator should have permission.

CLOSE THE LOOP

Ready to complete this day?

Verify the practical steps and pass the knowledge check (at least two thirds correct).

Lab steps verifiedKnowledge check passed