-
Notifications
You must be signed in to change notification settings - Fork 0
/
infra.tf
80 lines (67 loc) · 1.63 KB
/
infra.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
terraform {
backend "s3" {
bucket = "my-sites-terraform-remote-state"
key = "calcount-state"
region = "us-east-2"
}
required_providers {
kubernetes = {
source = "hashicorp/kubernetes"
version = ">= 2.7.1"
}
helm = {
source = "hashicorp/helm"
version = ">= 2.4.1"
}
}
}
provider "kubernetes" {
config_path = "~/.kube/config"
}
provider "helm" {
kubernetes {
config_path = "~/.kube/config"
}
}
variable "openai_api_key" {
type = string
sensitive = true
}
variable "stripe_api_key" {
type = string
sensitive = true
}
variable "stripe_webhook_signing_secret" {
type = string
sensitive = true
}
variable "smtp_email_password" {
type = string
sensitive = true
}
resource "random_password" "secret_key" {
length = 48
special = false
}
data "external" "git_sha" {
program = [
"sh",
"-c",
"echo '{\"output\": \"'\"$(if [[ ! -z $GITLAB_SHA ]]; then echo $GITLAB_SHA; else git rev-parse HEAD; fi)\"'\"}'"
]
}
module "basic-deployment" {
source = "jdevries3133/basic-deployment/kubernetes"
version = "3.0.2"
app_name = "calcount"
container = "jdevries3133/calcount:${data.external.git_sha.result.output}"
domain = "beancount.bot"
extra_env = {
SESSION_SECRET = random_password.secret_key.result
OPENAI_API_KEY = var.openai_api_key
STRIPE_API_KEY = var.stripe_api_key
STRIPE_WEBHOOK_SIGNING_SECRET = var.stripe_webhook_signing_secret
SMTP_EMAIL_USERNAME = "jdevries3133@gmail.com"
SMTP_EMAIL_PASSWORD = var.smtp_email_password
}
}