Back to Skills

generating-infrastructure-as-code

jeremylongshore
Updated Yesterday
23 views
712
74
712
View on GitHub
Metageneral

About

This skill generates production-ready infrastructure-as-code configurations for tools like Terraform, CloudFormation, and Pulumi across AWS, GCP, and Azure. It's triggered by requests such as "create Terraform config" or "generate CloudFormation template." The skill can also execute relevant CLI commands to validate or deploy the generated code.

Quick Install

Claude Code

Recommended
Plugin CommandRecommended
/plugin add https://github.com/jeremylongshore/claude-code-plugins-plus
Git CloneAlternative
git clone https://github.com/jeremylongshore/claude-code-plugins-plus.git ~/.claude/skills/generating-infrastructure-as-code

Copy and paste this command in Claude Code to install this skill

Documentation

Prerequisites

Before using this skill, ensure:

  • Target cloud provider CLI is installed (aws-cli, gcloud, az)
  • IaC tool is installed (Terraform, Pulumi, AWS CDK)
  • Cloud credentials are configured locally
  • Understanding of target infrastructure architecture
  • Version control system for IaC storage

Instructions

  1. Identify Platform: Determine IaC tool (Terraform, CloudFormation, Pulumi, ARM, CDK)
  2. Define Resources: Specify cloud resources needed (compute, network, storage, database)
  3. Establish Structure: Create modular file structure for maintainability
  4. Generate Code: Write IaC configurations with proper syntax and formatting
  5. Add Variables: Define input variables for environment-specific values
  6. Configure Outputs: Specify outputs for resource references and integrations
  7. Implement State: Set up remote state storage for team collaboration
  8. Document Usage: Add README with deployment instructions and prerequisites

Output

Generates infrastructure as code files:

Terraform Example:

# {baseDir}/terraform/main.tf
terraform {
  required_version = ">= 1.0"
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "~> 5.0"
    }
  }
}

resource "aws_vpc" "main" {
  cidr_block = var.vpc_cidr
  enable_dns_hostnames = true

  tags = {
    Name = "${var.project}-vpc"
    Environment = var.environment
  }
}

CloudFormation Example:

# {baseDir}/cloudformation/template.yaml
AWSTemplateFormatVersion: '2010-09-09'
Description: Production VPC infrastructure

Parameters:
  VpcCidr:
    Type: String
    Default: 10.0.0.0/16

Resources:
  VPC:
    Type: AWS::EC2::VPC
    Properties:
      CidrBlock: !Ref VpcCidr
      EnableDnsHostnames: true

Pulumi Example:

// {baseDir}/pulumi/index.ts
import * as aws from "@pulumi/aws";

const vpc = new aws.ec2.Vpc("main", {
    cidrBlock: "10.0.0.0/16",
    enableDnsHostnames: true,
    tags: {
        Name: "production-vpc"
    }
});

export const vpcId = vpc.id;

Error Handling

Common issues and solutions:

Syntax Errors

  • Error: "Invalid resource syntax in configuration"
  • Solution: Validate syntax with terraform validate or respective tool linter

Provider Authentication

  • Error: "Unable to authenticate with cloud provider"
  • Solution: Configure credentials via environment variables or CLI login

Resource Conflicts

  • Error: "Resource already exists"
  • Solution: Import existing resources or use data sources instead of creating new ones

State Lock Issues

  • Error: "Error acquiring state lock"
  • Solution: Ensure no other process is running, or force unlock if safe

Dependency Errors

  • Error: "Resource depends on resource that does not exist"
  • Solution: Check resource references and ensure proper dependency ordering

Resources

GitHub Repository

jeremylongshore/claude-code-plugins-plus
Path: plugins/devops/infrastructure-as-code-generator/skills/infrastructure-as-code-generator
aiautomationclaude-codedevopsmarketplacemcp

Related Skills

subagent-driven-development

Development

This skill executes implementation plans by dispatching a fresh subagent for each independent task, with code review between tasks. It enables fast iteration while maintaining quality gates through this review process. Use it when working on mostly independent tasks within the same session to ensure continuous progress with built-in quality checks.

View skill

algorithmic-art

Meta

This Claude Skill creates original algorithmic art using p5.js with seeded randomness and interactive parameters. It generates .md files for algorithmic philosophies, plus .html and .js files for interactive generative art implementations. Use it when developers need to create flow fields, particle systems, or other computational art while avoiding copyright issues.

View skill

executing-plans

Design

Use the executing-plans skill when you have a complete implementation plan to execute in controlled batches with review checkpoints. It loads and critically reviews the plan, then executes tasks in small batches (default 3 tasks) while reporting progress between each batch for architect review. This ensures systematic implementation with built-in quality control checkpoints.

View skill

cost-optimization

Other

This Claude Skill helps developers optimize cloud costs through resource rightsizing, tagging strategies, and spending analysis. It provides a framework for reducing cloud expenses and implementing cost governance across AWS, Azure, and GCP. Use it when you need to analyze infrastructure costs, right-size resources, or meet budget constraints.

View skill