This is a submission for the GitHub Copilot CLI Challenge
What I Built
Automating the boring stuff: I built a Copilot CLI Agent that automatically refactors Terraform deprecations and opens Pull Requests using the Model Context Protocol (MCP).
No more manual upgrades. No more missed warnings. No more broken pipelines.
This solution integrates:
- GitHub Copilot CLI Agent (custom-named “copilot”)
- Terraform MCP Server
- Azure DevOps Pipelines
- Automatic PR creation in Azure Repos
- Continuous azurerm provider maintenance
The result: Infrastructure maintenance becomes autonomous.
🧩 The Problem
Terraform projects — especially those using the Azure provider — accumulate technical debt fast.
Every new release of the HashiCorp azurerm provider introduces:
- Deprecated resources
- Renamed arguments
- Behavioral changes
- Breaking updates
- Plan failures over time
Manually fixing these across dozens of .tf files is:
- ❌ Time-consuming
- ❌ Error-prone
- ❌ Often postponed
- ❌ Risky in production
💡 The Solution
I engineered a fully autonomous remediation agent that:
- Detects outdated provider versions
- Upgrades azurerm to the latest compatible version
- Runs Terraform plan
- Uses MCP to fetch exact replacements for deprecated fields
- Refactors code safely
- Validates changes
- Creates a Pull Request automatically
All inside an Azure Pipeline — with zero human intervention.
My Experience with GitHub Copilot CLI
Using the GitHub Copilot CLI in agent mode was transformative.
Instead of just generating code snippets, Copilot acted as:
➡️ An autonomous developer
➡️ A refactoring engine
➡️ A DevOps assistant
➡️ A remediation bot
What impressed me most:
🧩 Context Awareness
- The agent understood:
- Repository structure
- Terraform semantics
- Pipeline environment
- Required workflow steps
⚡ Speed of Development
- Tasks that normally take hours were reduced to minutes:
- Writing complex pipeline logic
- Handling provider upgrades
- Creating PR automation
- Integrating MCP
🧠 From Assistant → Agent
This project highlights the shift from AI as a helper to AI as a teammate that executes tasks end-to-end.
This agent enables:
- 🛡️ Continuous compliance with provider updates
- ⚡ Faster upgrade cycles
- 🧹 Reduced technical debt
- 🤖 Autonomous DevOps operations
- 🏢 Enterprise scalability
🔮 Future Improvements
Planned enhancements:
- Slack / Teams notifications on PR creation
- Multi-provider support (AWS, GCP)
- Drift detection integration
- Security policy checks
- Automatic merge on green validation
- ChatOps commands to trigger updates
🧪 Key Technologies Used
- GitHub Copilot CLI (Agent Mode)
- Terraform
- Model Context Protocol (MCP)
- Azure DevOps Pipelines
- Docker
- Azure CLI
- PowerShell
Top comments (1)
Awesome 👍. It'll reduce the manual stuff.