Skip to content

mars/terraforming-buildpack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Terraforming 🌱 buildpack for Heroku

Use Terraform in a Heroku app.

Requires

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.

Usage

▶️ Deploy the terraforming-app which includes Postgres backend, automated initialization, and a minimal example Terraform config.

Manual app setup

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

Configuration

  • TERRAFORM_BIN_URL set the source URL for the terraform binary