For IT professionals and developers
Free for every learner
About 8 minutes

Lesson 05 of 7 · DevSecOps for IT professionals and developers

Review infrastructure as code before deployment

Spot risky cloud configuration in a fictional IaC change, explain its impact, remediate it, and validate the proposed fix before deployment.

Anyone can read this lesson. Completion is saved to a learner account.

Lesson objective

By the end, you can

Given a fictional infrastructure change, identify exposed storage, broad network access, and unsafe credential handling; explain the security consequence of each; propose a safer configuration; and review the planned change and validation results before any deployment.

Practical instruction

Review the configuration, its impact, and the proposed fix

Read the change as a set of security decisions

Infrastructure as code (IaC) describes resources and settings that can create or change real environments. Review a proposed diff before it is applied. Identify what becomes reachable, which identities can act, what data is stored, and where credentials come from. Treat a broad permission, public network path, or plaintext value as a decision that needs an explicit owner and purpose, not as a harmless default.

This lesson uses a static fictional configuration. Its resource names, values, and comments are invented examples, not a deployable project or a report about a real environment. Do not copy it into a repository or run an IaC tool against it.

Connect each risky setting to its consequence

Public access on a storage resource can expose its contents to anyone who can reach the public endpoint. A broad inbound rule such as 0.0.0.0/0 on an administration port lets hosts across the internet attempt connections; authentication alone does not make that exposure necessary. A literal password or token in configuration can be copied into source history, plans, logs, or review artifacts and may remain exposed after the visible line is removed.

Explain the path from setting to impact: which data or service is reachable, who could attempt access, and what authority the credential or network rule grants. Distinguish observed configuration from assumptions. The sample is intentionally fictional, so its values demonstrate review patterns rather than prove that any real resource is exposed.

Propose a narrow remediation

Disable public access and require the team’s approved encryption settings for stored data. Replace unrestricted administrative ingress with the organization’s approved private access path or a narrowly scoped, reviewed source range. Remove literal credentials and reference the approved secret-management mechanism with access limited to the identity and workload that need it. Keep resource permissions and network paths no broader than the intended use.

Make the smallest change that closes the identified path while preserving the service requirement. Record why each setting changed and who owns any exception. A variable name, encrypted state file, or secret-store reference does not by itself prove that access is correctly scoped; review the identity permissions and the resource policy together.

Validate the fix before deployment

Review the configuration diff and run the repository’s approved formatting, syntax, and provider-aware validation checks. Use the organization’s IaC policy checks or security scanner to look for public exposure, excessive permissions, and prohibited secret patterns. Review findings and any exceptions rather than treating a clean tool result as proof that every risk is gone.

Inspect the generated plan or equivalent change preview before deployment. Confirm it changes only the intended resources, preserves the expected access boundary, and does not reveal sensitive values in review output. Ask an authorized reviewer to check the remediation and validation evidence; deploy only through the approved protected process after required checks and approvals pass. If the plan is surprising or a check fails, stop and resolve it before deployment.

Safe hands-on exercise

Review a fictional infrastructure change

Fictional training example only. The resource names and settings below are invented, static text with no provider, account, endpoint, credential, or connection. Review the sample; do not copy it into a project or execute, plan, apply, or deploy it.

# FICTIONAL STATIC SAMPLE — do not run or deploy
resource "training_storage" "lesson_archive" {
  public_access = true
  encryption    = "disabled"
}

resource "training_firewall_rule" "admin_access" {
  protocol      = "tcp"
  port          = 22
  source_range  = "0.0.0.0/0"
}

variable "admin_password" {
  default = "FICTIONAL_PLACEHOLDER_NOT_A_SECRET"
}

Apply the lesson

Select every finding, safer change, and review step needed before this fictional configuration could be approved. Explain the impact represented by each risky setting through your choices, then identify how to validate the fix.

Select the risks, safer changes, and pre-deployment review steps

A complete review identifies all five required findings and controls and rejects each unsafe shortcut. The sample is static fiction; no configuration is parsed, executed, deployed, or sent anywhere. This browser-only exercise accepts no free-text answers, credentials, or secret values. Your selections stay in page memory and are not saved or transmitted; changing a selection lets you retry the review.

Knowledge check

Check your understanding

A fictional IaC review finds a public storage setting, unrestricted administrative ingress, and a literal password. Which response best remediates and verifies the change before deployment?

Choose the best answer