option
HomeHome Skill Cloud Infrastructure terraform-module-library

terraform-module-library

amurata/cc-tools amurata/cc-tools

Infrastructure as Codeベストプラクティスに従って、AWS、Azure、GCPインフラ用の再利用可能なTerraformモジュールを構築します。インフラモジュール作成、クラウドプロビジョニング標準化、再利用可能なIaCコンポーネント実装時に使用します。

...Expand all
50
Updated time June 29, 2026

About terraform-module-library

The terraform-module-library skill provides a structured collection of reusable Terraform modules designed for deploying production-ready infrastructure across AWS, Azure, and GCP. It addresses the challenges of managing cloud infrastructure consistently by offering standardized patterns for common components like VPCs, Kubernetes clusters, databases, and storage services. By following Infrastructure as Code best practices, this skill simplifies the creation, testing, and maintenance of cloud environments, reducing the risk of misconfigurations and ensuring repeatable deployments across multiple cloud providers.

Key features include well-organized module structures, with separate directories for each cloud provider and subdirectories for individual resources such as VPCs, RDS, S3, AKS, GKE, and Cloud SQL. Each module follows a consistent pattern with main Terraform resources, input variables, outputs, examples, version pinning, and testing files. Modules include input validation, semantic versioning, Terratest integration, and tagging standards to maintain reliability and traceability. Additionally, example configurations demonstrate practical implementations, facilitating easier adoption and integration into existing infrastructure pipelines.

This skill is ideal for DevOps engineers, cloud architects, and infrastructure teams aiming to standardize provisioning processes and create reusable, maintainable Terraform modules. It supports scenarios including multi-cloud deployments, establishing organizational Terraform standards, building reusable infrastructure components, and ensuring compliance with best practices. Organizations seeking to accelerate cloud adoption while maintaining operational consistency will find this skill particularly useful.

FAQ

Which cloud providers are supported by the terraform-module-library?

The skill provides reusable Terraform modules for AWS, Azure, and GCP, covering common infrastructure components for each provider.

Can these modules be used for production environments?

Yes, the modules are designed to be production-ready and follow best practices including input validation, tagging, version pinning, and testing with Terratest.

How are modules structured and organized?

Modules are organized by cloud provider and resource type, with a standard pattern including main.tf, variables.tf, outputs.tf, versions.tf, README.md, examples, and tests.

Do the modules support multi-cloud deployments?

Yes, the skill is intended for creating reusable components that can be integrated across multiple cloud providers.

Are there any requirements for using these modules?

Users should have a working knowledge of Terraform and cloud provider services. Modules assume access to the relevant cloud accounts and proper IAM permissions.

View on GitHub

English | 日本語

Terraformモジュールライブラリ

AWS、Azure、GCPインフラ用の本番環境対応Terraformモジュールパターン。

目的

複数のクラウドプロバイダーにまたがる一般的なクラウドインフラパターン用の再利用可能で、十分にテストされたTerraformモジュールを作成します。

使用タイミング

  • 再利用可能なインフラコンポーネントの構築
  • クラウドリソースプロビジョニングの標準化
  • Infrastructure as Codeベストプラクティスの実装
  • マルチクラウド互換モジュールの作成
  • 組織のTerraform標準の確立

モジュール構造

terraform-modules/├── aws/│   ├── vpc/│   ├── eks/│   ├── rds/│   └── s3/├── azure/│   ├── vnet/│   ├── aks/│   └── storage/└── gcp/    ├── vpc/    ├── gke/    └── cloud-sql/

標準モジュールパターン

module-name/├── main.tf          # メインリソース├── variables.tf     # 入力変数├── outputs.tf       # 出力値├── versions.tf      # プロバイダーバージョン├── README.md        # ドキュメント├── examples/        # 使用例│   └── complete/│       ├── main.tf│       └── variables.tf└── tests/           # Terratestファイル    └── module_test.go

AWS VPCモジュール例

main.tf:

resource "aws_vpc" "main" {  cidr_block           = var.cidr_block  enable_dns_hostnames = var.enable_dns_hostnames  enable_dns_support   = var.enable_dns_support  tags = merge(    {      Name = var.name    },    var.tags  )}resource "aws_subnet" "private" {  count             = length(var.private_subnet_cidrs)  vpc_id            = aws_vpc.main.id  cidr_block        = var.private_subnet_cidrs[count.index]  availability_zone = var.availability_zones[count.index]  tags = merge(    {      Name = "${var.name}-private-${count.index + 1}"      Tier = "private"    },    var.tags  )}resource "aws_internet_gateway" "main" {  count  = var.create_internet_gateway ? 1 : 0  vpc_id = aws_vpc.main.id  tags = merge(    {      Name = "${var.name}-igw"    },    var.tags  )}

