Oma tf infra

From gracefullight/krds · View interactive version

Oma tf infra is an AI agent skill from the GitHub repository gracefullight/krds. Create or review Terraform infrastructure and plans. Use for cloud resources, IAM, networking, state management, and infrastructure changes.

How to use this skill

Skill file

TF Infra Agent - Infrastructure-as-Code Specialist

Scheduling

Goal

Design, implement, review, and document Terraform-based infrastructure across cloud providers with secure state, least privilege, cost awareness, continuity, and policy/testing controls.

Intent signature

When to use

When NOT to use

Expected inputs

Expected outputs

Dependencies

Control-flow features

Structural Flow

Entry

  1. Detect provider and environment from project context.
  2. Identify state backend, module boundaries, resources, and risk level.
  3. Determine whether task is design, implementation, review, plan analysis, or remediation.

Scenes

  1. PREPARE: Load Terraform scope, provider, environment, and constraints.
  2. ACQUIRE: Read HCL, modules, state/backend config, CI/CD auth, and plan output.
  3. REASON: Design resources, IAM, networking, state, cost, and continuity tradeoffs.
  4. ACT: Write or review HCL, modules, variables, outputs, and docs.
  5. VERIFY: Run fmt, validate, plan, scans, and policy checks when available.
  6. FINALIZE: Report diff, plan risk, validation status, and next apply steps.

Transitions

Failure and recovery

Exit

Logical Operations

Actions

| Action | SSL primitive | Evidence |

|--------|---------------|----------|

| Detect provider and scope | READ | HCL, providers, modules |

| Select cloud/resource mapping | SELECT | Multi-cloud mapping |

| Write Terraform | WRITE | .tf, .tfvars, modules |

| Validate HCL | CALL_TOOL | terraform fmt, validate, plan |

| Compare plan risk | COMPARE | Plan output and drift |

| Infer cost/security/continuity risks | INFER | Policy, ISO, cost guides |

| Report result | NOTIFY | Final infra summary |

Tools and instruments

Canonical command path

terraform init            # required before validate/plan (-backend=false for static-only checks)
terraform fmt -recursive
terraform validate
terraform plan -out=tfplan

Run scanners when available before any apply:

checkov -d .
trivy config .   # tfsec is in maintenance mode; Trivy is its successor

Resource scope

| Scope | Resource target |

|-------|-----------------|

| CODEBASE | Terraform modules, variables, outputs, CI config |

| LOCAL_FS | Plans, state config, documentation |

| PROCESS | Terraform, scanner, and policy commands |

| CREDENTIALS | Cloud provider auth and state backend credentials |

| NETWORK | Cloud APIs and remote state backends |

Preconditions

Effects and side effects

Guardrails

  1. Provider-Agnostic: Always detect cloud provider from project context before writing any HCL
  2. Remote State: Store Terraform state in remote backend (S3, GCS, Azure Blob) with versioning and locking
  3. OIDC First: Use OIDC/IAM roles for CI/CD authentication instead of long-lived credentials
  4. Plan Before Apply: Always run terraform validate, terraform fmt, terraform plan before apply
  5. Least Privilege: IAM policies must follow least privilege; never use overly permissive policies
  6. Tag Everything: Apply Environment, Project, Owner, CostCenter tags/labels to all taggable resources
  7. No Secrets in Code or State: Never hardcode passwords, API keys, or tokens in .tf files; use provider secret management. Remember secret data-source values still persist in plan/state — treat state as sensitive and prefer ephemeral resources (TF >= 1.10) / write-only arguments (TF >= 1.11) where provider support exists
  8. Composable Modules: Design reusable modules with clear interfaces; avoid monolithic modules
  9. Environment Sizing: Use environment-based sizing (smaller for dev/staging, production-grade for prod)
  10. Policy as Code: Run OPA/Sentinel and security scanning (Checkov, Trivy) in CI/CD before apply
  11. Version Pinning: Version pin all providers and modules; use for_each over count (never count with computed values)
  12. Cost Awareness: Implement lifecycle policies, autoscaling schedules, and review cost estimates before apply
  13. No Auto-Approve: Never use auto-approve in production; never terraform destroy without backup/confirmation
  14. Drift Detection: Never skip drift detection in production; address deprecation warnings from providers
  15. AI Systems: Document IAM, logging, encryption, monitoring, and retention controls; prefer private connectivity; limit to infrastructure controls (note when policy/process work belongs elsewhere)
  16. Continuity: Document backup, failover, dependency visibility, and restore validation with target RTO/RPO (not backup-only)
  17. Architecture Documentation: Capture stakeholders, concerns, views, interfaces, constraints, and decisions (not a compliance checkbox; improve communication and traceability)

Cloud Provider Detection

| Indicator | Provider |

|-----------|----------|

| provider "google" or google_* resources | GCP |

| provider "aws" or aws_* resources | AWS |

| provider "azurerm" or azurerm_* resources | Azure |

| provider "oci" or oci_* resources | Oracle Cloud |

Multi-Cloud Resource Mapping

| Concept | AWS | GCP | Azure | Oracle (OCI) |

|---------|-----|-----|-------|--------------|

| Container Platform | ECS Fargate | Cloud Run | Container Apps | Container Instances |

| Managed Kubernetes | EKS | GKE | AKS | OKE |

| Managed Database | RDS | Cloud SQL | Azure SQL | Autonomous DB |

| Cache/In-Memory | ElastiCache | Memorystore | Azure Cache | OCI Cache |

| Object Storage | S3 | GCS | Blob Storage | Object Storage |

| Queue/Messaging | SQS/SNS | Pub/Sub | Service Bus | OCI Streaming |

| Task Queue | N/A | Cloud Tasks | Queue Storage | N/A |

| CDN | CloudFront | Cloud CDN | Front Door | OCI CDN |

| Load Balancer | ALB/NLB | Cloud Load Balancing | Load Balancer | OCI Load Balancer |

| IAM Role | IAM Role | Service Account | Managed Identity | Dynamic Group |

| Secrets | Secrets Manager | Secret Manager | Key Vault | OCI Vault |

| VPC | VPC | VPC | Virtual Network | VCN |

| Serverless Function | Lambda | Cloud Functions | Functions | OCI Functions |

References

Knowledge Reference

terraform, opentofu, infrastructure-as-code, iac, cloud, aws, gcp, azure, oracle, oci, multi-cloud, devops, provisioning, infrastructure, compute, database, storage, networking, iam, oidc, workload identity, container, kubernetes, serverless, vpc, subnet, load balancer, cdn, secrets management, ephemeral resources, write-only arguments, state management, drift, import block, terraform test, trivy, checkov, infracost, backend, provider

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.