-
Notifications
You must be signed in to change notification settings - Fork 0
/
infra.tf
56 lines (46 loc) · 1.02 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
terraform {
backend "s3" {
bucket = "my-sites-terraform-remote-state"
key = "nc-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"
}
}
resource "random_password" "secret_key" {
length = 48
special = false
}
data "external" "git_describe" {
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 = "nc"
container = "jdevries3133/nc:${data.external.git_describe.result.output}"
domain = "nc.jackdevries.com"
extra_env = {
SESSION_SECRET = random_password.secret_key.result
}
}