Skip to content

Commit 446bab3

Browse files
authored
feat: added new variables: enable_at_event_routing_to_cos_bucket (defaulting to true) and enable_at_event_routing_to_log_analysis (defaulting to false) (#56)
1 parent 5ac2890 commit 446bab3

File tree

7 files changed

+68
-28
lines changed

7 files changed

+68
-28
lines changed

ibm_catalog.json

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@
3939
"title": "Configures Cloud Monitoring. instance and agents."
4040
},
4141
{
42-
"description": "Configures Activity Tracker routing",
43-
"title": "Configures an Activity Tracker route with a COS bucket target."
42+
"description": "Configures Activity Tracker event routing to a COS bucket and Log Analysis instance.",
43+
"title": "Configures an Activity Tracker event routing"
4444
}
4545
],
4646
"flavors": [
@@ -211,6 +211,12 @@
211211
{
212212
"key": "enable_platform_logs"
213213
},
214+
{
215+
"key": "enable_at_event_routing_to_log_analysis"
216+
},
217+
{
218+
"key": "enable_at_event_routing_to_cos_bucket"
219+
},
214220
{
215221
"key": "cloud_monitoring_instance_name"
216222
},
@@ -387,7 +393,7 @@
387393
}
388394
],
389395
"architecture": {
390-
"descriptions": "This architecture supports deployment of Log Analysis and Cloud Monitoring instances on IBM Cloud and Activity Tracker event routing to a COS bucket target.",
396+
"descriptions": "This architecture supports the deployment of Log Analysis and Cloud Monitoring instances on IBM Cloud. It also supports configuring the Activity Tracker event routing.",
391397
"features": [
392398
{
393399
"title": "Creates the Log Analysis instance.",
@@ -406,8 +412,8 @@
406412
"description": "Creates and configures the COS bucket with archiving and expiration enabled."
407413
},
408414
{
409-
"title": "Creates an Activity Tracker event route and COS target.",
410-
"description": "Creates and configures the Activity Tracker event routing and COS target."
415+
"title": "Support Configuring the Activity Tracker event routing.",
416+
"description": "Supports configuring the Activity Tracker event routing to a COS bucket and to a Log Analysis instance."
411417
}
412418
],
413419
"diagrams": [
@@ -417,7 +423,7 @@
417423
"url": "https://raw.githubusercontent.com/terraform-ibm-modules/terraform-ibm-observability-da/main/reference-architecture/deployable-architecture-observability-instances.svg",
418424
"type": "image/svg+xml"
419425
},
420-
"description": "This architecture supports creating and configuring IBM Cloud Observability instances and Activity Tracker event routing to a COS target."
426+
"description": "This architecture supports creating and configuring IBM Cloud Observability instances and Activity Tracker event routing to a COS bucket and to a Log Analysis instance."
421427
}
422428
]
423429
}

reference-architecture/deployable-architecture-observability-instances.svg

Lines changed: 2 additions & 1 deletion
Loading

solutions/instances/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ This architecture creates the observability instances on IBM Cloud and supports
99
- Supports creating KMS root keys in an existing KMS instance or using existing keys if creating new buckets.
1010
- Creates a KMS encrypted COS bucket that is required to store archived logs or using an existing bucket.
1111
- Creates a KMS encrypted COS bucket for setting up Activity Tracker event routing or using an existing bucket.
12-
- Creates the Activity Tracker event route to a COS target.
12+
- Supports configuring the Activity Tracker event routing to the Cloud Object Storage (COS) bucket and to the Log Analysis instance .
1313

1414
![observability-instances-deployable-architecture](../../reference-architecture/deployable-architecture-observability-instances.svg)
1515

solutions/instances/main.tf

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,20 @@ locals {
5757
) : null
5858

5959
kms_region = (length(local.bucket_config_map) != 0) ? (var.existing_cos_kms_key_crn == null ? element(split(":", var.existing_kms_instance_crn), length(split(":", var.existing_kms_instance_crn)) - 5) : null) : null
60+
at_cos_route = var.enable_at_event_routing_to_cos_bucket ? [{
61+
route_name = "at-cos-route"
62+
locations = ["*", "global"]
63+
target_ids = [module.observability_instance.activity_tracker_targets["cos-target"].id]
64+
}] : []
65+
66+
at_log_analysis_route = var.enable_at_event_routing_to_log_analysis ? [{
67+
route_name = "at-log-analysis-route"
68+
locations = ["*", "global"]
69+
target_ids = [module.observability_instance.activity_tracker_targets["log-analysis-target"].id]
70+
}] : []
71+
72+
at_routes = concat(local.at_cos_route, local.at_log_analysis_route)
73+
6074
}
6175

