用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/aiFabricoCom/fabrico-collections-codex --skill fabrico-implementing-terraform-modules命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
Audit AWS cost optimization and tagging compliance.
Audit GCP cost optimization and labeling compliance.
Process discovery materials into Jira-ready epics and user stories, or iterate on an existing backlog.
基于 SOC 职业分类
正在显示 SKILL.md
| name | fabrico-implementing-terraform-modules |
| description | Reusable Terraform modules for AWS, Azure, and GCP. |
Production-ready Terraform module patterns for AWS, Azure, and GCP infrastructure.
Create reusable, well-tested Terraform modules for common cloud infrastructure patterns across multiple cloud providers.
terraform-modules/
├── aws/
│ ├── vpc/
│ ├── eks/
│ ├── rds/
│ └── s3/
├── azure/
│ ├── vnet/
│ ├── aks/
│ └── storage/
└── gcp/
├── vpc/
├── gke/
└── cloud-sql/
module-name/
├── main.tf # Main resources
├── variables.tf # Input variables
├── outputs.tf # Output values
├── versions.tf # Provider versions
├── README.md # Documentation
├── examples/ # Usage examples
│ └── complete/
│ ├── main.tf
│ └── variables.tf
└── tests/ # Terratest files
└── module_test.go
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 = "Name of the VPC"
type = string
}
variable "cidr_block" {
description = "CIDR block for VPC"
type = string
validation {
condition = can(cidrnetmask(var.cidr_block))
error_message = "CIDR block must be valid IPv4 CIDR notation."
}
}
variable "availability_zones" {
description = "List of availability zones"
type = list(string)
}
variable "private_subnet_cidrs" {
description = "CIDR blocks for private subnets"
type = list(string)
default = []
}
variable "enable_dns_hostnames" {
description = "Enable DNS hostnames in VPC"
type = bool
default = true
}
variable "enable_dns_support" {
description = "Enable DNS support in VPC"
type = bool
default = true
}
variable "create_internet_gateway" {
description = "Whether to create an Internet Gateway"
type = bool
default = true
}
variable "tags" {
description = "Additional tags"
type = map(string)
default = {}
}
outputs.tf:
output "vpc_id" {
description = "ID of the VPC"
value = aws_vpc.main.id
}
output "private_subnet_ids" {
description = "IDs of private subnets"
value = aws_subnet.private[*].id
}
output "vpc_cidr_block" {
description = "CIDR block of VPC"
value = aws_vpc.main.cidr_block
}
aws ~> 6.0, azurerm ~> 4.0, google ~> 5.0references/aws-modules.md - AWS module patternsreferences/azure-modules.md - Azure module patternsreferences/gcp-modules.md - GCP module patternsUse Terratest (Go) to test Terraform modules. Every module must include:
examples/complete/ — a root module that calls the module under test with realistic values and re-exports its outputstests/module_test.go — Go test file that runs InitAndApply, reads outputs, asserts expected values, and always defers DestroyApply the following rules when writing tests:
t.Parallel()terraform.WithDefaultRetryableErrorsruntime.Caller(0) to resolve examples/complete/ path relative to the test file — never use hardcoded relative pathssingle_nat_gateway = true (or equivalent cost-reducing flags) in test examplesInitAndPlanAndShowWithStruct) for fast PR validation that requires no AWS credentials-timeout 30m in CI to avoid hanging runsUse plain Terraform when:
Use Terragrunt when:
run-all, dependency orchestration)Terragrunt Golden Path structure:
infrastructure/
├── terragrunt.hcl # Root config (remote_state, generate provider)
├── _envcommon/ # Shared module references
│ ├── vpc.hcl
│ ├── eks.hcl
│ └── rds.hcl
├── dev/
│ ├── env.hcl # Environment-level vars
│ ├── vpc/terragrunt.hcl
│ └── eks/terragrunt.hcl
├── staging/
│ └── ...
└── prod/
└── ...
fabrico-designing-multi-cloud-architecture - For architectural decisionsfabrico-optimizing-cloud-cost - For cost-effective designs