Provision AWS infrastructure with Terraform including VPC, EC2, RDS, IAM, and security best practices
View on GitHubpluginagentmarketplace/custom-plugin-terraform
terraform-assistant
January 20, 2026
Select agents to install to:
npx add-skill https://github.com/pluginagentmarketplace/custom-plugin-terraform/blob/main/skills/terraform-aws/SKILL.md -a claude-code --skill terraform-awsInstallation paths:
.claude/skills/terraform-aws/# Terraform AWS Skill
Production patterns for AWS infrastructure provisioning with security and cost optimization.
## Provider Setup
```hcl
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 5.0"
}
}
}
provider "aws" {
region = var.aws_region
default_tags {
tags = {
Environment = var.environment
Project = var.project
ManagedBy = "Terraform"
}
}
}
```
## VPC Architecture
### Multi-AZ VPC
```hcl
module "vpc" {
source = "terraform-aws-modules/vpc/aws"
version = "5.1.2"
name = "${var.project}-vpc"
cidr = "10.0.0.0/16"
azs = ["us-east-1a", "us-east-1b", "us-east-1c"]
private_subnets = ["10.0.1.0/24", "10.0.2.0/24", "10.0.3.0/24"]
public_subnets = ["10.0.101.0/24", "10.0.102.0/24", "10.0.103.0/24"]
enable_nat_gateway = true
single_nat_gateway = var.environment != "prod"
one_nat_gateway_per_az = var.environment == "prod"
enable_dns_hostnames = true
enable_flow_log = true
}
```
### Security Groups
```hcl
resource "aws_security_group" "web" {
name_prefix = "${var.project}-web-"
vpc_id = module.vpc.vpc_id
lifecycle {
create_before_destroy = true
}
}
resource "aws_vpc_security_group_ingress_rule" "https" {
security_group_id = aws_security_group.web.id
from_port = 443
to_port = 443
ip_protocol = "tcp"
cidr_ipv4 = "0.0.0.0/0"
}
```
## EC2 Instances
### Launch Template + ASG
```hcl
resource "aws_launch_template" "app" {
name_prefix = "${var.project}-"
image_id = data.aws_ami.amazon_linux.id
instance_type = var.instance_type
metadata_options {
http_tokens = "required" # IMDSv2
}
block_device_mappings {
device_name = "/dev/xvda"
ebs {
volume_size = 20
volume_type = "gp3"
encrypted = true
}
}
iam_instance_profile {
arn = aws_iam_instance_profile.app.arn
}
}
resource "aws_autoscaling_group" "app" {