This resource manages an SSL certificate for a Heroku app.
# Create a new Heroku app
resource "heroku_app" "default" {
name = "test-app"
region = "us"
}
# Add-on SSL to application
resource "heroku_addon" "ssl" {
app_id = heroku_app.default.id
plan = "ssl"
}
# Establish certificate for a given application
resource "heroku_cert" "ssl_certificate" {
app = heroku_app.default.id
certificate_chain = file("server.crt")
private_key = file("server.key")
depends_on = ["heroku_addon.ssl"]
}
The following arguments are supported:
app
- (Required) Heroku app ID (do not use app name)certificate_chain
- (Required) The certificate chain to addprivate_key
- (Required) The private key for a given certificate chainThe following attributes are exported:
id
- The ID of the add-oncname
- The CNAME for the SSL endpointname
- The name of the SSL certificateWhen importing a Heroku cert resource, the ID must be built using the app name colon the unique ID from the Heroku API. For an app named production-api
with a certificate ID of b85d9224-310b-409b-891e-c903f5a40568
, you would import it as:
$ terraform import heroku_cert.production_api production-api:b85d9224-310b-409b-891e-c903f5a40568