-
Notifications
You must be signed in to change notification settings - Fork 19
/
main.tf
70 lines (61 loc) · 1.66 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
resource "random_string" "namespace" {
length = 2
special = false
number = false
upper = false
}
resource "random_string" "s3_name" {
length = 6
special = false
number = false
upper = false
}
resource "random_string" "bucket_name" {
length = 10
special = false
number = false
upper = false
}
module "terraform_state_backend" {
source = "cloudposse/tfstate-backend/aws"
version = "0.38.1"
namespace = random_string.namespace.result
stage = var.backend_stage
name = random_string.s3_name.result
s3_bucket_name = random_string.bucket_name.result
attributes = ["state"]
terraform_backend_config_file_path = "."
terraform_backend_config_file_name = "backend.tf"
force_destroy = var.backend_destroy
depends_on = [
null_resource.backend
]
}
resource "null_resource" "backend" {
triggers = {
backend_destroy = var.backend_destroy
}
lifecycle {
prevent_destroy = true
}
}
module "google_cloud" {
source = "./modules/gcp"
gcp_project_id = var.gcp_project_id
project_region = var.gcp_project_region
instance_name = var.gcp_instance_name
permissions = var.gcp_storage_permissions
depends_on = [
module.terraform_state_backend.dynamodb_table_name,
module.terraform_state_backend.dynamodb_table_id,
module.terraform_state_backend.terraform_backend_config
]
}
module "aws" {
source = "./modules/aws"
ec2_enable = var.ec2_aws
rds_enable = var.rds_aws
}
// module "azure" {
// source = "./modules/azure"
// }