by mars
GitHub Readme.md
Use Terraform in a Heroku app.
The Terraform config must implement a non-local backend, because otherwise state will be lost between runs. The default local backend saves state in the filesystem which ephemeral in Heroku dynos.
▶️ Deploy the terraforming-app which includes Postgres backend, automated initialization, and a minimal example Terraform config.
In a git repo that contains at least a *.tf
Terraform config file, such as main.tf
,
heroku create --buildpack https://github.com/mars/terraforming-buildpack
# Set any variables required by the Terraform config
# Credentials for the Terraform Heroku provider
heroku config:set HEROKU_API_KEY=xxxxx HEROKU_EMAIL=x@example.com
# Input variables
heroku config:set TF_VAR_example_app_name=yyyyy
git push heroku master
heroku run terraform init
heroku run terraform apply
heroku run terraform output
TERRAFORM_BIN_URL
set the source URL for the terraform binary
*.zip
file as distributed by Hashicorp
Copy the snippet above into CLI.