feat(skills): Add comprehensive Terraform best practices skill#27
feat(skills): Add comprehensive Terraform best practices skill#27
Conversation
Generated from terraform-best-practices.com with manual enhancements. Key Features: - Infrastructure sizing patterns (small/medium/large) - Module types (resource/infrastructure/compositions) - Naming conventions and code styling guidelines - State management best practices with security warnings - Terraform vs Terragrunt decision matrix - Common patterns and frequent problem solutions - Tool recommendations (tflint, tfsec, Terragrunt, etc.) Content includes: - 456 lines of comprehensive documentation - 8 HCL code examples - 31 subsections covering all aspects - Reference files with 2600+ lines of extracted content Quality improvements from code review: - Fixed for_each example to use stable key mapping - Enhanced state security warnings (plaintext secrets notice) - Added version metadata and attribution - Strengthened IAM and encryption recommendations Source: Anton Babenko's terraform-best-practices.com Skill Level: Intermediate 🤖 Generated with [Nori](https://nori.ai) Co-Authored-By: Nori <contact@tilework.tech>
🔍 PR Validation ReportStatus: Changes Summary
Skill ValidationThis is an automated validation. Issues are advisory and do not block merging. |
Summary of ChangesHello @enuno, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a robust new skill focused on Terraform best practices, providing detailed guidance for managing infrastructure as code. It integrates community-driven recommendations and addresses critical aspects like scalability, security, and common pitfalls. The content has been meticulously curated and refined based on internal code review, ensuring a high-quality resource for Terraform users. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
|
||||||||||||||||||||||
There was a problem hiding this comment.
Code Review
This pull request introduces a comprehensive and well-structured skill for Terraform best practices, which is a valuable addition. The documentation is thorough and covers many important aspects of using Terraform effectively. I've identified a couple of areas for improvement: one is to enhance a code example to better align with dynamic best practices, and the other is to fix a broken reference to a missing file in the documentation index. Overall, this is a great contribution.
| ### Terraform | ||
| **File:** `terraform.md` | ||
| **Pages:** 27 |
| # Bad - index changes cause recreation | ||
| resource "aws_subnet" "example" { | ||
| count = length(var.azs) | ||
| cidr_block = cidrsubnet(var.vpc_cidr, 8, count.index) | ||
| } | ||
|
|
||
| # Good - stable keys prevent recreation with explicit mapping | ||
| locals { | ||
| az_cidrs = { | ||
| "us-east-1a" = cidrsubnet(var.vpc_cidr, 8, 0) | ||
| "us-east-1b" = cidrsubnet(var.vpc_cidr, 8, 1) | ||
| "us-east-1c" = cidrsubnet(var.vpc_cidr, 8, 2) | ||
| } | ||
| } | ||
|
|
||
| resource "aws_subnet" "example" { | ||
| for_each = local.az_cidrs | ||
| availability_zone = each.key | ||
| cidr_block = each.value | ||
| } |
There was a problem hiding this comment.
The example for Count vs For_Each is a great illustration of a common Terraform pitfall. However, it could be improved to be more robust and complete for a best-practices guide.
- The "Good" example hardcodes the availability zones and their corresponding CIDR block indexes. A more dynamic and powerful pattern would be to generate this map from a variable (e.g.,
var.azs), which is more common in real-world scenarios. - Both the "Bad" and "Good" examples for
aws_subnetare missing the requiredvpc_idargument, making them technically invalid HCL code.
I suggest updating the example to be more dynamic and complete, which will provide a more practical and robust illustration of the concept.
# Bad - index changes cause recreation
resource "aws_subnet" "example" {
count = length(var.azs)
vpc_id = var.vpc_id
cidr_block = cidrsubnet(var.vpc_cidr, 8, count.index)
availability_zone = var.azs[count.index]
}
# Good - stable keys prevent recreation with explicit mapping
locals {
# This creates a map of AZ names to CIDR blocks, e.g.,
# { "us-east-1a" = "10.0.0.0/24", "us-east-1b" = "10.0.1.0/24" }
subnets = { for i, az in var.azs : az => cidrsubnet(var.vpc_cidr, 8, i) }
}
resource "aws_subnet" "example" {
for_each = local.subnets
vpc_id = var.vpc_id
availability_zone = each.key
cidr_block = each.value
}
PR Code Suggestions ✨Explore these optional code suggestions:
|
|||||||||||||||||||||
Integrated comprehensive Terraform best practices skill to skills directory: - Main SKILL.md: 456 lines covering all aspects of Terraform IaC - Reference docs: 2600+ lines of extracted content - 8 HCL code examples demonstrating best practices - Coverage: infrastructure sizing, modules, state management, tools Source: Anton Babenko's terraform-best-practices.com Quality: Code reviewed and enhanced with security warnings Files: - skills/terraform-best-practices/SKILL.md - skills/terraform-best-practices/references/ (4 files) - skills/terraform-best-practices/CLAUDE.md - Updated skills/README.md to include new entry (33 total skills) 🤖 Generated with [Nori](https://nori.ai) Co-Authored-By: Nori <contact@tilework.tech>
User description
Summary
Generated comprehensive Terraform best practices skill from terraform-best-practices.com with significant manual enhancements based on code review feedback.
Key Features
Content Quality
Code Review Improvements
Based on nori-code-reviewer feedback, the following improvements were made:
for_eachexample to use stable key mapping (preventing recreation issues)Source Attribution
Test Plan
Files Changed
INTEGRATION/incoming/terraform-best-practices/SKILL.md- Main skill file (456 lines)INTEGRATION/incoming/terraform-best-practices/references/- Supporting documentation (4 files, 2600+ lines)INTEGRATION/incoming/terraform-best-practices/CLAUDE.md- Context metadataNext Steps
/integration-processto move skill to final location🤖 Generated with Nori AI workflow
PR Type
Enhancement
Description
Add comprehensive Terraform best practices skill with 456 lines of documentation
Include 8 HCL code examples demonstrating infrastructure patterns
Create reference files with 2600+ lines extracted from terraform-best-practices.com
Organize content for small/medium/large infrastructure sizing patterns
Add multilingual index covering 20+ languages
Diagram Walkthrough
File Walkthrough
SKILL.md
Comprehensive Terraform best practices documentationINTEGRATION/incoming/terraform-best-practices/SKILL.md
practices
large 100+ resources)
guidance
recommendations
terraform.md
Terraform reference documentation from sourceINTEGRATION/incoming/terraform-best-practices/references/terraform.md
examples.md
Terraform code structure examples and patternsINTEGRATION/incoming/terraform-best-practices/references/examples.md
llms.md
Multilingual language index for all contentINTEGRATION/incoming/terraform-best-practices/references/llms.md
Portuguese, English, French, etc.)
sections
index.md
Documentation index and navigationINTEGRATION/incoming/terraform-best-practices/references/index.md
CLAUDE.md
Claude context metadata fileINTEGRATION/incoming/terraform-best-practices/CLAUDE.md