This repository was archived by the owner on Apr 24, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.tf
75 lines (63 loc) · 2.03 KB
/
main.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
/**
* This module provides a layer of abstraction to accessing shared resources. It does not itself create any resources or maintain any state, it simply reads the state files of various shared resources. The goal is to hide some of the uglier, repetitive config blocks behind a clean interface.
*
* When you add a new shared resource, you will also need to update this module with whatever outputs you want to provide access to.
*/
locals {
environment = var.workspace != "" ? lower(var.workspace) : lower(terraform.workspace)
}
data "terraform_remote_state" "global" {
backend = "s3"
workspace = "global"
config = {
region = "us-east-1"
bucket = "mit-tfstates-state"
key = "global/global.tfstate"
dynamodb_table = "mit-tfstates-state-lock"
encrypt = true
}
}
data "terraform_remote_state" "network" {
backend = "s3"
workspace = local.environment
config = {
region = "us-east-1"
bucket = "mit-tfstates-state"
key = "network/terraform.tfstate"
dynamodb_table = "mit-tfstates-state-lock"
encrypt = true
}
}
data "terraform_remote_state" "es" {
backend = "s3"
workspace = local.environment
config = {
region = "us-east-1"
bucket = "mit-tfstates-state"
key = "elasticsearch/terraform.tfstate"
dynamodb_table = "mit-tfstates-state-lock"
encrypt = true
}
}
data "terraform_remote_state" "deploy" {
backend = "s3"
workspace = local.environment
config = {
region = "us-east-1"
bucket = "mit-tfstates-state"
key = "deploy/terraform.tfstate"
dynamodb_table = "mit-tfstates-state-lock"
encrypt = true
}
}
data "terraform_remote_state" "bastion" {
backend = "s3"
workspace = local.environment
config = {
region = "us-east-1"
bucket = "mit-tfstates-state"
key = "bastion/terraform.tfstate"
dynamodb_table = "mit-tfstates-state-lock"
encrypt = true
}
}