-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathheroku.tf
More file actions
73 lines (65 loc) · 1.73 KB
/
Copy pathheroku.tf
File metadata and controls
73 lines (65 loc) · 1.73 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
provider "heroku" {
version = "~> 2.0"
}
variable "app_name" {
description = "Name of the Heroku app provisioned"
}
variable "app_region" {
description = "Region the app is provisioned in"
}
resource "heroku_app" "staging" {
name = "${var.app_name}-test"
region = var.app_region
buildpacks = [
"heroku/python",
]
config_vars = {
ENVIRONMENT = "staging"
}
}
# Create a redis addon-on and configure the app to use it
resource "heroku_addon" "redis-staging" {
app = heroku_app.staging.name
plan = "heroku-redis:hobby-dev"
}
# Create a postgresql addon-on and configure the app to use it
resource "heroku_addon" "postgresql-staging" {
app = heroku_app.staging.name
plan = "heroku-postgresql:hobby-dev"
}
resource "heroku_app" "production" {
name = "${var.app_name}-live"
region = var.app_region
buildpacks = [
"heroku/python",
]
config_vars = {
ENVIRONMENT = "production"
}
}
# Create a redis, and configure the app to use it
resource "heroku_addon" "redis-live" {
app = heroku_app.production.name
plan = "heroku-redis:premium-0"
}
# Create a postgresql, and configure the app to use it
resource "heroku_addon" "postgresql-live" {
app = heroku_app.production.name
plan = "heroku-postgresql:hobby-basic"
}
# Create a Heroku pipeline
resource "heroku_pipeline" "pipeline" {
name = var.app_name
}
# Couple apps staging app to the pipeline
resource "heroku_pipeline_coupling" "staging" {
app = heroku_app.staging.name
pipeline = heroku_pipeline.pipeline.id
stage = "staging"
}
# Couple apps production app to the pipeline
resource "heroku_pipeline_coupling" "production" {
app = heroku_app.production.name
pipeline = heroku_pipeline.pipeline.id
stage = "production"
}