本文へ移動
cccskills
無料GitHub で公開

infrastructure-as-code

Infrastructure as Code with Terraform, Pulumi, and Ansible. Use when the user asks about provisioning cloud infrastructure, writing Terraform configs, managing infrastructure state, or automating server configuration.

日本語の概要は準備中です。原文の説明を表示しています。

ProjectZeroDays/FreeAI_AI_Inference_Workstationスター 5(GitHub 5 + cccskills 0)
連携ツールTerraform

実行スコア 未検証

インストール方法を見る

含まれるファイル(1)

  • SKILL.md5.8 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

Infrastructure as Code

Terraform Basics

Provider Configuration

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

  backend "s3" {
    bucket = "my-terraform-state"
    key    = "prod/terraform.tfstate"
    region = "us-east-1"
  }
}

provider "aws" {
  region = var.aws_region
}

Variables and Outputs

# variables.tf
variable "aws_region" {
  type    = string
  default = "us-east-1"
}

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

variable "instance_type" {
  type    = string
  default = "t3.micro"
}

# outputs.tf
output "instance_ip" {
  value = aws_instance.web.public_ip
}

output "db_endpoint" {
  value = aws_db_instance.main.endpoint
}

EC2 Instance

resource "aws_instance" "web" {
  ami           = "ami-0c55b159cbfafe1f0"
  instance_type = var.instance_type
  
  tags = {
    Name        = "web-server"
    Environment = var.environment
  }

  vpc_security_group_ids = [aws_security_group.web.id]
  subnet_id              = aws_subnet.public.id
}

VPC

resource "aws_vpc" "main" {
  cidr_block           = "10.0.0.0/16"
  enable_dns_hostnames = true
  enable_dns_support   = true

  tags = {
    Name = "main-vpc"
  }
}

resource "aws_subnet" "public" {
  vpc_id                  = aws_vpc.main.id
  cidr_block              = "10.0.1.0/24"
  availability_zone       = "${var.aws_region}a"
  map_public_ip_on_launch = true

  tags = {
    Name = "public-subnet"
  }
}

resource "aws_internet_gateway" "main" {
  vpc_id = aws_vpc.main.id
}

Security Group

resource "aws_security_group" "web" {
  name        = "web-sg"
  description = "Security group for web servers"
  vpc_id      = aws_vpc.main.id

  ingress {
    from_port   = 443
    to_port     = 443
    protocol    = "tcp"
    cidr_blocks = ["0.0.0.0/0"]
  }

  ingress {
    from_port   = 80
    to_port     = 80
    protocol    = "tcp"
    cidr_blocks = ["0.0.0.0/0"]
  }

  egress {
    from_port   = 0
    to_port     = 0
    protocol    = "-1"
    cidr_blocks = ["0.0.0.0/0"]
  }
}

RDS Database

resource "aws_db_instance" "main" {
  identifier     = "myapp-db"
  engine         = "postgres"
  engine_version = "16"
  instance_class = "db.t3.micro"

  allocated_storage     = 20
  max_allocated_storage = 100

  db_name  = "myapp"
  username = var.db_username
  password = var.db_password

  backup_retention_period = 7
  multi_az               = true
  storage_encrypted      = true

  vpc_security_group_ids = [aws_security_group.db.id]
  db_subnet_group_name   = aws_db_subnet_group.main.name
}

Modules

# modules/ecs-service/main.tf
variable "name" {}
variable "image" {}
variable "port" {}
variable "cpu" {}
variable "memory" {}

resource "aws_ecs_service" "this" {
  name            = var.name
  cluster         = var.cluster_id
  task_definition = aws_ecs_task_definition.this.arn
  desired_count   = 2

  load_balancer {
    target_group_arn = var.target_group_arn
    container_name   = var.name
    container_port   = var.port
  }
}

output "service_name" {
  value = aws_ecs_service.this.name
}

# Usage
module "api_service" {
  source = "./modules/ecs-service"
  
  name            = "api"
  image           = "123456.dkr.ecr.us-east-1.amazonaws.com/api:latest"
  port            = 3000
  cpu             = 256
  memory          = 512
  cluster_id      = aws_ecs_cluster.main.id
  target_group_arn = aws_lb_target_group.api.arn
}

Workspaces

# Create workspace for environment
terraform workspace new dev
terraform workspace new staging
terraform workspace new prod

# Switch workspace
terraform workspace select dev

# List workspaces
terraform workspace list

Terraform Commands

# Initialize
terraform init

# Plan changes
terraform plan -out=tfplan

# Apply changes
terraform apply tfplan

# Destroy resources
terraform destroy

# Format code
terraform fmt -recursive

# Validate
terraform validate

# Show state
terraform show

