{"id":27300765,"url":"https://github.com/lifeofguenter/terraecs","last_synced_at":"2025-04-12T01:25:57.565Z","repository":{"id":57474341,"uuid":"179180295","full_name":"lifeofguenter/terraecs","owner":"lifeofguenter","description":"Terraform meets ECS/Fargate","archived":false,"fork":false,"pushed_at":"2024-01-17T06:59:03.000Z","size":26,"stargazers_count":6,"open_issues_count":0,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-07T01:52:17.247Z","etag":null,"topics":["cli","docker","fargate","python3"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/terraecs/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lifeofguenter.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}},"created_at":"2019-04-03T00:32:56.000Z","updated_at":"2024-01-06T19:33:20.000Z","dependencies_parsed_at":"2022-09-12T21:02:11.522Z","dependency_job_id":null,"html_url":"https://github.com/lifeofguenter/terraecs","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lifeofguenter%2Fterraecs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lifeofguenter%2Fterraecs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lifeofguenter%2Fterraecs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lifeofguenter%2Fterraecs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lifeofguenter","download_url":"https://codeload.github.com/lifeofguenter/terraecs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248450211,"owners_count":21105640,"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":["cli","docker","fargate","python3"],"created_at":"2025-04-12T01:25:56.680Z","updated_at":"2025-04-12T01:25:57.557Z","avatar_url":"https://github.com/lifeofguenter.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# terraecs\n\n[![Build Status](https://travis-ci.org/lifeofguenter/terraecs.svg?branch=master)](https://travis-ci.org/lifeofguenter/terraecs)\n[![PyPI](https://img.shields.io/pypi/v/terraecs.svg)](https://pypi.org/project/terraecs/)\n[![License](https://img.shields.io/github/license/lifeofguenter/terraecs.svg)](LICENSE)\n\nTerraecs is a simple cli tool to run a once-off [ECS/Fargate](https://aws.amazon.com/fargate/) task that relies on a [terraformed](https://www.terraform.io/) infrastructure.\n\n_Preview release, please do not use for anything important!_\n\n## Motivation\n\n* I want to run a command (be it ror-rake, laravel-artisan, etc.) in a Fargate environment\n* I use terraform for IaC, and do not want to deviate from that\n* I also do not want to think about infrastructure when running a command, as it should be already setup via terraform\n* These once-off tasks are dirty, I want to have direct feedback on how it went (logs + exit status)\n\n## Installation\n\n```bash\n$ pip install terraecs\n```\n\n## Usage\n\nYou will need to create a Fargate task module to create a task-definition and any other supporting resources (networking/cloudwatchlogs). At a minimum the module will have to output the following:\n\n```hcl\noutput \"cluster_id\" {\n  value = \"${var.cluster_id}\"\n}\n\noutput \"subnets\" {\n  value = \"${var.subnets}\"\n}\n\noutput \"security_group_id\" {\n  value = \"${aws_security_group.main.id}\"\n}\n\noutput \"task_definition_arn\" {\n  value = \"${aws_ecs_task_definition.main.arn}\"\n}\n```\n\nTerraform 0.12 and later intentionally track only root module outputs in the state. To expose module outputs for external consumption, you must export them from the root module using an output block, which as of 0.12 can now be done for a single module all in one output:\n\n```hcl\noutput \"custom_ecs_task\" {\n  value = module.custom_ecs_task\n}\n```\n\nOnce you have applied your terraform config, pull the output into a json:\n\n```bash\n$ terraform output -json custom_ecs_task \u003e output.json\n```\n\nNow you can use `terraecs` to run any command based off the above task-definition:\n\n```bash\n$ terraecs -f output.json run \"command\" \"arg1\" \"arg2\"\n```\n\n## Output\n\nThe output can look something like this:\n\n```bash\n❯ AWS_PROFILE=staging terraecs -f output.json run artisan --help\n2019-04-10 08:14:01,884 botocore.credentials [INFO] Found credentials in shared credentials file: ~/.aws/credentials\n2019-04-10 08:14:03,893 root [INFO] launched task: arn:aws:ecs:eu-west-1:1111111111111:task/staging-main/4544cfd6f10e4ff0b16458666362cbd9\n2019-04-10 08:14:04,069 root [INFO] PROVISIONING\n2019-04-10 08:14:25,461 root [INFO] PENDING\n2019-04-10 08:15:51,642 root [INFO] DEPROVISIONING\n2019-04-10 08:16:13,632 root [INFO] STOPPED\nDescription:\n  Lists commands\nUsage:\n  list [options] [--] [\u003cnamespace\u003e]\nArguments:\n  namespace            The namespace name\nOptions:\n      --raw            To output raw command list\n      --format=FORMAT  The output format (txt, xml, json, or md) [default: \"txt\"]\nHelp:\n  The list command lists all commands:\n\n    php artisan list\n\n  You can also display the commands for a specific namespace:\n\n    php artisan list test\n\n  You can also output the information in other formats by using the --format option:\n\n    php artisan list --format=xml\n\n  It's also possible to get raw list of commands (useful for embedding command runner):\n\n    php artisan list --raw\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flifeofguenter%2Fterraecs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flifeofguenter%2Fterraecs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flifeofguenter%2Fterraecs/lists"}