-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathterragrunt.hcl
56 lines (51 loc) · 1.32 KB
/
terragrunt.hcl
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
# Generates the backend for all modules.
remote_state {
backend = "s3"
config = {
encrypt = true
key = "keycloak/${path_relative_to_include()}/terraform.tfstate"
region = "eu-west-1"
bucket = "mytaxi-terraform-states"
dynamodb_table = "terraform-lock"
}
}
# Read the local "env.yaml" in every environment.
locals {
vars = yamldecode(file("${path_relative_to_include()}/env.yaml"))
environment = local.vars.environment
url = local.vars.url
client_id = local.vars.terraform-client-id
client_secret = local.vars.terraform-client-secret
}
# Generate the "provider.tf" file for every module.
generate "provider" {
path = "provider.tf"
if_exists = "overwrite"
contents = <<EOF
terraform {
required_providers {
keycloak = {
source = "mrparkers/keycloak"
version = "4.4.0"
}
}
}
provider "keycloak" {
client_id = "${local.terraform-client-id}"
client_secret = "${local.terraform-client-secret}"
url = "${local.url}"
client_id = "${local.terraform-client-id}"
client_secret = "${local.terraform-client-secret}"
}
EOF
}
# Generate the "backend.tf" file for every module.
generate "backend" {
path = "backend.tf"
if_exists = "overwrite"
contents = <<EOF
terraform {
backend "s3" {}
}
EOF
}