{"id":25489817,"url":"https://github.com/paaloeye/agentic-terraform","last_synced_at":"2025-07-19T14:34:42.900Z","repository":{"id":278183812,"uuid":"934767070","full_name":"paaloeye/agentic-terraform","owner":"paaloeye","description":"Agentic Terraform: Intelligent workflow that enhances LLM-generated Infrastructure-as-Code","archived":false,"fork":false,"pushed_at":"2025-02-18T12:09:55.000Z","size":47,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"chore/release-to-public","last_synced_at":"2025-06-11T07:13:23.531Z","etag":null,"topics":["agentic","agentic-workflow","infrastructure-as-code","terraform"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/paaloeye.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-02-18T11:21:35.000Z","updated_at":"2025-05-15T03:27:58.000Z","dependencies_parsed_at":"2025-02-18T13:23:57.213Z","dependency_job_id":"e4b99708-7083-459d-b27d-9ef6d2c92656","html_url":"https://github.com/paaloeye/agentic-terraform","commit_stats":null,"previous_names":["paaloeye/agentic-terraform"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/paaloeye/agentic-terraform","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paaloeye%2Fagentic-terraform","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paaloeye%2Fagentic-terraform/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paaloeye%2Fagentic-terraform/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paaloeye%2Fagentic-terraform/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/paaloeye","download_url":"https://codeload.github.com/paaloeye/agentic-terraform/tar.gz/refs/heads/chore/release-to-public","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paaloeye%2Fagentic-terraform/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265947510,"owners_count":23853382,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["agentic","agentic-workflow","infrastructure-as-code","terraform"],"created_at":"2025-02-18T21:17:58.157Z","updated_at":"2025-07-19T14:34:42.879Z","avatar_url":"https://github.com/paaloeye.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!--\nSPDX-License-Identifier: MPL-2.0\n--\u003e\n\n# Agentic Terraform\n\nThis repository implements an intelligent workflow that enhances LLM-generated Infrastructure-as-Code (IaC) using:\n\n- [Few-shot prompting](https://en.wikipedia.org/wiki/Prompt_engineering#In-context_learning)\n- [Pseudo-RAG](https://en.wikipedia.org/wiki/Retrieval-augmented_generation)\n- Automated validation and retry mechanisms\n\n## Components\n\n### 1. Pipeline (`pipeline.py`)\nOrchestrates the workflow by integrating all steps below.\n\n### 2. Steps (`steps.py`)\nContains the core processing modules:\n\n- **FewShot**: Uses curated examples to guide the LLM in generating accurate IaC\n- **PseudoRAG**: Generates appropriate `Terraform` provider clauses using [tf-idf](https://en.wikipedia.org/wiki/Tf%E2%80%93idf) classification\n- **TerraformValidator**: Validates generated IaC and implements retry logic for incomplete/invalid outputs\n\n## Getting Started\n\n### Prerequisites\n- Python 3.12 or newer\n- Terraform CLI (must be in system PATH)\n\n### Installation\n\n1. Clone the repository:\n   ```shell\n   git clone https://github.com/paaloeye/agentic-terraform.git\n   cd agentic-terraform\n   ```\n\n2. Set up the environment:\n   ```shell\n   # Using micromamba (recommended)\n   micromamba create -f environment.yml\n   micromamba activate agentic-terraform\n\n   # Install development dependencies\n   pipenv install --dev\n   ```\n\n### Usage\n\n1. Set your API key:\n   ```shell\n   export ANTHROPIC_API_KEY=\u003cyour-key-here\u003e\n   ```\n\n2. Run the example:\n   ```shell\n   pipenv shell\n   python ./main.py\n   ```\n\n## Example Implementation\n\n```python\nimport anthropic\nfrom pipeline import Pipeline\nfrom steps import FewShot, LLMClient, PseudoRAG, TerraformValidator, UserPrompt\n\ndef main():\n    # Configure the pipeline\n    model_name = \"claude-3-5-haiku-latest\"\n    llm_client = anthropic.Anthropic()\n\n    # Define infrastructure requirements\n    prompt = \"\"\"\n    Deploy 3 VMs with:\n    - 16+ CPUs each\n    - 64GB RAM each\n    - Distributed across 3 availability zones\n    - Located in the Netherlands\n    - Using Azure as provider\n    \"\"\"\n\n    # Set up pipeline steps\n    steps = [\n        FewShot(),\n        UserPrompt(),\n        PseudoRAG(),\n        LLMClient(llm_client, model_name),\n        TerraformValidator(),\n    ]\n\n    # Execute and get results\n    pipeline = Pipeline(steps)\n    result = pipeline.run(prompt)\n    print(result)\n\nif __name__ == \"__main__\":\n    main()\n```\n\n## Development\n\n### Validation Process\nThe retry mechanism utilises `terraform validate -json` to verify IaC syntax and structure.\n\n### Contributing\n1. Fork the repository\n2. Install pre-commit hooks: `pre-commit install`\n3. Create a feature branch\n4. Submit a pull request with detailed description\n\n## Licence\n\nLicensed under the [Mozilla Public License 2.0 (MPL-2.0)](https://www.mozilla.org/en-US/MPL/2.0/).\nSee [LICENCE](LICENSE.md) for details and [legal TL;DR](https://www.tldrlegal.com/license/mozilla-public-license-2-0-mpl-2).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaaloeye%2Fagentic-terraform","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpaaloeye%2Fagentic-terraform","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaaloeye%2Fagentic-terraform/lists"}