Langsung ke konten
Skillpedia
Deploy & cloud (DevOps)48k ยท #5965

terraform-skill

Fungsinya

Alat ini membantu Anda menulis dan mengatur kode untuk mengelola infrastruktur teknologi (seperti server dan database) secara otomatis dan aman. Alat ini menyediakan praktik terbaik untuk tools seperti Terraform dan OpenTofu.

Kapan dipakai

  • โœ“Saat membuat konfigurasi baru untuk mengelola infrastruktur Anda.
  • โœ“Saat menyiapkan tes untuk kode infrastruktur Anda.
  • โœ“Saat menentukan cara mengatur kode untuk banyak environment atau untuk continuous integration.

Link skill

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/terraform-skill/SKILL.md

Salin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.

Cara pakai

Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.

Pesan siap tempel

Gunakan skill ini untuk membantu saya: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/terraform-skill/SKILL.md Baca file SKILL.md di link tersebut dan ikuti instruksinya untuk tugas saya.
Mau AI Anda menemukan skill seperti ini sendiri?Pasang MCP Skillpedia gratis: cukup satu baris, dan AI mencari di antara 15.000+ skill sebelum tiap tugas.Pasang dalam 1 menit โ†’

Contoh permintaan ke AI

โ€œSaya ingin membuat module Terraform baru untuk mengelola resource jaringan, dengan mengikuti praktik terbaik untuk keamanan dan organisasi.โ€

5 skill baru setiap minggu. 1 menit baca.

Cara kerjanya

Alat ini menganalisis kode infrastruktur Anda dan memberikan saran perbaikan, memeriksa keamanan, serta membantu memilih pendekatan terbaik untuk mengatur dan menguji kode Anda.

Konten teknis (SKILL.md asli)

Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.

Terraform Skill for Claude

Comprehensive Terraform and OpenTofu guidance covering testing, modules, CI/CD, and production patterns. Based on terraform-best-practices.com and enterprise experience.

Detailed Guide

Read the detailed guide before executing this skill. It retains the complete procedure and reference material. Treat its safety, prerequisites, and validation requirements as mandatory. For focused work, load the relevant sections; for end-to-end work, read the guide completely.

When to Use This Skill

Activate this skill when:

  • Creating new Terraform or OpenTofu configurations or modules
  • Setting up testing infrastructure for IaC code
  • Deciding between testing approaches (validate, plan, frameworks)
  • Structuring multi-environment deployments
  • Implementing CI/CD for infrastructure-as-code
  • Reviewing or refactoring existing Terraform/OpenTofu projects
  • Choosing between module patterns or state management approaches

Don't use this skill for:

  • Basic Terraform/OpenTofu syntax questions (Claude knows this)
  • Provider-specific API reference (link to docs instead)
  • Cloud platform questions unrelated to Terraform/OpenTofu

Count vs For_Each: When to Use Each

Quick Decision Guide

Scenario Use Why
Boolean condition (create or don't) count = condition ? 1 : 0 Simple on/off toggle
Simple numeric replication count = 3 Fixed number of identical resources
Items may be reordered/removed for_each = toset(list) Stable resource addresses
Reference by key for_each = map Named access to resources
Multiple named resources for_each Better maintainability

Common Patterns

Boolean conditions:

# โœ… GOOD - Boolean condition
resource "aws_nat_gateway" "this" {
  count = var.create_nat_gateway ? 1 : 0
  # ...
}

Stable addressing with for_each:

# โœ… GOOD - Removing "us-east-1b" only affects that subnet
resource "aws_subnet" "private" {
  for_each = toset(var.availability_zones)

  availability_zone = each.key
  # ...
}

# โŒ BAD - Removing middle AZ recreates all subsequent subnets
resource "aws_subnet" "private" {
  count = length(var.availability_zones)

  availability_zone = var.availability_zones[count.index]
  # ...
}

For migration guides and detailed examples, see: Code Patterns: Count vs For_Each

Security & Compliance

Essential Security Checks

# Static security scanning
trivy config .
checkov -d .

Common Issues to Avoid

โŒ Don't:

  • Store secrets in variables
  • Use default VPC
  • Skip encryption
  • Open security groups to 0.0.0.0/0

โœ… Do:

  • Use AWS Secrets Manager / Parameter Store
  • Create dedicated VPCs
  • Enable encryption at rest
  • Use least-privilege security groups

For detailed security guidance, see:

  • Security & Compliance Guide - Trivy/Checkov integration, secrets management, state file security, compliance testing

Limitations

  • Use this skill only when the task clearly matches the scope described above.
  • Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
  • Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
Pertanyaan umum

Apa itu 'infrastructure as code'?

Ini adalah cara menulis kode untuk mendefinisikan dan mengelola infrastruktur TI Anda, alih-alih mengonfigurasinya secara manual. Dengan cara ini, prosesnya bisa diulang, dikelola versinya, dan lebih andal.

Apa perbedaan 'count' dan 'for_each' di Terraform?

'count' digunakan untuk membuat sejumlah resource yang identik dengan jumlah tetap, sedangkan 'for_each' lebih fleksibel karena memungkinkan pembuatan resource berdasarkan list atau map, sehingga lebih mudah dirawat ketika item ditambahkan atau dihapus.

Mengapa penting untuk menguji infrastruktur?

Pengujian memastikan infrastruktur Anda berperilaku sesuai harapan, mencegah error di production, dan memverifikasi bahwa konfigurasi keamanan sudah benar sebelum diterapkan.

Detail

Deskripsi asli dari pembuat

Terraform infrastructure as code best practices

repo: sickn33/agentic-awesome-skills

Popularitas

Bintang GitHub
48k
Peringkat
#5965
Lisensi
MIT
Diperbarui
15/10/2026

Apakah skill ini berguna?

0

Masuk untuk memberi suara.

Komentar

  • โ€ฆ

Skill lain dari repositori ini

Skill serupa