Safeguard
Developer Tools•

What should people writing infrastructure as code learn about security?

People who write infrastructure as code need security training on access, exposure, state files, modules and review. A concise topic list with exercises.

Safeguard Security Team
3 min read

People who write infrastructure as code should learn how to grant least privilege, avoid accidental public exposure, protect state and variable files, vet modules and review plans before applying. A small mistake in a template can expose many resources at once, so review habits matter as much as syntax.

Why this is its own skill

Infrastructure code looks like ordinary code but its effects are different. A single line can make a storage bucket public or open a network port to everyone. The change applies across environments, and the error may be invisible until someone finds it.

The OWASP DevSecOps Guideline lists infrastructure as code scanning among the checks a delivery pipeline should include, which shows how established the concern is.

Six topics

  1. Least privilege. Every role and policy should grant what is needed and no more. Teach authors to resist wildcard permissions written to make an error disappear.
  2. Exposure by default. Which resources can become public, and what the safe default setting is for each. Teach a habit: after writing a resource, ask who can reach it.
  3. State and variable files. State can contain sensitive values. Teach where it is stored, who can read it and why it must never sit in a public place or a repository.
  4. Credentials in code. Credentials should be injected at run time from a managed store, not written into templates or default values.
  5. Modules and providers. Reused modules are third party code. Teach authors to pin versions and read what a module creates before using it.
  6. Plan review. Reading the plan output before applying is the last line of defence. Teach how to spot destroy actions and permission changes.

Exercises

ExerciseGoal
Fix a template that opens a port to every addressSpot exposure
Tighten a policy that uses wildcardsPractise least privilege
Read a plan and list every security relevant changeReview habit
Trace where state lives in your own setupKnow the blast radius

Use your own templates, with names changed.

Review rules that help

  • Require a second person to approve changes that alter permissions or network exposure.
  • Split large changes into smaller ones.
  • Run a policy check before apply, and make failures explain what to fix.

Common mistakes

Copying a snippet from a forum without reading it, using one shared high privilege account for every pipeline and leaving temporary rules in place after debugging are all frequent. A short checklist at the top of the pull request template catches many of them.

Where Safeguard fits

Safeguard offers asset discovery, policies and gates, and container image scanning, which complement template review by showing what is actually running. It does not offer training courses. Try a free scan at gold.safeguard.sh/scan.

Quick check

Is infrastructure as code scanning enough on its own?

No. It catches known misconfigurations. Authors still need to understand why a setting matters, and reviewers still need to read plans.

Who should review infrastructure changes?

At least one other person who understands the target environment, with extra scrutiny on changes to permissions and network exposure.

Sources

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.