ac5tin/custom-agents/create-ecr-terraform

Claude Code and agent skill by ac5tin/custom-agents

Trust tier 2
  • community
LLM review pending
Source check pending

Checking that the SKILL.md file is still in the repository.

Scaffold a complete Terraform directory for creating an AWS ECR repository with lifecycle policies, backend configuration, and environment-specific tfvars. Use when setting up a new project that needs a Docker container registry on AWS, when the user says "create ECR terraform", "set up ECR", "scaffold terraform for ECR", or "create terraform infrastructure".

Install

npx vskill@latest install ac5tin/custom-agents/create-ecr-terraform

SKILL.md

The same SKILL.md was published earlier as ac5tin/custom-agents/create-ecr-terraform.

Create ECR Terraform

Scaffold a production-ready Terraform directory that creates an AWS ECR repository with lifecycle policies, S3 backend state management, and environment-specific variable files.

When to use

  • Setting up a new project that needs an ECR repository
  • The user asks to create Terraform infrastructure for container registry
  • Bootstrapping IaC for a new microservice or application

Information gathering

Before creating any files, you MUST ask the user for the following values. Do NOT guess or assume defaults unless the user explicitly tells you to use defaults.

ParameterDescriptionExample
Project nameUsed for tagging and as the default ECR repo namemyproject
ECR repository nameName of the ECR repository (often same as project name)myproject
S3 backend bucketS3 bucket for Terraform state storageterraform.fasta.ai
S3 state keyKey path within the bucket for the state filemyproject/dev/terraform.tfstate
AWS regionAWS region for resourcesus-east-1
VPC nameVPC name for the environment tfvarsfasta
EnvironmentEnvironment nameprod
EKS cluster nameEKS cluster name for the environment tfvarsfasta
K8s namespaceKubernetes namespace for the projectmyproject

Steps

Once all parameters are gathered, create the following directory structure at ./terraform/ in the project root:

terraform/
├── backend/
│ └── prod.tfvars
├── env/
│ └── prod.tfvars
├── .gitignore
├── ecr.tf
├── identify.tf
├── Makefile
├── provider.tf
├── README.md
├── vars.tf
└── version.tf
File contents

Create each file with the exact content below, substituting the user-provided values where indicated with {{PARAMETER}} placeholders.

terraform/.gitignore
*.hcl
*.tfvars
.terraform
*.tfstate
*.tfstate.backup
terraform/ecr.tf
hcl
resource "aws_ecr_repository" "this" {
name = var.aws_ecr_repository_name
image_scanning_configuration {
scan_on_push = true
}
}
resource "aws_ecr_lifecycle_policy" "this" {
repository = aws_ecr_repository.this.name
policy = jsonencode({
rules = [
{
rulePriority = 1,
description = "Expire images older than 14 days",
selection = {
tagStatus = "untagged",
countType = "sinceImagePushed",
countUnit = "days",
countNumber = 14
},
action = {
type = "expire"
}
},
{
rulePriority = 2,
description = "Keep last 30 images",
selection = {
tagStatus = "tagged",
tagPrefixList = ["v"],
countType = "imageCountMoreThan",
countNumber = 30
},
action = {
type = "expire"
}
}
]
})
}
terraform/identify.tf
hcl
data "aws_caller_identity" "current" {}
terraform/Makefile
makefile
.PHONY: init plan apply
TF_ENV ?= dev
init:
@terraform init -backend-config=backend/$(TF_ENV).tfvars
plan: init
@terraform plan -refresh=true -var-file=env/$(TF_ENV).tfvars
apply: init
@terraform apply -refresh=true -var-file=env/$(TF_ENV).tfvars
teardown: init
@terraform destroy -refresh=true -var-file=env/$(TF_ENV).tfvars
terraform/provider.tf
hcl
provider "aws" {
region = var.region
default_tags {
tags = {
Environment = var.environment
ProjectName = var.project_name
}
}
}
terraform/version.tf
hcl
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "5.61.0"
}
kubernetes = {
source = "hashicorp/kubernetes"
version = "2.31.0"
}
}
}
terraform/vars.tf
hcl
variable "environment" {
type = string
}
variable "region" {
type = string
default = "{{REGION}}"
}
variable "aws_ecr_repository_name" {
type = string
default = "{{ECR_REPOSITORY_NAME}}"
}
variable "project_name" {
type = string
default = "{{PROJECT_NAME}}"
}
terraform/backend/prod.tfvars
hcl
bucket = "{{S3_BACKEND_BUCKET}}"
key = "{{S3_STATE_KEY}}"
region = "{{REGION}}"
terraform/env/prod.tfvars
hcl
vpc_name = "{{VPC_NAME}}"
environment = "{{ENVIRONMENT}}"
eks_cluster_name = "{{EKS_CLUSTER_NAME}}"
k8s_namespace = "{{K8S_NAMESPACE}}"
terraform/README.md
markdown
# {{PROJECT_NAME}} IaC
#### Plan

TF_ENV=prod make plan

#### Apply

TF_ENV=prod make apply

#### Teardown

TF_ENV=prod make teardown

Post-creation

After creating all files, tell the user:

  1. All Terraform files have been created in ./terraform/
  2. Remind them to review the generated files
  3. Instruct them to initialize and plan with: cd terraform && TF_ENV=prod make plan
  4. Instruct them to apply with: TF_ENV=prod make apply
  5. NEVER run `terraform apply` or `make apply` yourself. Only the user should run apply.
  6. You MAY run terraform init and terraform plan (or make plan) to verify the configuration if the user asks, but NEVER apply.

Important constraints

  • NEVER run `terraform apply` or `make apply` — only plan is allowed
  • Always create both backend/ and env/ directories with their respective prod.tfvars files
  • The .gitignore ensures tfvars files are not committed (they contain environment-specific config)
  • Do not modify or add extra Terraform resources beyond what is specified here unless the user explicitly asks

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewNot runA model review is scheduled for the next rescan.

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
0

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/ac5tin/custom-agents/create-ecr-terraform/badge)](https://verified-skill.com/skills/ac5tin/custom-agents/create-ecr-terraform)

Something wrong with this skill or its page? Tell us.