{"id":18096027,"url":"https://github.com/carlo-colombo/terrafrom-server-setup","last_synced_at":"2026-02-25T17:41:31.245Z","repository":{"id":140905148,"uuid":"73499344","full_name":"carlo-colombo/terrafrom-server-setup","owner":"carlo-colombo","description":null,"archived":false,"fork":false,"pushed_at":"2016-11-25T17:42:06.000Z","size":9,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-28T20:43:23.486Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HCL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/carlo-colombo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2016-11-11T17:54:31.000Z","updated_at":"2016-11-11T18:00:10.000Z","dependencies_parsed_at":null,"dependency_job_id":"f9424ab6-743f-417f-8e19-49d7fe15b2ae","html_url":"https://github.com/carlo-colombo/terrafrom-server-setup","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/carlo-colombo/terrafrom-server-setup","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carlo-colombo%2Fterrafrom-server-setup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carlo-colombo%2Fterrafrom-server-setup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carlo-colombo%2Fterrafrom-server-setup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carlo-colombo%2Fterrafrom-server-setup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/carlo-colombo","download_url":"https://codeload.github.com/carlo-colombo/terrafrom-server-setup/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carlo-colombo%2Fterrafrom-server-setup/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29832974,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-25T17:17:09.781Z","status":"ssl_error","status_checked_at":"2026-02-25T17:16:50.421Z","response_time":61,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5: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":[],"created_at":"2024-10-31T19:12:16.002Z","updated_at":"2026-02-25T17:41:31.204Z","avatar_url":"https://github.com/carlo-colombo.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# terrafrom-server-setup\n\n## Objective\nRecreating with [terraform](https://www.terraform.io) a setup I already have with `docker-compose`. The setup consist of `nginx` acting as reverse proxy in front of a couple of different webservices (1 static website, 2 telegram bot, 1 rest service). Additionally `https` is provided with `letsencrypt`. All the services are deployed as docker images, plus there is a docker image that host nginx (and another that provide the letsencrypt certificates). Request on the port `80` of the webserver will be dispatched to the relevenat webservice based on the `Host` header.\n\n### Actual situation\n`docker-compose` allow to spin up a set of images based on a yaml configuration fiele (yeah yaml!!! :-D ). `docker-compose` does not implement (AFAIK) any type of templating in its configuration file this bring duplication and embedding of secrets inside of the configuration.\n\n### Expected improvment using Terraform\n- configuration reusability between similar services (bots)\n- removing secrets from the configuration\n- terraform output can be used to automate succesful step (eg ping to `/status` endpoint )\n\n### [nginx-proxy](https://github.com/jwilder/nginx-proxy)\nnginx-proxy sets up a container running nginx and docker-gen. docker-gen generates reverse proxy configs for nginx and reloads nginx when containers are started and stopped.\n\n\n\n### Prepare\n\n#### pull docker images \n```\n\u003e docker pull carlocolombo/dublin_bus_telegram-bot\n\u003e docker pull carlocolombo/webhook_me\n\u003e docker pull jwilder/nginx-proxy\n```\n\n#### create a `secrets.tfvars` to contain telegram bot keys and hashids salt\n\n```\nwebhook_me_bot_token = \"ask The Bot Father\"\ndublin_bus_bot_token = \"ask The Bot Father\"\nhashids_salt =  \"a random string\"\n```\n\n### Terraform commands\n\n```\n# See the resource that terraform is planning to create\n\u003e terraform plan -var-file=secrets.tfvars\n\n# Create and run the containers\n\u003e terraform apply -var-file=secrets.tfvars\n\n# Tear down everything\n\u003e terraform destroy -var-file=secrets.tfvars\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcarlo-colombo%2Fterrafrom-server-setup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcarlo-colombo%2Fterrafrom-server-setup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcarlo-colombo%2Fterrafrom-server-setup/lists"}