forked from hashicorp-education/learn-terraform-heroku
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.tf
53 lines (43 loc) · 1.18 KB
/
main.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0
provider "heroku" {
api_key = var.heroku_api_key # Securely fetch Heroku API key from variable
email = var.heroku_email # Securely fetch Heroku email from variable
}
# Define Heroku API key variable
variable "heroku_api_key" {
type = string
sensitive = true
description = "The API key for authenticating with Heroku"
}
# Define Heroku email variable
variable "heroku_email" {
type = string
description = "The email associated with the Heroku account"
}
resource "heroku_app" "example" {
name = "learn-terraform-heroku"
region = "us"
}
resource "heroku_addon" "postgres" {
app = heroku_app.example.id
plan = "heroku-postgresql:essential-0"
}
resource "heroku_build" "example" {
app = heroku_app.example.id
source {
path = "./app"
}
}
variable "app_quantity" {
default = 1
description = "Number of dynos in your Heroku formation"
}
# Launch the app's web process by scaling-up
resource "heroku_formation" "example" {
app = heroku_app.example.id
type = "web"
quantity = var.app_quantity
size = "Standard-1x"
depends_on = [heroku_build.example]
}