DEV Community

Cover image for I Built an AI-Powered Infrastructure Documentation Generator Using GitHub Copilot CLI
kaustubh yerkade
kaustubh yerkade

Posted on

I Built an AI-Powered Infrastructure Documentation Generator Using GitHub Copilot CLI

GitHub Copilot CLI Challenge Submission

This is a submission for the GitHub Copilot CLI Challenge

What I Built

As a DevOps engineer, one recurring pain point I’ve experienced is infrastructure documentation.

We write Terraform.
We deploy Kubernetes.
We build Docker images.

But documentation? It often gets delayed or skipped.

So I built AI-Powered Infra Doc Generator. A CLI tool that turns Infrastructure as Code into structured, enterprise grade documentation using GitHub Copilot CLI.

This tool:

  • Reads Terraform / YAML / Dockerfiles
  • Sends structured prompts to GitHub Copilot CLI
  • Generates:
    • Architecture Overview
    • Component Breakdown
    • Security Risk Analysis
    • Cost Optimization Suggestions
    • Mermaid Architecture Diagram

All automatically in seconds. Instead of manually writing documentation, infrastructure can now explain itself.

Demo

Run the CLI-

$infra-doc-gen main.tf
Enter fullscreen mode Exit fullscreen mode

The tool creates:

INFRA_DOC.md
Enter fullscreen mode Exit fullscreen mode

Example output:

# Architecture Overview

This Terraform configuration provisions:
- AWS EC2 instance
- Application Load Balancer
- Security Group
- RDS Database

## Security Risks
- Security group allows 0.0.0.0/0 on port 22
- RDS encryption not enabled
- No IAM least-privilege enforcement

## Cost Optimization
- Use smaller instance types for non-production
- Enable autoscaling
- Consider Reserved Instances

Enter fullscreen mode Exit fullscreen mode

Screenshots-

It also generates a Mermaid diagram:

graph TD
User --> ALB
ALB --> EC2
EC2 --> RDS
Enter fullscreen mode Exit fullscreen mode

GitHub Repo: https://github.com/kaustubhyerkade/infra_doc_gen

My Experience with GitHub Copilot CLI

GitHub Copilot CLI completely changed how I approached this project.

Instead of building API wrappers or integrating SDKs, I could:

Work directly inside the terminal
Use natural language prompts
Iterate rapidly on structured AI responses
The biggest learning for me was prompt engineering.

Instead of asking:
“Explain this Terraform file”

I used structured instructions like:

You are a senior cloud architect.

Analyze the following infrastructure code and generate:

1. Architecture Overview
2. Key Components
3. Security Risks
4. Cost Optimization Suggestions
5. Mermaid diagram
Enter fullscreen mode Exit fullscreen mode

This dramatically improved the quality and structure of the output.
It genuinely felt like pairing with a Cloud Architect inside my terminal.

Top comments (0)