Skip to main content
RunBook Academy

Git, CI/CD & GitOpsXXVII · Infrastructure Repository ArchitectureRepoArch

Network and policy repositories — separate repositories for network and policy configuration

Advanced⏱ ~24 mingit

What you'll learn

  • Explain why network configuration belongs in its own repository, separate from the application repository
  • Explain why policy configuration (OPA, network policy, IAM) belongs in its own repository
  • State the security boundary the separate repository enforces (CODEOWNERS, branch protection, blast radius)
  • Apply the cross-repo change pattern when a network change is required by an application change

Prerequisites

Verified against Git 2.55.x teaching target; 2.40+ minimum · GitHub Actions continuous service; Aug 2026 documentation baseline · Argo CD v3.5.x teaching target; v3.0+ minimum · Flux v2.9.x · Sigstore Cosign v3.1.x · SLSA v1.2 · OCI Distribution Specification v1.1 · Git LFS v3.7.1 · Kubernetes (cross-course target) 1.36.x

Not yet marked complete on this device.

Application configuration, network configuration, and policy configuration are three kinds of code with three different blast radii. An application change breaks one workload. A network change can open a path that exposes every workload in a VPC. A policy change can grant a permission that violates a regulatory boundary. The repository layout must encode that difference, and the encoding is separate repositories.

Why network and policy are separate

flowchart LR
    APP["infra-app"]
    NET["infra-network"]
    POL["infra-policy"]
    APP -->|consumes| NET
    APP -->|consumes| POL
  • Blast radius. A network change can open a public CIDR, attach a security group that grants SSH from 0.0.0.0/0, or remove a route that breaks east-west traffic.
  • Reviewer surface. Network reviewers are network engineers; policy reviewers are security engineers. CODEOWNERS is most reliably enforced at the repository boundary.
  • Audit and compliance. A regulator needs a single repository whose history is the answer. Conflating produces a single history that has to be filtered every time.

The network repository

A infra-network repository holds VPCs, subnets, route tables, NAT gateways, peering connections, security groups, network ACLs, DNS zones. The layout follows the Terraform conventions from lesson 02, but the CODEOWNERS file is the differentiator:

# CODEOWNERS for infra-network
/modules/vpc/         @network-team
/modules/security/    @network-team
/environments/prod/   @network-team @security-team

Every PR that touches a network module requires a network engineer’s review, and every PR that touches a production environment requires a security engineer’s review as well. The application team that consumes the VPC module through a versioned reference cannot bypass this rule.

The policy repository

A infra-policy repository holds OPA Rego bundles, Kubernetes NetworkPolicy manifests, IAM policy documents, and Terraform Sentinel policies. The policy repository is the most sensitive of the three, because a bad policy change can grant a permission that the rest of the security model relies on denying.

# CODEOWNERS for infra-policy
/iam/                 @security-team
/opa/                 @security-team @platform-team
/network-policies/    @security-team @platform-team
/environments/prod/   @security-team

The pattern is the same as the network repository, but the reviewer pool is narrower.

The cross-repo change pattern

When an application change requires a network change, the change is two pull requests:

sequenceDiagram
    participant A as Application engineer
    participant N as Network team
    A->>N: Open PR in infra-network
    N->>N: Merge, tag release
    A->>A: Open PR in infra-app: bump tag
    A->>A: Merge, deploy

The network change is merged first, because the application change cannot be reviewed without the network change being available. The application’s PR is a submodule bump that consumes the new tag. The price of the boundary is two PRs; the benefit is that the network team cannot be bypassed.

Production discipline

  1. Put network configuration in infra-network, not in infra-app. A security group module in the application repository is a security boundary violation.
  2. Put policy configuration in infra-policy, not in infra-app or infra-network. OPA bundles, IAM policy documents, and NetworkPolicy manifests belong in the repository the security team owns.
  3. Use CODEOWNERS at the repository root. The hosting provider enforces CODEOWNERS more reliably at the repository boundary.
  4. Use the cross-repo change pattern for application changes that require network or policy changes. The network or policy PR is reviewed and merged first; the application PR is a submodule bump that consumes the new tag.
  5. Tag every released network or policy module. The tag is the version; the team’s CI should produce the tag.

Cross-course references

  • Linux for Production Sysadmins - Part XXXIV (NetworkHardening) covers the firewall configuration that lives in the network repository.
  • Kubernetes for Production Sysadmins - Part XII (NetworkPolicies) covers the NetworkPolicy manifests that live in the policy repository.
  • Terraform for Production Sysadmins - Part XII (RegistryModules) covers the versioned module reference used in the cross-repo change pattern.

Quiz

Knowledge check · 4 questions

  1. Q1. A Terraform module that creates an AWS security group lives in the application repository, alongside the Kubernetes manifest that consumes the security group's ID. Why is this a security boundary violation?

  2. Q2. A network change required by an application change is one pull request, because the two are reviewed together and the merge happens in the application repository.

  3. Q3. Name the three reasons that drive the split of application, network, and policy configuration into separate repositories, and state which one is the most commonly cited in a regulatory audit.

  4. Q4. Recommend the right repository split and the right cross-repo change pattern for an application change that requires a new security group, and explain why the order of the two pull requests matters.

    An application team is deploying a new service that needs a new AWS security group with port 8443 open from a specific CIDR. The security group module currently lives in the application repository. The platform team has just created an `infra-network` repository and an `infra-policy` repository, and is asking the application team to migrate.

Passing score: 75%. Answers are checked in this browser.