Terraform configuration template to provision a new Heroku app. Utilizes the Terraform Heroku provider.
The base config will provision a new Heroku app (with no buildpack assignment) and an associated PostgreSQL database add-on. The default deployment region is 'us', but this can be modified. The specific database plan can be customized with parameters in terraform.tfvars. Additional functionality is available to configure a custom domain name, as well as to provision a Heroku Scheduler add-on. Configurations for those need to be uncommented in main.tf to use, and parameters configured appropriately in terraform.tfvars.
The Terraform heroku_app resource provides an argument to update Heroku configuration variables. This can be accomplished here by uncommenting that argument in main.tf, and editing the 'heroku_config_vars' map variable in terraform.tfvars.
The Terraform state file is not stored with the code repository, and must be maintained locally.
- Terraform 0.10.x
- A Heroku account
- Clone the repository
- Customize the parameters in the terraform.tfvars file. Minimum required updates are 'heroku_email', 'heroku_api_key', and 'heroku_app_name'.
- Customize additional terraform.tfvars parameters as applicable for deployment.
- Comment out, or uncomment, configuration for custom domain name, and database & scheduler add-ons in main.tf as applicable for deployment.
- Run
terraform init
. This step only required for first run or otherwise if the heroku provider is not installed. - Apply the configuration:
terraform plan
terraform apply
- Provide for remote state file storage, most likely in S3.
- Implement tests.
This is open-sourced software licensed under the MIT license.