Generate-Modern-Terraform-Code-For-Azure
Generate-Modern-Terraform-Code-For-Azure是一款code方向的AI技能,核心价值是Guidelines for generating modern Terraform code for Azure,可用于解决开发者在code领域的实际问题,帮助用户提升效率、自动化重复任务或优化工作流。
Guidelines for generating modern Terraform code for Azure
mkdir -p ./skills/generate-modern-terraform-code-for-azure && curl -sfL https://raw.githubusercontent.com/github/awesome-copilot/main/skills/generate-modern-terraform-code-for-azure/SKILL.md -o ./skills/generate-modern-terraform-code-for-azure/SKILL.md Run in terminal / PowerShell. Requires curl (Unix) or PowerShell 5+ (Windows).
Skill Content
1. Use Latest Terraform and Providers
Always target the latest stable Terraform version and Azure providers. In code, specify the required Terraform and provider versions to enforce this. Keep provider versions updated to get new features and fixes.
2. Organize Code Cleanly
Structure Terraform configurations with logical file separation:
- Use `main.tf` for resources
- Use `variables.tf` for inputs
- Use `outputs.tf` for outputs
- Follow consistent naming conventions and formatting (`terraform fmt`)
This makes the code easy to navigate and maintain.
3. Encapsulate in Modules
Use Terraform modules to group reusable infrastructure components. For any resource set that will be used in multiple contexts:
- Create a module with its own variables/outputs
- Reference it rather than duplicating code
- This promotes reuse and consistency
4. Leverage Variables and Outputs
- **Parameterize** all configurable values using variables with types and descriptions
- **Provide default values** where appropriate for optional variables
- **Use outputs** to expose key resource attributes for other modules or user reference
- **Mark sensitive values** accordingly to protect secrets
5. Provider Selection (AzureRM vs AzAPI)
- **Use `azurerm` provider** for most scenarios – it offers high stability and covers the majority of Azure services
- **Use `azapi` provider** only for cases where you need:
- The very latest Azure features
- A resource not yet supported in `azurerm`
- **Document the choice** in code comments
- Both providers can be used together if needed, but prefer `azurerm` when in doubt
6. Minimal Dependencies
- **Do not introduce** additional providers or modules beyond the project's scope without confirmation
- If a special provider (e.g., `random`, `tls`) or external module is needed:
- Add a comment to explain
- Ensure the user approves it
- Keep the infrastructure stack lean and avoid unnecessary complexity
7. Ensure Idempotency
- Write configurations that can be applied repeatedly with the same outcome
- **Avoid non-idempotent actions**:
- Scripts that run on every apply
- Resources that might conflict if created twice
- **Test by doing multiple `terraform apply` runs** and ensure the second run results in zero changes
- Use resource lifecycle settings or conditional expressions to handle drift or external changes gracefully
8. State Management
- **Use a remote backend** (like Azure Storage with state locking) to store Terraform state securely
- Enable team collaboration
- **Never commit state files** to source control
- This prevents conflicts and keeps the infrastructure state consistent
9. Document and Diagram
- **Maintain up-to-date documentation**
- **Update README.md** with any new variables, outputs, or usage instructions whenever the code changes
- Consider using tools like `terraform-docs` for automation
- **Update architecture diagrams** to reflect infrastructure changes after each significant update
- Well-documented code and diagrams ensure the whole team understands the infrastructure
10. Validate and Test Changes
- **Run `terraform validate`** and review the `terraform plan` output before applying changes
- Catch errors or unintended modifications early
- **Consider implementing automated checks**:
- CI pipeline
- Pre-commit hooks
- Enforce formatting, linting, and basic validation
🎯 Best For
- Developers scaffolding new projects
- Prototype builders
- UI designers
- Product designers
- Claude users
💡 Use Cases
- Bootstrapping React components
- Creating API route handlers
- Generating component mockups
- Creating design system tokens
📖 How to Use This Skill
- 1
Install the Skill
Copy the install command from the Terminal tab and run it. The SKILL.md file downloads to your local skills directory.
- 2
Load into Your AI Assistant
Open Claude or GitHub Copilot and reference the skill. Paste the SKILL.md content or use the system prompt tab.
- 3
Apply Generate-Modern-Terraform-Code-For-Azure to Your Work
Open your project in the AI assistant and ask it to apply the skill. Start with a small module to verify the output quality.
- 4
Review and Refine
Review AI suggestions before committing. Run tests, check for regressions, and iterate on the skill output.
❓ Frequently Asked Questions
Can I customize the generated output?
Yes — modify the skill's prompt instructions to match your project conventions and coding style.
Does this work with Figma?
Some design skills integrate with Figma plugins. Check the Works With section for supported tools.
Is Generate-Modern-Terraform-Code-For-Azure compatible with Cursor and VS Code?
Yes — this skill works with any AI coding assistant including Cursor, VS Code with Copilot, and JetBrains IDEs.
Do I need specific dependencies for Generate-Modern-Terraform-Code-For-Azure?
Check the install command and Works With section. Most code skills only require the AI assistant and your codebase.
How do I install Generate-Modern-Terraform-Code-For-Azure?
Copy the install command from the Terminal tab and run it. The skill downloads to ./skills/generate-modern-terraform-code-for-azure/SKILL.md, ready to use.
⚠️ Common Mistakes to Avoid
Using generated code without understanding
Understand what generated code does before shipping it to production.
Skipping usability testing
AI-generated designs should be validated with real users before development.
Skipping validation
Always test AI-generated code changes, even for simple refactors.
Missing dependency updates
Check if the skill requires updated dependencies or new packages.