-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathhelper.tf
66 lines (62 loc) · 2.49 KB
/
helper.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
locals {
tfvars_platform = templatefile("${path.module}/templates/platform.tfvars.hcl", {
prefix = var.prefix,
external_domain = var.external_domain,
region = var.region,
dc_name = var.dc_name
shared_credentials_file = var.shared_credentials_file
profile = var.awsprofile
use_le_staging = var.use_le_staging
alb_dns = aws_lb.hashicorp_alb.dns_name
enable_nomad = var.enable_nomad
})
backend_tf_platform = templatefile("${path.module}/templates/backend.hcl", {
key = "platform"
bucket_name = var.tfstate_bucket_name
region = var.tfstate_region
table_name = var.tfstate_table_name
})
tfvars_appsupport = templatefile("${path.module}/templates/appsupport.tfvars.hcl", {
prefix = var.prefix,
external_domain = var.external_domain,
region = var.region
dc_name = var.dc_name
use_le_staging = var.use_le_staging
jenkins_volume_id = lookup(local.volumes_name_to_id, "jenkins", "")
})
backend_tf_appsupport = templatefile("${path.module}/templates/backend.hcl", {
key = "appsupport"
bucket_name = var.tfstate_bucket_name
region = var.tfstate_region
table_name = var.tfstate_table_name
})
tfvars_workload = templatefile("${path.module}/templates/workload.tfvars.hcl", {
prefix = var.prefix,
external_domain = var.external_domain,
region = var.region
dc_name = var.dc_name
use_le_staging = var.use_le_staging
})
backend_tf_workload = templatefile("${path.module}/templates/backend.hcl", {
key = "workload"
bucket_name = var.tfstate_bucket_name
region = var.tfstate_region
table_name = var.tfstate_table_name
})
}
resource "local_file" "tfvars_platform" {
filename = "${path.module}/../caravan-platform/${var.prefix}-aws.tfvars"
content = local.tfvars_platform
}
resource "local_file" "backend_tf_platform" {
filename = "${path.module}/../caravan-platform/${var.prefix}-aws-backend.tf.bak"
content = local.backend_tf_platform
}
resource "local_file" "tfvars_appsupport" {
filename = "${path.module}/../caravan-application-support/${var.prefix}-aws.tfvars"
content = local.tfvars_appsupport
}
resource "local_file" "backend_tf_appsupport" {
filename = "${path.module}/../caravan-application-support/${var.prefix}-aws-backend.tf.bak"
content = local.backend_tf_appsupport
}