-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.tf
More file actions
63 lines (55 loc) · 2.22 KB
/
main.tf
File metadata and controls
63 lines (55 loc) · 2.22 KB
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
##############################################################################
# Resource Group
##############################################################################
module "resource_group" {
source = "terraform-ibm-modules/resource-group/ibm"
version = "1.4.7"
# if an existing resource group is not set (null) create a new one using prefix
resource_group_name = var.resource_group == null ? "${var.prefix}-resource-group" : null
existing_resource_group_name = var.resource_group
}
##############################################################################
# COS instance and bucket
##############################################################################
module "cos" {
source = "terraform-ibm-modules/cos/ibm"
version = "10.9.9"
resource_group_id = module.resource_group.resource_group_id
region = var.region
cos_instance_name = "${var.prefix}-cos"
cos_tags = var.resource_tags
bucket_name = "${var.prefix}-bucket"
kms_encryption_enabled = false
}
##############################################################################
# - Activity Tracker Event Routing config:
# - COS bucket AT target
# - AT route to COS bucket target
##############################################################################
locals {
bucket_target_name = "${var.prefix}-cos-at-target"
}
module "activity_tracker" {
source = "../../"
# delete line above and use below syntax to pull module source from HashiCorp when consuming this module
# source = "terraform-ibm-modules/activity-tracker/ibm"
# version = "X.Y.Z" # Replace "X.X.X" with a release version to lock into a specific release
# COS bucket target
cos_targets = [
{
bucket_name = module.cos.bucket_name
endpoint = module.cos.s3_endpoint_direct
instance_id = module.cos.cos_instance_id
target_region = var.region
target_name = local.bucket_target_name
}
]
# Activity Tracker route to COS bucket
activity_tracker_routes = [
{
locations = ["*"]
target_ids = [module.activity_tracker.activity_tracker_targets[local.bucket_target_name].id]
route_name = "${var.prefix}-cos-route"
}
]
}