Terraform Infrastructure

作者 aj-geddes3f5182cfd739無授權條款355 個星標收錄於 2026年10月8日更新於 2026年10月8日儲存庫7 個月前更新

Infrastructure as Code using Terraform with modular components, state management, and multi-cloud deployments. Use for provisioning and managing cloud resources.

包含腳本DevOps & Cloud
AI 產生的概覽

指導 Terraform 基礎設施即程式碼工作:模組、遠端狀態與多雲資源佈建。

功能
這個技能為使用 Terraform 建置與管理雲端基礎設施提供指引。內容涵蓋模組化設定、含鎖定的遠端狀態、變數與輸出,以及跨 AWS、Azure、GCP 與地端資源的多雲佈建。它附帶參考指南、設定起始範本,以及一個用來檢查設定的驗證指令碼。
適用情境
適用於以程式碼方式佈建或管理雲端基礎設施、管理 dev、staging、prod 等多個環境,或設定遠端狀態、模組與部署自動化時。也適合基礎設施版本控管、程式碼審查與環境複製。
執行需求
需要 Terraform(範例要求 1.0 或以上版本)以及目標平台的雲端服務商憑證。遠端狀態範例涉及 S3 與用於鎖定的 DynamoDB。附帶可執行驗證指令碼與 YAML 設定範本。

Terraform Infrastructure

Table of Contents

Overview

Build scalable infrastructure as code with Terraform, managing AWS, Azure, GCP, and on-premise resources through declarative configuration, remote state, and automated provisioning.

When to Use

  • Cloud infrastructure provisioning
  • Multi-environment management (dev, staging, prod)
  • Infrastructure versioning and code review
  • Cost tracking and resource optimization
  • Disaster recovery and environment replication
  • Automated infrastructure testing
  • Cross-region deployments

Quick Start

Minimal working example:

hcl
# terraform/main.tfterraform {  required_version = ">= 1.0"
  required_providers {    aws = {      source  = "hashicorp/aws"      version = "~> 5.0"    }  }
  # Remote state configuration  backend "s3" {    bucket         = "terraform-state-prod"    key            = "prod/terraform.tfstate"    region         = "us-east-1"    encrypt        = true    dynamodb_table = "terraform-locks"  }}
provider "aws" {  region = var.aws_region
  default_tags {// ... (see reference guides for full implementation)

Reference Guides

Detailed implementations in the references/ directory:

GuideContents
AWS Infrastructure Module [blocked]AWS Infrastructure Module
Variables and Outputs [blocked]Variables and Outputs
Terraform Deployment Script [blocked]Terraform Deployment Script

Best Practices

✅ DO

  • Use remote state (S3, Terraform Cloud)
  • Implement state locking (DynamoDB)
  • Organize code into modules
  • Use workspaces for environments
  • Apply tags consistently
  • Use variables for flexibility
  • Implement code review before apply
  • Keep sensitive data in separate variable files

❌ DON'T

  • Store state files locally in git
  • Use hardcoded values
  • Mix environments in single state
  • Skip terraform plan review
  • Use root module for everything
  • Store secrets in code
  • Disable state locking

來源與署名

來源:aj-geddes/useful-ai-prompts位於skills/terraform-infrastructure提交3f5182c

授權條款: 無授權條款

內容歸原作者所有。SourceWeft 從公開儲存庫中收錄這些內容。

檢舉或申請下架