variables.tf:

variable "name" {  description = "VPCの名前"  type        = string}variable "cidr_block" {  description = "VPC用CIDRブロック"  type        = string  validation {    condition     = can(regex("^([0-9]{1,3}\.){3}[0-9]{1,3}/[0-9]{1,2}$", var.cidr_block))    error_message = "CIDRブロックは有効なIPv4 CIDR表記でなければなりません。"  }}variable "availability_zones" {  description = "アベイラビリティゾーンのリスト"  type        = list(string)}variable "private_subnet_cidrs" {  description = "プライベートサブネット用CIDRブロック"  type        = list(string)  default     = []}variable "enable_dns_hostnames" {  description = "VPCでDNSホスト名を有効化"  type        = bool  default     = true}variable "tags" {  description = "追加タグ"  type        = map(string)  default     = {}}

outputs.tf:

output "vpc_id" {  description = "VPCのID"  value       = aws_vpc.main.id}output "private_subnet_ids" {  description = "プライベートサブネットのID"  value       = aws_subnet.private[*].id}output "vpc_cidr_block" {  description = "VPCのCIDRブロック"  value       = aws_vpc.main.cidr_block}

ベストプラクティス

  1. モジュールにセマンティックバージョニングを使用
  2. 説明付きですべての変数を文書化
  3. examples/ディレクトリに例を提供
  4. 入力検証に検証ブロックを使用
  5. モジュール構成のために重要な属性を出力
  6. versions.tfでプロバイダーバージョンをピン
  7. 計算値にlocalsを使用
  8. count/for_eachで条件付きリソースを実装
  9. Terratestでモジュールをテスト
  10. すべてのリソースに一貫してタグ付け

モジュール構成

module "vpc" {  source = "../../modules/aws/vpc"  name               = "production"  cidr_block         = "10.0.0.0/16"  availability_zones = ["us-west-2a", "us-west-2b", "us-west-2c"]  private_subnet_cidrs = [    "10.0.1.0/24",    "10.0.2.0/24",    "10.0.3.0/24"  ]  tags = {    Environment = "production"    ManagedBy   = "terraform"  }}module "rds" {  source = "../../modules/aws/rds"  identifier     = "production-db"  engine         = "postgres"  engine_version = "15.3"  instance_class = "db.t3.large"  vpc_id     = module.vpc.vpc_id  subnet_ids = module.vpc.private_subnet_ids  tags = {    Environment = "production"  }}

参照ファイル

  • assets/vpc-module/ - 完全なVPCモジュール例
  • assets/rds-module/ - RDSモジュール例
  • references/aws-modules.md - AWSモジュールパターン
  • references/azure-modules.md - Azureモジュールパターン
  • references/gcp-modules.md - GCPモジュールパターン

テスト

// tests/vpc_test.gopackage testimport (    "testing"    "github.com/gruntwork-io/terratest/modules/terraform"    "github.com/stretchr/testify/assert")func TestVPCModule(t *testing.T) {    terraformOptions := &terraform.Options{        TerraformDir: "../examples/complete",    }    defer terraform.Destroy(t, terraformOptions)    terraform.InitAndApply(t, terraformOptions)    vpcID := terraform.Output(t, terraformOptions, "vpc_id")    assert.NotEmpty(t, vpcID)}

関連スキル

  • multi-cloud-architecture - アーキテクチャ決定用
  • cost-optimization - コスト効率的な設計用

All Files

1 files
SKILL.md 6.2k
View

Install terraform-module-library

Download and extract the skill files to your .claude/skills/ directory.

Download ZIP

Clone the repository and copy the skill files to your project.

git clone https://github.com/amurata/cc-tools/blob/main/i18n/ja/plugins/cloud-infrastructure/skills/terraform-module-library/SKILL.md # Copy SKILL.md to your .claude/skills/ directory

Copy Copy
Quick Setup: Copy the skill folder to .claude/skills/Claude will automatically detect and use the skill
Repository amurata/cc-tools

Related Skills

Cloudflare Manager
Updated time June 29, 2026
netlify-forms
Updated time August 23, 2026
pinecone
Updated time June 29, 2026
azure-setup-guide
Updated time June 29, 2026
OR