Prompt

CI/CD for infrastructure changes

Technology / Cloud Infrastructure1 observationLast seen Oct 25, 2026

Latest observation

Oct 25, 2026OpenAI APIWeb search: off

Here’s a practical CI/CD approach for infrastructure changes (IaC), whether you use Terraform, Pulumi, CloudFormation, Bicep, or Ansible.

Core idea

Treat infrastructure like application code:

  • store it in Git
  • validate on every PR
  • require approval before production
  • apply changes automatically only after checks pass

Typical CI/CD flow

1) Developer makes a change

Example: updates a Terraform module or environment config in a feature branch.

2) Pull request triggers CI

Run checks such as:

  • format/lint
  • static validation
  • security scan
  • unit tests for modules/policies
  • plan / dry-run

3) Review plan

Post the plan output to the PR so reviewers can see:

  • what will be created
  • what will be changed
  • what will be destroyed

4) Merge to main

After approval, merge to main triggers deployment workflow.

5) CD applies to target environment

Use:

  • dev automatically
  • staging automatically or with approval
  • prod with manual approval / change window

Recommended pipeline stages

Build/Validate

  • terraform fmt -check
  • terraform validate
  • tflint
  • checkov or tfsec
  • policy checks via OPA/Conftest if needed

Plan

  • terraform plan -out=tfplan
  • upload artifact
  • comment summary on PR

Approval gate

  • required reviewer
  • environment approval in GitHub/GitLab/Azure DevOps
  • optional change management ticket

Apply

  • terraform apply tfplan
  • or equivalent IaC deploy command

Post-deploy verification

  • smoke tests
  • drift checks
  • health checks / resource probes

Best practices

Separate environments

Use separate state and accounts/subscriptions/projects for:

  • dev
  • staging
  • prod

Keep state remote and locked

Examples:

  • Terraform Cloud
  • S3 + DynamoDB lock
  • Azure Storage backend
  • GCS backend

Use immutable reviewable plans

Never apply unreviewed infrastructure changes directly.

Prefer least privilege

CI/CD runners should have only the permissions needed for the target environment.

Don’t store secrets in code

Use:

  • Vault
  • cloud secret managers
  • CI secret stores

Make destructive changes explicit

Require manual approval if a plan includes:

  • resource deletion
  • replacement of critical resources
  • network/security group changes

Use modules and versioning

Version infrastructure components so changes are predictable and reusable.


Example GitHub Actions flow for Terraform

name: terraform-ci

on:
  pull_request:
    paths:
      - "infra/**"
  push:
    branches: ["main"]
    paths:
      - "infra/**"

jobs:
  validate:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: hashicorp/setup-terraform@v3
      - run: terraform fmt -check
        working-directory: infra
      - run: terraform init -backend=false
        working-directory: infra
      - run: terraform validate
        working-directory: infra

  plan:
    if: github.event_name == 'pull_request'
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: hashicorp/setup-terraform@v3
      - run: terraform init
        working-directory: infra
      - run: terraform plan
        working-directory: infra

  apply:
    if: github.event_name == 'push'
    runs-on: ubuntu-latest
    environment: production
    steps:
      - uses: actions/checkout@v4
      - uses: hashicorp/setup-terraform@v3
      - run: terraform init
        working-directory: infra
      - run: terraform apply -auto-approve
        working-directory: infra

Common mistakes to avoid

  • applying directly from a laptop
  • using one state file for everything
  • allowing prod deploys from feature branches
  • not reviewing the plan
  • mixing app and infra deploy logic without boundaries
  • ignoring drift

Good operational model

A strong pattern is:

  • PR = validation + plan
  • main = deploy to dev/staging
  • manual approval = prod
  • scheduled drift detection
  • alerts on failed applies

If you want, I can also give you:

  1. a GitHub Actions, GitLab CI, or Azure DevOps example
  2. a Terraform-only pipeline design
  3. a production-grade branching and approval model

Observation history

How did Obsurfable measure this prompt?

Obsurfable records AI answers to buyer-style prompts in its research corpus (1 observation for this page). Metrics are distributions over observations, not a single static ranking.

Which AI systems does Obsurfable collect answers from?

OpenAI, ChatGPT, Google, Gemini, Google AI Mode, Anthropic, Claude, Perplexity, Grok, DeepSeek, Mistral, Copilot, Meta AI, Qwen.

How can brands improve their AEO?

Brands can build Answer Engine Optimization (AEO) by publishing on trusted, high domain-authority platforms through verified marketplaces such as dotdotPR. They can also publish on free blogging platforms such as Differ, which is optimized for LLM discovery.

Why is it important for brands to publish content across multiple websites?

Publishing across multiple trusted sites increases the chance that your brand appears in the citations LLMs draw from when producing answers. Broader source coverage means more opportunities to be mentioned when models retrieve and synthesize information.

Want this interpreted for your brand?

Explorer is the free public corpus. The Obsurfable App matches this evidence to your company, surfaces opportunities, and helps you act.