mcpField
T
terraform-aws

terraform-aws

github.com/bagelholeCloud & DevOps1.2k389 installsUpdated 23w ago
Repository

About terraform-aws

A Terraform skill for provisioning and managing AWS infrastructure. It includes provider, resource, and module examples, along with practices for remote state and environment separation.

Key features

  1. 01Configure the AWS Terraform provider
  2. 02Define VPC and EC2 resources
  3. 03Use VPC modules
  4. 04Run init, plan, apply, and destroy
  5. 05Manage remote state and environment separation

Use cases

  1. 01Create AWS networks and instances with Terraform
  2. 02Organize VPC configuration with modules
  3. 03Maintain separate state per environment and apply changes

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/bagelhole/devops-security-agent-skills --skill terraform-aws

After installing, type/terraform-awsin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

assets/
vpc-module.tf
references/
best-practices.md
scripts/
tf-init.sh

Details

From the project README

Terraform AWS

Provision and manage AWS infrastructure with Terraform.

Provider Configuration

terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "~> 5.0"
    }
  }
  
  backend "s3" {
    bucket = "terraform-state"
    key    = "prod/terraform.tfstate"
    region = "us-east-1"
  }
}

provider "aws" {
  region = var.region
  
  default_tags {
    tags = {
      Environment = var.environment
      ManagedBy   = "terraform"
    }
  }
}

Example Resources

resource "aws_vpc" "main" {
  cidr_block           = "10.0.0.0/16"
  enable_dns_hostnames = true
  
  tags = { Name = "main-vpc" }
}

resource "aws_instance" "web" {
  ami           = data.aws_ami.amazon_linux.id
  instance_type = "t3.micro"
  subnet_id     = aws_subnet.public.id
  
  tags = { Name = "web-server" }
}

Modules

module "vpc" {
  source = "terraform-aws-modules/vpc/aws"
  
  name = "my-vpc"
  cidr = "10.0.0.0/16"
  
  azs             = ["us-east-1a", "us-east-1b"]
  private_subnets = ["10.0.1.0/24", "10.0.2.0/24"]
  public_subnets  = ["10.0.101.0/24", "10.0.102.0/24"]
  
  enable_nat_gateway = true
}

Commands

terraform init
terraform plan -out=plan.tfplan
terraform apply plan.tfplan
terraform destroy

Best Practices

  • Use remote state with locking
  • Implement module structure
  • Use workspaces or separate states per environment
  • Pin provider versions
  • Use data sources for AMIs

Related Skills

Comments

Markdown supported