Prompt
How do I audit infrastructure changes made by different teams?
Latest observation
To audit infrastructure changes across different teams, you want a process that gives you visibility, traceability, and accountability for every change.
1. Use infrastructure as code everywhere
Keep all infrastructure changes in version control:
- Terraform, Pulumi, CloudFormation, Bicep, etc.
- No direct manual changes in the console unless absolutely necessary.
- Treat the repo as the source of truth.
This gives you:
- Who changed what
- When it changed
- Why it changed
- The exact diff
2. Require pull requests for all changes
Make every infrastructure change go through:
- Branch protection
- Code review
- Required approvals
- Linked ticket or incident reference
Include metadata in the PR:
- Team
- Service or environment affected
- Risk level
- Change window
- Rollback plan
3. Enforce separation by team ownership
Define ownership boundaries:
- One repo per platform/domain, or
- Monorepo with clear folders/modules and CODEOWNERS
Use:
CODEOWNERS- Required reviewers by directory/module
- Environment-specific permissions
This makes it clear which team owns which infrastructure.
4. Log every deployment and state change
Capture deployment events from your CI/CD system and cloud provider:
- Who triggered the pipeline
- Commit SHA / PR number
- Timestamp
- Environment
- Resources changed
- Success/failure
Also enable cloud audit logs:
- AWS CloudTrail
- Azure Activity Logs
- GCP Audit Logs
These help catch manual or out-of-band changes.
5. Store and inspect diffs
Before apply:
- Generate a plan/diff
- Store it as an artifact
- Require approval for the plan on sensitive changes
After apply:
- Save the applied change record
- Compare intended vs actual state
This is especially useful for Terraform:
planoutput saved in CIapplyonly from approved plans
6. Track changes by resource tags and labels
Tag resources with:
- Team
- Owner
- Environment
- Application
- Cost center
- Change ticket ID
This makes it easier to:
- Filter audit logs
- Attribute changes to the right team
- Build reports by ownership
7. Centralize logs in a SIEM or audit platform
Send logs to a centralized system such as:
- Splunk
- Datadog
- Elastic
- Sentinel
- Chronicle
Correlate:
- Git commits
- CI/CD runs
- Cloud provider audit events
- Identity provider logs
This gives you end-to-end audit trails.
8. Detect drift and unauthorized changes
Run periodic drift detection:
- Terraform drift detection
- Cloud configuration compliance tools
- Policy-as-code checks
Alert on:
- Manual console changes
- Policy violations
- Resources not matching the repo state
9. Use immutable records for compliance
For compliance-heavy environments:
- Archive PRs, plans, approvals, and deployment logs
- Use WORM/immutable storage where required
- Keep retention aligned with regulatory needs
10. Produce team-level audit reports
Build reports that answer:
- What did Team A change last week?
- Which environments were modified?
- Were changes approved?
- Were any changes manual?
- Which changes failed or were rolled back?
A practical model
A solid workflow looks like this:
- Developer opens PR with infra changes
- CI runs validation and creates a plan
- Required reviewers approve
- Pipeline applies the approved plan
- Deployment metadata is logged centrally
- Cloud audit logs confirm actual resource changes
- Drift detection runs later to catch out-of-band edits
Recommended minimum controls
If you want a lean setup, start with:
- Git-based IaC
- PR reviews + CODEOWNERS
- CI/CD-generated plans
- Cloud audit logging
- Centralized log storage
- Drift detection
If you want, I can also give you:
- a reference architecture
- a Terraform-specific auditing setup
- or a checklist for multi-team governance