infrastructure-as-code

infrastructure-as-code is a skill for Claude Code, Codex from cass-2003/local-workflow-skill. It costs 50 tokens per session (1,906 once invoked), scanned A, original, MIT.

An infrastructure-as-code guide for managing cloud infrastructure through Terraform or OpenTofu configuration files. Infrastructure as code means describing servers and cloud resources in files so they can be reviewed and applied consistently.

In plain words
What is it for?
Use it to write Terraform or OpenTofu configurations, design modules, manage state and providers, review plan/apply workflows, and run infrastructure security scans.
Why use it?
It helps investigate state problems, control reusable infrastructure modules, manage planned changes through CI/CD, and find security issues before infrastructure is applied.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to write Terraform or OpenTofu configurations, design modules, manage state and providers, review plan/apply workflows, and run infrastructure security scans.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/cass-2003/local-workflow-skill/terraform
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add cass-2003/local-workflow-skill --skill terraform
Clone the repo
git clone --depth 1 https://github.com/cass-2003/local-workflow-skill

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for infrastructure-as-code

README.md
[![agentmods](https://agentmods.dev/badge/skills/cass-2003/local-workflow-skill/terraform/github.svg)](https://agentmods.dev/skills/cass-2003/local-workflow-skill/terraform)
Your own site
<a href="https://agentmods.dev/skills/cass-2003/local-workflow-skill/terraform"><img src="https://agentmods.dev/badge/skills/cass-2003/local-workflow-skill/terraform/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for infrastructure-as-code

Your own site · 80×15
<a href="https://agentmods.dev/skills/cass-2003/local-workflow-skill/terraform"><img src="https://agentmods.dev/badge/skills/cass-2003/local-workflow-skill/terraform.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 50 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,906 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00050 $0.01906
Opus 5 $0.00025 $0.00953
Sonnet 5 $0.00010 $0.00381
Haiku 4.5 $0.00005 $0.00191

Measured 6d ago against content hash 6139ef11b7dc, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, from the pricing page.

Security

Grade A, and why

infrastructure-as-code scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/cloud-infra/community/terraform/SKILL.md · 278 lines

How it starts

The opening of the file, as written. The whole thing — 278 lines — stays where its author put it; the contents beside it link to each section on GitHub.

IaC (Terraform / OpenTofu)

适用场景

  • 基础设施即代码编写与管理。
  • Terraform state 问题排查。
  • Module 设计与版本管理。
  • CI/CD 中的 plan/apply 流程。
  • IaC 安全扫描。

不适用

  • K8s manifest → k8sops
  • 云控制台手动操作。
  • Ansible (配置管理, 非 IaC 声明式)。

HCL 基础

# Provider
terraform {
  required_version = ">= 1.7"
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "~> 5.0"
    }
  }
  backend "s3" {
    bucket         = "my-terraform-state"
    key            = "prod/terraform.tfstate"
    region         = "us-east-1"
    dynamodb_table = "terraform-locks"     # state locking
    encrypt        = true
  }
}

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

# Variables
variable "region" {
  type        = string
  default     = "us-east-1"
  description = "AWS region"
}

variable "environment" {
  type = string
  validation {
    condition     = contains(["dev", "staging", "prod"], var.environment)
    error_message = "Must be dev, staging, or prod."
  }
}

# Resources
resource "aws_vpc" "main" {
  cidr_block           = "10.0.0.0/16"
  enable_dns_hostnames = true
  tags = { Name = "${var.environment}-vpc" }
}

resource "aws_subnet" "public" {
  count             = 3
  vpc_id            = aws_vpc.main.id
  cidr_block        = cidrsubnet(aws_vpc.main.cidr_block, 8, count.index)
  availability_zone = data.aws_availability_zones.available.names[count.index]
  tags = { Name = "${var.environment}-public-${count.index}" }
}

# Data source
data "aws_availability_zones" "available" {
  state = "available"
}

# Output
output "vpc_id" {
  value       = aws_vpc.main.id
  description = "VPC ID"
}

# Locals
locals {
  common_tags = {
    Project = "myapp"
    Team    = "platform"
  }
}

State 管理

# 查看
terraform state list                       # 列出所有资源
terraform state show aws_vpc.main          # 查看具体资源

# 移动 (重构)
terraform state mv aws_vpc.main module.network.aws_vpc.main

# 移除 (不再管理, 不删除实际资源)
terraform state rm aws_vpc.main

# 导入 (已有资源纳入管理)
terraform import aws_vpc.main vpc-12345678
# Terraform 1.5+: import block
import {
  to = aws_vpc.main
  id = "vpc-12345678"
}

# 强制解锁 (小心!)
terraform force-unlock <lock-id>

# State 迁移 (本地→远端)
terraform init -migrate-state

Read the full file on GitHub · 278 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 278 lines · 50 tokens per session scan A 6139ef11b7dc

Subscribe to this mod's changes

infrastructure-as-code is a skill published in the GitHub repository cass-2003/local-workflow-skill (12 stars, last pushed 2mo ago), licensed MIT. It adds 50 tokens to every session and 1,906 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.