{"id":43791954,"url":"https://github.com/silvemerson/pyform-ai","last_synced_at":"2026-02-05T20:24:13.617Z","repository":{"id":296618779,"uuid":"993962389","full_name":"silvemerson/pyform-ai","owner":"silvemerson","description":"Infraestrutura como Código com Terraform, Python e IA (Ollama/OpenAI)","archived":false,"fork":false,"pushed_at":"2025-06-02T18:38:56.000Z","size":90,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-03T07:47:38.885Z","etag":null,"topics":["ai","codellama","devops","iac","llm","ollama","openai","python","terraform"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/silvemerson.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null}},"created_at":"2025-05-31T22:30:14.000Z","updated_at":"2025-06-02T18:51:43.000Z","dependencies_parsed_at":"2025-06-03T07:48:15.106Z","dependency_job_id":"aff26306-96c3-48d0-99d1-850062e6294c","html_url":"https://github.com/silvemerson/pyform-ai","commit_stats":null,"previous_names":["silvemerson/terraform-ai-py","silvemerson/pyform-ai"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/silvemerson/pyform-ai","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/silvemerson%2Fpyform-ai","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/silvemerson%2Fpyform-ai/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/silvemerson%2Fpyform-ai/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/silvemerson%2Fpyform-ai/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/silvemerson","download_url":"https://codeload.github.com/silvemerson/pyform-ai/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/silvemerson%2Fpyform-ai/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29133381,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-05T19:36:52.185Z","status":"ssl_error","status_checked_at":"2026-02-05T19:35:40.941Z","response_time":65,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["ai","codellama","devops","iac","llm","ollama","openai","python","terraform"],"created_at":"2026-02-05T20:24:12.920Z","updated_at":"2026-02-05T20:24:13.608Z","avatar_url":"https://github.com/silvemerson.png","language":"Python","readme":"# Assistente IA do Terraform com Python\n\n![banner](img/banner-novo.png)\n\n```bash\n\nterraform-ai/\n├── main.py\n├── ai.py           # Módulo que conversa com OpenAI ou Ollama\n├── cli.py          # Entrada de terminal\n├── prompts.py      # Prompts base para reutilizar\n├── templates/      # (Opcional) templates .tf\n└── generated/      # Arquivos gerados\n\n```\n\nEai galera, por questão de estudos e quem sabe virar algo que seja usado pela comunidade, estou desenvolvendo um assistente de IA para Terraform usando python chamado **terraform-ai-py**. Muito semelhante ao [kubectl-ai](https://github.com/sozercan/kubectl-ai).\n\nÉ uma ferramenta de linha de comando que usa modelos de linguagem (LLMs) para gerar código Terraform com base em solicitações em linguagem natural. Seu principal objetivo é acelerar a criação de infraestrutura como código de forma inteligente e automatizada.\n\nAtualmente, o projeto utiliza nativamente o Ollama, permitindo o uso de modelos LLMs locais, como LLaMA 3, Mistral, entre outros, sem depender da nuvem ou de APIs pagas.\n\nEssa abordagem oferece:\n\n✅ Privacidade dos dados\n\n✅ Baixo custo (sem taxas de uso de API)\n\n✅ Execução local e offline\n\n\n## Fluxo geral\n\n```bash\n[main.py] → [cli.py] → [ai.py + prompts.py] → [templates/] → [generated/main.tf]\n```\n\n### Requisitos\n\n- Ollama com modelos LLM configurado\n- python \u003e=3\n\n#### dependências pip\n\n```bash\nopenai\u003e=0.28.1      # cliente OpenAI (compatível com ChatCompletion)\nrequests\u003e=2.31.0    # usado para conversar com o Ollama local\npython-dotenv\u003e=1.0  # opcional: carregar variáveis do .env\n\npython3 -m venv .venv \nsource .venv/bin/activate   \n\npip install --upgrade pip\npip install -r requirements.txt\n\n```\n### Na prática\n\n```bash\nexport OLLAMA_URL=\"http://192.168.1.100:11434\"\nexport OLLAMA_MODEL=\"codellama\"\n```\n\n```bash\npython3 main.py \"crie um S3 com versionamento\"\n\nTerraform gerado em: generated/main.tf\n\nConteúdo do arquivo gerado:\n\nresource \"aws_s3_bucket\" \"example\" {\n  bucket = \"example-bucket\"\n  versioning {\n    enabled = true\n  }\n}\n```\n## Ideias futuras (em construção)\n\nEm breve, o projeto incluirá suporte à API da OpenAI (GPT-4, GPT-3.5), permitindo aos usuários escolher entre:\n\nModelos locais via Ollama\n\nModelos na nuvem via OpenAI\n\nEssa flexibilidade permitirá escolher o melhor equilíbrio entre velocidade, precisão e custo, de acordo com o seu ambiente.\n\nSe quiser contribuir simbora.","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsilvemerson%2Fpyform-ai","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsilvemerson%2Fpyform-ai","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsilvemerson%2Fpyform-ai/lists"}