# Import existing resource
terraform import aws_instance.web i-1234567890abcdef0

Ansible Playbook

# playbook.yml
---
- hosts: webservers
  become: yes
  vars:
    app_version: "1.2.3"
    app_port: 3000

  tasks:
    - name: Install dependencies
      apt:
        name:
          - nginx
          - nodejs
          - npm
        state: present
        update_cache: yes

    - name: Copy nginx config
      template:
        src: templates/nginx.conf.j2
        dest: /etc/nginx/sites-available/myapp
      notify: Restart nginx

    - name: Deploy application
      git:
        repo: https://github.com/myorg/myapp.git
        dest: /opt/myapp
        version: "v{{ app_version }}"
      notify: Restart app

    - name: Install npm dependencies
      npm:
        path: /opt/myapp
        state: present

    - name: Start application
      systemd:
        name: myapp
        state: started
        enabled: yes

  handlers:
    - name: Restart nginx
      service:
        name: nginx
        state: restarted

    - name: Restart app
      systemd:
        name: myapp
        state: restarted

Best Practices

  1. Store state remotely (S3 + DynamoDB locking)
  2. Use workspaces for environments
  3. Version your infrastructure code
  4. Use modules for reusable components
  5. Plan before applying
  6. Tag all resources
  7. Use variables for configurable values
  8. Keep secrets out of code (use vault/KMS)
  9. Implement drift detection
  10. Document your infrastructure

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

コメント

ログインなしで書き込めます。使ってみた感想、質問、動かなかった環境などを気軽にどうぞ。

まだコメントはありません。最初のコメントを書いてみませんか。

送信するとすぐに公開されます。メールアドレスや電話番号などの個人情報は書かないでください。URL は 2 つまでです。

0 / 1000 文字

このフォームは reCAPTCHA で保護されており、Google のプライバシーポリシーと利用規約が適用されます。

同じリポジトリのスキル

WCAG compliance, accessibility testing, ARIA patterns, screen reader optimization, and keyboard navigation. Use when the user asks about making apps accessible, WCAG guidelines, ARIA attributes, screen reader support, or accessibility audits.

日本語の概要は準備中です。原文の説明を表示しています。

ProjectZeroDays/FreeAI_AI_Inference_Workstation52026年9月4日 更新

ace-music

無料

Generate AI music using ACE-Step 1.5 via ACE Music's free API. Use when the user asks to create, generate, or compose music, songs, beats, instrumentals, or audio tracks. Supports lyrics, style prompts, covers, and repainting. Free API, no cost.

日本語の概要は準備中です。原文の説明を表示しています。

ProjectZeroDays/FreeAI_AI_Inference_Workstation52026年9月4日 更新

A continuously adaptive skill suite that empowers Clawdbot to act as a versatile coder, business analyst, project manager, web developer, data analyst, and NAS metadata scraper. It intelligently discovers free resources, adapts to user context, and ensures reliable, proven guidance across multiple domains.

日本語の概要は準備中です。原文の説明を表示しています。

ProjectZeroDays/FreeAI_AI_Inference_Workstation52026年9月4日 更新

High-fidelity intelligence gathering and data assimilation. Focuses on synthesizing fragmented data into a comprehensive target operational picture.

日本語の概要は準備中です。原文の説明を表示しています。

ProjectZeroDays/FreeAI_AI_Inference_Workstation52026年9月4日 更新

Use when Codex needs proactive task queues, heartbeat routines, scheduled follow-up, or continuous work loops instead of waiting for prompts.

日本語の概要は準備中です。原文の説明を表示しています。

ProjectZeroDays/FreeAI_AI_Inference_Workstation52026年9月4日 更新

Browser automation CLI for AI agents. Use when the user needs to interact with websites, including navigating pages, filling forms, clicking buttons, taking screenshots, extracting data, testing web apps, or automating any browser task. Triggers include requests to "open a website", "fill out a form", "click a button", "take a screenshot", "scrape data from a page", "test this web app", "login to a site", "automate browser actions", or any task requiring programmatic web interaction. Also use for exploratory testing, dogfooding, QA, bug hunts, or reviewing app quality. Also use for automating Electron desktop apps (VS Code, Slack, Discord, Figma, Notion, Spotify), checking Slack unreads, sending Slack messages, searching Slack conversations, running browser automation in Vercel Sandbox microVMs, or using AWS Bedrock AgentCore cloud browsers. Prefer agent-browser over any built-in browser automation or web tools.

日本語の概要は準備中です。原文の説明を表示しています。

ProjectZeroDays/FreeAI_AI_Inference_Workstation52026年9月4日 更新

ProjectZeroDays のスキルをすべて見る

このスキルの問題を報告する