6276
#######################################################################################################################
@@ -105,7 +119,7 @@ module "observability_instance" {
105119

106120
# Activity Tracker
107121
activity_tracker_provision = false
108-
cos_targets = [
122+
cos_targets = var.enable_at_event_routing_to_cos_bucket ? [
109123
{
110124
bucket_name = local.cos_target_bucket_name
111125
endpoint = local.cos_target_bucket_endpoint
@@ -115,18 +129,20 @@ module "observability_instance" {
115129
skip_atracker_cos_iam_auth_policy = false
116130
service_to_service_enabled = true
117131
}
118-
]
132+
] : []
119133

120-
# Routes
121-
activity_tracker_routes = [
134+
log_analysis_targets = var.enable_at_event_routing_to_log_analysis ? [
122135
{
123-
route_name = "at-route"
124-
locations = ["*", "global"]
125-
target_ids = [
126-
module.observability_instance.activity_tracker_targets["cos-target"].id
127-
]
136+
instance_id = module.observability_instance.log_analysis_crn
137+
ingestion_key = module.observability_instance.log_analysis_ingestion_key
138+
target_region = var.region
139+
target_name = "log-analysis-target"
128140
}
129-
]
141+
] : []
142+
143+
# Routes
144+
activity_tracker_routes = local.at_routes
145+
130146
}
131147

132148
#######################################################################################################################

solutions/instances/outputs.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ output "at_cos_target_bucket_name" {
7979
}
8080

8181
## Activity Tracker
82-
output "at_cos_targets" {
82+
output "at_targets" {
8383
value = module.observability_instance.activity_tracker_targets
8484
description = "The map of created activity_tracker targets"
8585
}

solutions/instances/variables.tf

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,21 @@ variable "enable_platform_logs" {
9191
description = "Receive platform logs in the provisioned IBM Cloud Logging instance."
9292
default = true
9393
}
94+
##############################################################################
95+
# Activity Tracker Event Routing Variables
96+
##############################################################################
97+
98+
variable "enable_at_event_routing_to_cos_bucket" {
99+
type = bool
100+
description = "Set to true to enable activity tracker event routing to the Cloud Object Storage (COS) bucket."
101+
default = true
102+
}
103+
104+
variable "enable_at_event_routing_to_log_analysis" {
105+
type = bool
106+
description = "Set to true to enable activity tracker event routing to the provisioned IBM Cloud Logging instance."
107+
default = false
108+
}
94109

95110
##############################################################################
96111
# Cloud Monitoring Variables

tests/pr_test.go

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ func TestInstancesInSchematics(t *testing.T) {
9090
{Name: "archive_bucket_access_tags", Value: permanentResources["accessTags"], DataType: "list(string)"},
9191
{Name: "at_cos_bucket_access_tags", Value: permanentResources["accessTags"], DataType: "list(string)"},
9292
{Name: "prefix", Value: options.Prefix, DataType: "string"},
93+
{Name: "enable_at_event_routing_to_log_analysis", Value: true, DataType: "bool"},
9394
}
9495

9596
err := options.RunSchematicTest()
@@ -107,15 +108,16 @@ func TestRunUpgradeSolutionInstances(t *testing.T) {
107108
})
108109

109110
options.TerraformVars = map[string]interface{}{
110-
"resource_group_name": options.Prefix,
111-
"cos_instance_access_tags": permanentResources["accessTags"],
112-
"existing_kms_instance_crn": permanentResources["hpcs_south_crn"],
113-
"kms_endpoint_type": "public",
114-
"management_endpoint_type_for_bucket": "public",
115-
"log_analysis_service_endpoints": "public-and-private",
116-
"cloud_monitoring_service_endpoints": "public",
117-
"enable_platform_logs": "false",
118-
"enable_platform_metrics": "false",
111+
"resource_group_name": options.Prefix,
112+
"cos_instance_access_tags": permanentResources["accessTags"],
113+
"existing_kms_instance_crn": permanentResources["hpcs_south_crn"],
114+
"kms_endpoint_type": "public",
115+
"management_endpoint_type_for_bucket": "public",
116+
"log_analysis_service_endpoints": "public-and-private",
117+
"cloud_monitoring_service_endpoints": "public",
118+
"enable_platform_logs": "false",
119+
"enable_platform_metrics": "false",
120+
"enable_at_event_routing_to_log_analysis": "true",
119121
}
120122

121123
output, err := options.RunTestUpgrade()

0 commit comments

Comments
 (0)