$npx -y skills add DNYoussef/context-cascade --skill terraform-iac/*============================================================================*/ /* TERRAFORM-IAC SKILL :: VERILINGUA x VERIX EDITION */ /*============================================================================*/
| 1 | /*============================================================================*/ |
| 2 | /* TERRAFORM-IAC SKILL :: VERILINGUA x VERIX EDITION */ |
| 3 | /*============================================================================*/ |
| 4 | |
| 5 | --- |
| 6 | name: terraform-iac |
| 7 | version: 1.0.0 |
| 8 | description: | |
| 9 | [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] |
| 10 | category: Infrastructure |
| 11 | tags: |
| 12 | - general |
| 13 | author: system |
| 14 | cognitive_frame: |
| 15 | primary: evidential |
| 16 | goal_analysis: |
| 17 | first_order: "Execute terraform-iac workflow" |
| 18 | second_order: "Ensure quality and consistency" |
| 19 | third_order: "Enable systematic Infrastructure processes" |
| 20 | --- |
| 21 | |
| 22 | /*----------------------------------------------------------------------------*/ |
| 23 | /* S0 META-IDENTITY */ |
| 24 | /*----------------------------------------------------------------------------*/ |
| 25 | |
| 26 | [define|neutral] SKILL := { |
| 27 | name: "terraform-iac", |
| 28 | category: "Infrastructure", |
| 29 | version: "1.0.0", |
| 30 | layer: L1 |
| 31 | } [ground:given] [conf:1.0] [state:confirmed] |
| 32 | |
| 33 | /*----------------------------------------------------------------------------*/ |
| 34 | /* S1 COGNITIVE FRAME */ |
| 35 | /*----------------------------------------------------------------------------*/ |
| 36 | |
| 37 | [define|neutral] COGNITIVE_FRAME := { |
| 38 | frame: "Evidential", |
| 39 | source: "Turkish", |
| 40 | force: "How do you know?" |
| 41 | } [ground:cognitive-science] [conf:0.92] [state:confirmed] |
| 42 | |
| 43 | ## Kanitsal Cerceve (Evidential Frame Activation) |
| 44 | Kaynak dogrulama modu etkin. |
| 45 | |
| 46 | /*----------------------------------------------------------------------------*/ |
| 47 | /* S2 TRIGGER CONDITIONS */ |
| 48 | /*----------------------------------------------------------------------------*/ |
| 49 | |
| 50 | [define|neutral] TRIGGER_POSITIVE := { |
| 51 | keywords: ["terraform-iac", "Infrastructure", "workflow"], |
| 52 | context: "user needs terraform-iac capability" |
| 53 | } [ground:given] [conf:1.0] [state:confirmed] |
| 54 | |
| 55 | /*----------------------------------------------------------------------------*/ |
| 56 | /* S3 CORE CONTENT */ |
| 57 | /*----------------------------------------------------------------------------*/ |
| 58 | |
| 59 | # Terraform Infrastructure as Code Specialist |
| 60 | |
| 61 | ## Kanitsal Cerceve (Evidential Frame Activation) |
| 62 | Kaynak dogrulama modu etkin. |
| 63 | |
| 64 | |
| 65 | |
| 66 | Expert Terraform for cloud-agnostic infrastructure provisioning and state management. |
| 67 | |
| 68 | ## Purpose |
| 69 | |
| 70 | Comprehensive Terraform expertise including multi-cloud deployments, state management, module development, drift detection, and GitOps. Ensures infrastructure is versioned, reproducible, and maintainable. |
| 71 | |
| 72 | ## When to Use |
| 73 | |
| 74 | - Provisioning cloud infrastructure (AWS, GCP, Azure) |
| 75 | - Managing infrastructure state with remote backends |
| 76 | - Creating reusable Terraform modules |
| 77 | - Implementing GitOps for infrastructure |
| 78 | - Detecting and fixing infrastructure drift |
| 79 | - Migrating from manual infrastructure to IaC |
| 80 | - Multi-environment deployments (dev, staging, prod) |
| 81 | |
| 82 | ## Prerequisites |
| 83 | |
| 84 | **Required**: Cloud provider basics (AWS/GCP/Azure), HCL syntax, Terraform CLI |
| 85 | |
| 86 | **Agents**: `system-architect`, `cicd-engineer`, `security-manager`, `reviewer` |
| 87 | |
| 88 | ## Core Workflows |
| 89 | |
| 90 | ### Workflow 1: AWS Infrastructure with Modules |
| 91 | |
| 92 | **Step 1: Directory Structure** |
| 93 | |
| 94 | ``` |
| 95 | terraform/ |
| 96 | ├── main.tf |
| 97 | ├── variables.tf |
| 98 | ├── outputs.tf |
| 99 | ├── versions.tf |
| 100 | ├── terraform.tfvars |
| 101 | └── modules/ |
| 102 | ├── vpc/ |
| 103 | │ ├── main.tf |
| 104 | │ ├── variables.tf |
| 105 | │ └── outputs.tf |
| 106 | └── ec2/ |
| 107 | ├── main.tf |
| 108 | ├── variables.tf |
| 109 | └── outputs.tf |
| 110 | ``` |
| 111 | |
| 112 | **Step 2: Main Configuration** |
| 113 | |
| 114 | ```hcl |
| 115 | # main.tf |
| 116 | terraform { |
| 117 | required_version = ">= 1.5.0" |
| 118 | |
| 119 | required_providers { |
| 120 | aws = { |
| 121 | source = "hashicorp/aws" |
| 122 | version = "~> 5.0" |
| 123 | } |
| 124 | } |
| 125 | |
| 126 | backend "s3" { |
| 127 | bucket = "my-terraform-state" |
| 128 | key = "production/terraform.tfstate" |
| 129 | region = "us-east-1" |
| 130 | encrypt = true |
| 131 | dynamodb_table = "terraform-lock" |
| 132 | } |
| 133 | } |
| 134 | |
| 135 | provider "aws" { |
| 136 | region = var.aws_region |
| 137 | |
| 138 | default_tags { |
| 139 | tags = { |
| 140 | Environment = var.environment |
| 141 | ManagedBy = "Terraform" |
| 142 | Project = var.project_name |
| 143 | } |
| 144 | } |
| 145 | } |
| 146 | |
| 147 | module "vpc" { |
| 148 | source = "./modules/vpc" |
| 149 | |
| 150 | vpc_cidr = var.vpc_cidr |
| 151 | availability_zones = var.availability_zones |
| 152 | environment = var.environment |
| 153 | } |
| 154 | |
| 155 | module "ec2" { |
| 156 | source = "./modules/ec2" |
| 157 | |
| 158 | vpc_id = module.vpc.vpc_id |
| 159 | subnet_ids = module.vpc.private_subnet_ids |
| 160 | instance_type = var.instance_type |
| 161 | instance_count = var.instance_count |
| 162 | security_group_id = module.vpc.security_group_id |
| 163 | } |
| 164 | ``` |
| 165 | |
| 166 | **Step 3: Variables and Outputs** |
| 167 | |
| 168 | ```hcl |
| 169 | # variables.tf |
| 170 | variable "aws_region" { |
| 171 | description = "AWS region" |
| 172 | type = string |
| 173 | default = "us-east-1" |
| 174 | } |
| 175 | |
| 176 | variable "environment" { |
| 177 | d |