{"id":15350147,"url":"https://github.com/mars/terraforming-app","last_synced_at":"2025-04-14T05:32:50.853Z","repository":{"id":139298511,"uuid":"153184321","full_name":"mars/terraforming-app","owner":"mars","description":"☁️🌱 Run Terraform CLI in the cloud: `heroku run terraform apply`","archived":false,"fork":false,"pushed_at":"2021-10-25T22:39:08.000Z","size":31232,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-27T19:19:52.450Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"HCL","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/mars.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}},"created_at":"2018-10-15T21:30:34.000Z","updated_at":"2025-01-05T17:52:58.000Z","dependencies_parsed_at":null,"dependency_job_id":"0c436cb2-7e05-4c67-af66-8d9cba9682f9","html_url":"https://github.com/mars/terraforming-app","commit_stats":{"total_commits":22,"total_committers":2,"mean_commits":11.0,"dds":"0.40909090909090906","last_synced_commit":"450fc2ef5d2f97c2a30ff72a84fd49d44db01a52"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mars%2Fterraforming-app","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mars%2Fterraforming-app/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mars%2Fterraforming-app/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mars%2Fterraforming-app/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mars","download_url":"https://codeload.github.com/mars/terraforming-app/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248826934,"owners_count":21167780,"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":[],"created_at":"2024-10-01T11:57:43.778Z","updated_at":"2025-04-14T05:32:50.822Z","avatar_url":"https://github.com/mars.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"Terraforming 🌱 Heroku app\n===========================\n\n[Terraform](https://www.terraform.io/) [1.0](https://www.hashicorp.com/blog/announcing-terraform-0-12) as a [Heroku](https://www.heroku.com/) app.\n\nRun Terraform CLI in the cloud:\n\n```bash\nheroku run terraform apply\n```\n\n🔬🚧 This is a community proof-of-concept, [MIT license](LICENSE), provided \"as is\", without warranty of any kind.\n\n⭐️💁‍♀️ Uses the [Terraform Postgres backend](https://www.terraform.io/docs/backends/types/pg.html).\n\nSet-up\n------\n\n### Create Heroku Team\n\nTerraform works best with Heroku when contained by a team.\n\n▶️ [Create a team](https://dashboard.heroku.com/teams/new) or use an existing team.\n\n### Create Heroku Account for Terraform\n\nTerraform uses an authorization token (secret key) access the Heroku API.\n\nTerraform's access can be isolated from your main user account by creating a separate Heroku account \u0026 authorization token, and inviting the new account to the team.\n\n▶️ [Sign-up for another account](https://signup.heroku.com/). Set the first \u0026 last name to \"Terraform\" \u0026 \"app\"\n\n▶️ [Create an Authorization for Terraform](https://dashboard.heroku.com/account/applications#authorizations). Set its description to `terraforming-app`. Note the generated **Authorization token**.\n\n▶️ [Invite the new account to the team](https://devcenter.heroku.com/articles/heroku-teams#setting-up-your-heroku-team). Set its role to **admin**, so that it can fully manage apps and other resources.\n\n### Deploy Terraform for Team\n\nCreate a new app for Terraform by clicking the \"Deploy\" button below. On the form that appears, set:\n\n* **App name** to something like `teamname-terraform`\n* **App owner** to the team name created above\n* **HEROKU_API_KEY** to the **Authorization token** generated above\n* **HEROKU_EMAIL** to the email of the separate account created above\n\n[![Deploy to Heroku](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy)\n\n### Connect source code\n\nCreate a local working copy of the Heroku app, to begin committing \u0026 applying Terraform configurations.\n\n✏️ *Replace `$APP_NAME` with the value of the **App name** created above, like `teamname-terraform`*\n\n```bash\ngit clone https://github.com/mars/terraforming-app.git $APP_NAME\ncd $APP_NAME\nheroku git:remote --app $APP_NAME\n```\n\nUsage\n-----\n\nOnce [set-up](#user-content-set-up) is complete, you can begin using Terraform!\n\n### Create your Terraform config\n\nUse the [Heroku provider](https://www.terraform.io/docs/providers/heroku/) and [others](https://www.terraform.io/docs/providers/) to build-up configuration in `*.tf` files.\n\n### Push your changes\n\n✏️ *Replace `$APP_NAME` in the following commands with your own unique app name.*\n\n```bash\ngit add .\ngit commit -m 'Initial configuration'\n\n# The included `main.tf` example requires the `example_app_name` variable\nheroku config:set TF_VAR_example_app_name=$APP_NAME\n\ngit push heroku master\n```\n\n⏳ Wait for the push to complete.\n\n### Run Terraform\n\nUse interactively in one-off dynos:\n\n```bash\nheroku run terraform plan\nheroku run terraform apply\n```\n\nRunning apply, you'll see output like this:\n\n```\n$ heroku run terraform apply\nRunning terraform apply on ⬢ terraforming... up, run.3842 (Free)\n\nAn execution plan has been generated and is shown below.\nResource actions are indicated with the following symbols:\n  + create\n\nTerraform will perform the following actions:\n\n  + heroku_app.example\n      id:                \u003ccomputed\u003e\n      all_config_vars.%: \u003ccomputed\u003e\n      config_vars.#:     \u003ccomputed\u003e\n      git_url:           \u003ccomputed\u003e\n      heroku_hostname:   \u003ccomputed\u003e\n      internal_routing:  \u003ccomputed\u003e\n      name:              \"mars-terraforming-example\"\n      region:            \"us\"\n      stack:             \u003ccomputed\u003e\n      uuid:              \u003ccomputed\u003e\n      web_url:           \u003ccomputed\u003e\n\n\nPlan: 1 to add, 0 to change, 0 to destroy.\n\nDo you want to perform these actions?\n  Terraform will perform the actions described above.\n  Only 'yes' will be accepted to approve.\n\n  Enter a value:\n```\n\n🚦 Terraform waits here, to verify the actions it will take. **Type `yes` to proceed.**\n\n```\nheroku_app.example: Creating...\n  all_config_vars.%: \"\" =\u003e \"\u003ccomputed\u003e\"\n  config_vars.#:     \"\" =\u003e \"\u003ccomputed\u003e\"\n  git_url:           \"\" =\u003e \"\u003ccomputed\u003e\"\n  heroku_hostname:   \"\" =\u003e \"\u003ccomputed\u003e\"\n  internal_routing:  \"\" =\u003e \"\u003ccomputed\u003e\"\n  name:              \"\" =\u003e \"mars-terraforming-example\"\n  region:            \"\" =\u003e \"us\"\n  stack:             \"\" =\u003e \"\u003ccomputed\u003e\"\n  uuid:              \"\" =\u003e \"\u003ccomputed\u003e\"\n  web_url:           \"\" =\u003e \"\u003ccomputed\u003e\"\nheroku_app.example: Creation complete after 1s (ID: mars-terraforming-example)\n\nApply complete! Resources: 1 added, 0 changed, 0 destroyed.\n```\n\n⏳ Once the run completes, you can fetch outputs from the configuration, like the app URL from the included example:\n\n```bash\nheroku run terraform output example_app_url\n```\n\nWith the included example, you may easily view the app's build log using curl:\n\n```bash\ncurl \"$(heroku run terraform output example_app_build_log_url)\"\n```\n\nDev Notes 📓\n------------\n\n### Manual setup\n\n```bash\nexport APP_NAME=my-app\ngit clone https://github.com/mars/terraforming-app\ncd terraforming-app/\n\nheroku create $APP_NAME --buildpack mars/terraforming\nheroku addons:create heroku-postgresql\n\n# Use Terraform 0.12 to support Postgres backend\nheroku config:set TERRAFORM_BIN_URL=https://releases.hashicorp.com/terraform/0.12.0/terraform_0.12.0_linux_amd64.zip\n\n# Set credentials for the Terraform Heroku provider\nheroku config:set HEROKU_API_KEY=xxxxx HEROKU_EMAIL=x@example.com\n\n# Set Terraform input variables\nheroku config:set TF_VAR_example_app_name=$APP_NAME-example\n\ngit push heroku master\n```\n\n### Run Terraform locally w/ Heroku Postgres backend\n\n```bash\n# First-time for each terminal\nexport DATABASE_URL=`heroku config:get DATABASE_URL`\n\n# First-time for each project\nterraform init -backend-config=\"conn_str=$DATABASE_URL\"\n\n# Then, apply \u0026 destroy as you like.\nterraform apply\nterraform destroy\n```\n\n### Run Terraform locally w/ local Postgres backend\n\n```bash\n# Create the local database using Postgres Client tool\ncreatedb terraform_backend\n\n# First-time for each terminal\nexport DATABASE_URL='postgres://localhost/terraform_backend?sslmode=disable'\n\n# First-time for each project\nterraform init -backend-config=\"conn_str=$DATABASE_URL\"\n\n# Then, apply \u0026 destroy as you like.\nterraform apply\nterraform destroy\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmars%2Fterraforming-app","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmars%2Fterraforming-app","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmars%2Fterraforming-app/lists"}