» Heroku Provider
This provider is used to interact with the resources supported by the Heroku Platform API. The provider needs to be configured with the proper credentials before it can be used.
» Background
Heroku's fully-managed platform gives you the simplest path to delivering apps quickly:
» Contributing
Development happens in the GitHub repo:
» Example Usage
# Configure the Heroku provider
provider "heroku" {
email = "ops@company.com"
api_key = "${var.heroku_api_key}"
}
# Create a new application
resource "heroku_app" "default" {
# ...
}
» Authentication
The Heroku provider offers a flexible means of providing credentials for authentication. The following methods are supported, listed in order precedence, and explained below:
- Static credentials
- Environment variables
- Netrc
» Static credentials
Static credentials can be provided by adding an email
and api_key
in-line
in the Heroku provider block:
provider "heroku" {
email = "ops@company.com"
api_key = "${var.heroku_api_key}"
}
» Environment variables
You can provide your credentials via the HEROKU_EMAIL
and HEROKU_API_KEY
environment variables, representing your Heroku email address and Heroku api
key, respectively.
provider "heroku" {}
Usage:
$ export HEROKU_EMAIL="ops@company.com"
$ export HEROKU_API_KEY="heroku_api_key"
$ terraform plan
» Netrc
You can provider your credentials via a .netrc
file in your home directory.
This file should be in the following format:
machine api.heroku.com
login <your_heroku_email>
password <your_heroku_api_key>
For more information about netrc, please refer to https://ec.haxx.se/usingcurl-netrc.html
» Argument Reference
The following arguments are supported:
-
api_key
- (Required) Heroku API token. It must be provided, but it can also be sourced from theHEROKU_API_KEY
environment variable. -
email
- (Required) Email to be notified by Heroku. It must be provided, but it can also be sourced from theHEROKU_EMAIL
environment variable. -
headers
- (Optional) Additional Headers to be sent to Heroku. If not provided, it can also be sourced from theHEROKU_HEADERS
environment variable. -
delays
- (Optional) Adelays
block (documented below). Only onedelays
block may be in the configuration. Delays help mitigate issues with eventual consistency in the Heroku back-end service.
The nested delays
block supports the following:
-
post_app_create_delay
- (Optional) The number of seconds to wait after an app is created. Default is to wait 5 seconds. -
post_space_create_delay
- (Optional) The number of seconds to wait after a private space is created. Default is to wait 5 seconds. -
post_domain_create_delay
- (Optional) The number of seconds to wait after a domain is created. Default is to wait 5 seconds.