Terraform iac

From DNYoussef/context-cascade · View interactive version

Terraform iac is an AI agent skill from the GitHub repository DNYoussef/context-cascade. [assert|neutral] Terraform infrastructure as code specialist for multi-cloud deployments (AWS/GCP/Azure), state management with remote backends, module development, drift detection, policy as code with Sentinel/OPA, a [ground:given] [conf:0.95] [state:confirmed]

How to use this skill

Skill file

/============================================================================/

/* TERRAFORM-IAC SKILL :: VERILINGUA x VERIX EDITION */

/============================================================================/


name: terraform-iac

version: 1.0.0

description: |

[assert|neutral] Terraform infrastructure as code specialist for multi-cloud deployments (AWS/GCP/Azure), state management with remote backends, module development, drift detection, policy as code with Sentinel/OPA, a [ground:given] [conf:0.95] [state:confirmed]

category: Infrastructure

tags:

author: system

cognitive_frame:

primary: evidential

goal_analysis:

first_order: "Execute terraform-iac workflow"

second_order: "Ensure quality and consistency"

third_order: "Enable systematic Infrastructure processes"


/----------------------------------------------------------------------------/

/* S0 META-IDENTITY */

/----------------------------------------------------------------------------/

[define|neutral] SKILL := {

name: "terraform-iac",

category: "Infrastructure",

version: "1.0.0",

layer: L1

} [ground:given] [conf:1.0] [state:confirmed]

/----------------------------------------------------------------------------/

/* S1 COGNITIVE FRAME */

/----------------------------------------------------------------------------/

[define|neutral] COGNITIVE_FRAME := {

frame: "Evidential",

source: "Turkish",

force: "How do you know?"

} [ground:cognitive-science] [conf:0.92] [state:confirmed]

Kanitsal Cerceve (Evidential Frame Activation)

Kaynak dogrulama modu etkin.

/----------------------------------------------------------------------------/

/* S2 TRIGGER CONDITIONS */

/----------------------------------------------------------------------------/

[define|neutral] TRIGGER_POSITIVE := {

keywords: ["terraform-iac", "Infrastructure", "workflow"],

context: "user needs terraform-iac capability"

} [ground:given] [conf:1.0] [state:confirmed]

/----------------------------------------------------------------------------/

/* S3 CORE CONTENT */

/----------------------------------------------------------------------------/

Terraform Infrastructure as Code Specialist

Kanitsal Cerceve (Evidential Frame Activation)

Kaynak dogrulama modu etkin.

Expert Terraform for cloud-agnostic infrastructure provisioning and state management.

Purpose

Comprehensive Terraform expertise including multi-cloud deployments, state management, module development, drift detection, and GitOps. Ensures infrastructure is versioned, reproducible, and maintainable.

When to Use

Prerequisites

Required: Cloud provider basics (AWS/GCP/Azure), HCL syntax, Terraform CLI

Agents: system-architect, cicd-engineer, security-manager, reviewer

Core Workflows

Workflow 1: AWS Infrastructure with Modules

Step 1: Directory Structure

terraform/
├── main.tf
├── variables.tf
├── outputs.tf
├── versions.tf
├── terraform.tfvars
└── modules/
    ├── vpc/
    │   ├── main.tf
    │   ├── variables.tf
    │   └── outputs.tf
    └── ec2/
        ├── main.tf
        ├── variables.tf
        └── outputs.tf

Step 2: Main Configuration

# main.tf
terraform {
  required_version = ">= 1.5.0"

  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "~> 5.0"
    }
  }

  backend "s3" {
    bucket         = "my-terraform-state"
    key            = "production/terraform.tfstate"
    region         = "us-east-1"
    encrypt        = true
    dynamodb_table = "terraform-lock"
  }
}

provider "aws" {
  region = var.aws_region

  default_tags {
    tags = {
      Environment = var.environment
      ManagedBy   = "Terraform"
      Project     = var.project_name
    }
  }
}

module "vpc" {
  source = "./modules/vpc"

  vpc_cidr           = var.vpc_cidr
  availability_zones = var.availability_zones
  environment        = var.environment
}

module "ec2" {
  source = "./modules/ec2"

  vpc_id            = module.vpc.vpc_id
  subnet_ids        = module.vpc.private_subnet_ids
  instance_type     = var.instance_type
  instance_count    = var.instance_count
  security_group_id = module.vpc.security_group_id
}

Step 3: Variables and Outputs

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

variable "environment" {
  description = "Environment name"
  type        = string
  validation {
    condition     = contains(["dev", "staging", "production"], var.environment)
    error_message = "Environment must be dev, staging, or production."
  }
}

variable "vpc_cidr" {
  description = "CIDR block for VPC"
  type        = string
  default     = "10.0.0.0/16"
}

# outputs.tf
output "vpc_id" {
  description = "VPC ID"
  value       = module.vpc.vpc_id
}

output "instance_ids" {
  description = "EC2 instance IDs"
  value       = module.ec2.instance_ids
}

Workflow 2: Dynamic Blocks and for_each

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.