Skip to content

Commit 09255b6

Browse files
Vipin KumarVipin Kumar
authored andcommitted
addressed review comments
1 parent a157fe9 commit 09255b6

File tree

7 files changed

+1109
-14
lines changed

7 files changed

+1109
-14
lines changed

ibm_catalog.json

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@
1818
"observability",
1919
"ATracker"
2020
],
21-
"short_description": "Configures IBM Cloud Activity tracker resources",
22-
"long_description": "Solution that support configuring IBM Cloud Observability resources for activity tracking.",
21+
"short_description": "Configures IBM Cloud Activity tracker Event Routing",
22+
"long_description": "This architecture supports creating and configuring [IBM Cloud Activity Tracker Event Routing](https://cloud.ibm.com/docs/atracker?topic=atracker-getting-started) resources. Activity Tracker Event Routing can be used to manage auditing events at the account-level by configuring targets and routes that define where auditing data is routed",
2323
"offering_docs_url": "https://github.com/terraform-ibm-modules/terraform-ibm-activity-tracker/blob/main/README.md",
24-
"offering_icon_url": "https://raw.githubusercontent.com/terraform-ibm-modules/terraform-ibm-activity-tracker/main/images/observability-icon.svg",
24+
"offering_icon_url": "https://raw.githubusercontent.com/terraform-ibm-modules/terraform-ibm-activity-tracker/main/images/activity-tracker-icon.svg",
2525
"provider_name": "IBM",
2626
"features": [
2727
{
@@ -232,6 +232,18 @@
232232
"value": "private"
233233
}
234234
]
235+
},
236+
{
237+
"key": "at_cloud_logs_route_name"
238+
},
239+
{
240+
"key": "at_cos_route_name"
241+
},
242+
{
243+
"key": "cloud_logs_target_name"
244+
},
245+
{
246+
"key": "cos_target_name"
235247
}
236248
],
237249
"dependencies": [

images/activity-tracker-icon.svg

Lines changed: 1001 additions & 0 deletions
Loading

solutions/fully-configurable/main.tf

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ locals {
3131

3232
cos_target_bucket_name = var.existing_at_cos_target_bucket_name != null ? var.existing_at_cos_target_bucket_name : var.enable_at_event_routing_to_cos_bucket ? module.cos_bucket[0].buckets[local.at_cos_target_bucket_name].bucket_name : null
3333
cos_target_bucket_endpoint = var.existing_at_cos_target_bucket_endpoint != null ? var.existing_at_cos_target_bucket_endpoint : var.enable_at_event_routing_to_cos_bucket ? module.cos_bucket[0].buckets[local.at_cos_target_bucket_name].s3_endpoint_private : null
34-
cos_target_name = try("${local.prefix}-cos-target", "cos-target")
35-
cloud_logs_target_name = try("${local.prefix}-cloud-logs-target", "cloud-logs-target")
36-
at_cos_route_name = try("${local.prefix}-at-cos-route", "at-cos-route")
37-
at_cloud_logs_route_name = try("${local.prefix}-at-cloud-logs-route", "at-cloud-logs-route")
34+
cos_target_name = var.cos_target_name != null ? var.cos_target_name : try("${local.prefix}-cos-target", "cos-target")
35+
cloud_logs_target_name = var.cloud_logs_target_name != null ? var.cloud_logs_target_name : try("${local.prefix}-cloud-logs-target", "cloud-logs-target")
36+
at_cos_route_name = var.at_cos_route_name != null ? var.at_cos_route_name : try("${local.prefix}-at-cos-route", "at-cos-route")
37+
at_cloud_logs_route_name = var.at_cloud_logs_route_name != null ? var.at_cloud_logs_route_name : try("${local.prefix}-at-cloud-logs-route", "at-cloud-logs-route")
3838

3939

4040

@@ -101,7 +101,6 @@ module "activity_tracker" {
101101
depends_on = [time_sleep.wait_for_atracker_cos_authorization_policy]
102102
source = "../../"
103103

104-
# Activity Tracker
105104
cos_targets = var.enable_at_event_routing_to_cos_bucket ? [
106105
{
107106
bucket_name = local.cos_target_bucket_name

solutions/fully-configurable/outputs.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77

88
output "at_cos_target_bucket_name" {
99
value = var.existing_at_cos_target_bucket_name == null ? var.enable_at_event_routing_to_cos_bucket ? module.cos_bucket[0].buckets[local.at_cos_target_bucket_name].bucket_name : null : var.existing_at_cos_target_bucket_name
10-
description = "The name of the AT target COS bucket"
10+
description = "The name of the Activity Tracker Event Routing cloud object storage target"
1111
}
1212

1313

14-
## Activity Tracker
14+
## Activity Tracker Event Routing
1515
output "at_targets" {
1616
value = module.activity_tracker.activity_tracker_targets
17-
description = "The map of created activity_tracker targets"
17+
description = "The map of created Activity Tracker Event Routing targets"
1818
}
1919

2020
output "at_routes" {

solutions/fully-configurable/variables.tf

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,30 @@ variable "enable_at_event_routing_to_cloud_logs" {
8282
default = true
8383
}
8484

85+
variable "cos_target_name" {
86+
type = string
87+
description = "Name of the cos target for activity tracker event routing."
88+
default = null
89+
}
90+
91+
variable "cloud_logs_target_name" {
92+
type = string
93+
description = "Name of the cloud logs target for activity tracker event routing."
94+
default = null
95+
}
96+
97+
variable "at_cos_route_name" {
98+
type = string
99+
description = "Name of the cos route for activity tracker event routing."
100+
default = null
101+
}
102+
103+
variable "at_cloud_logs_route_name" {
104+
type = string
105+
description = "Name of the cloud logs route for activity tracker event routing."
106+
default = null
107+
}
108+
85109

86110
########################################################################################################################
87111
# COS variables

tests/other_test.go

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,58 @@
1-
// Tests in this file are NOT run in the PR pipeline. They are run in the continuous testing pipeline along with the ones in pr_test.go
21
package test
2+
3+
import (
4+
"math/rand"
5+
"testing"
6+
7+
"github.com/stretchr/testify/assert"
8+
"github.com/terraform-ibm-modules/ibmcloud-terratest-wrapper/testhelper"
9+
)
10+
11+
// Ensure every example directory has a corresponding test
12+
const advancedExampleDir = "examples/advanced"
13+
const basicExampleDir = "examples/basic"
14+
15+
var validRegions = []string{
16+
"au-syd",
17+
"br-sao",
18+
"ca-tor",
19+
"eu-de",
20+
"eu-gb",
21+
"eu-es",
22+
"jp-osa",
23+
"jp-tok",
24+
"us-south",
25+
"us-east",
26+
}
27+
28+
func setupOptions(t *testing.T, prefix string, dir string) *testhelper.TestOptions {
29+
options := testhelper.TestOptionsDefaultWithVars(&testhelper.TestOptions{
30+
Testing: t,
31+
TerraformDir: dir,
32+
Prefix: prefix,
33+
ResourceGroup: resourceGroup,
34+
Region: validRegions[rand.Intn(len(validRegions))],
35+
})
36+
return options
37+
}
38+
39+
// Consistency test for the basic example
40+
func TestRunBasicExample(t *testing.T) {
41+
t.Parallel()
42+
43+
options := setupOptions(t, "at-basic", basicExampleDir)
44+
45+
output, err := options.RunTestConsistency()
46+
assert.Nil(t, err, "This should not have errored")
47+
assert.NotNil(t, output, "Expected some output")
48+
}
49+
50+
func TestRunAdvancedExample(t *testing.T) {
51+
t.Parallel()
52+
53+
options := setupOptions(t, "at-adv", advancedExampleDir)
54+
55+
output, err := options.RunTestConsistency()
56+
assert.Nil(t, err, "This should not have errored")
57+
assert.NotNil(t, output, "Expected some output")
58+
}

tests/pr_test.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package test
33

44
import (
55
"log"
6+
"math/rand"
67
"os"
78
"testing"
89

@@ -30,7 +31,7 @@ func TestMain(m *testing.M) {
3031
os.Exit(m.Run())
3132
}
3233

33-
func TestFullyConfigurableActivityTrackerInSchematics(t *testing.T) {
34+
func TestFullyConfigurableInSchematics(t *testing.T) {
3435
t.Parallel()
3536

3637
options := testschematic.TestSchematicOptionsDefault(&testschematic.TestSchematicOptions{
@@ -54,13 +55,14 @@ func TestFullyConfigurableActivityTrackerInSchematics(t *testing.T) {
5455
{Name: "existing_cos_instance_crn", Value: permanentResources["general_test_storage_cos_instance_crn"], DataType: "string"},
5556
{Name: "kms_encryption_enabled_buckets", Value: true, DataType: "bool"},
5657
{Name: "prefix", Value: options.Prefix, DataType: "string"},
58+
{Name: "region", Value: validRegions[rand.Intn(len(validRegions))], DataType: "string"},
5759
}
5860

5961
err := options.RunSchematicTest()
6062
assert.Nil(t, err, "This should not have errored")
6163
}
6264

63-
func TestFullyConfigurableActivityTrackerUpgradeInSchematics(t *testing.T) {
65+
func TestFullyConfigurableUpgradeInSchematics(t *testing.T) {
6466
t.Parallel()
6567

6668
options := testschematic.TestSchematicOptionsDefault(&testschematic.TestSchematicOptions{
@@ -84,6 +86,7 @@ func TestFullyConfigurableActivityTrackerUpgradeInSchematics(t *testing.T) {
8486
{Name: "existing_cos_instance_crn", Value: permanentResources["general_test_storage_cos_instance_crn"], DataType: "string"},
8587
{Name: "kms_encryption_enabled_buckets", Value: true, DataType: "bool"},
8688
{Name: "prefix", Value: options.Prefix, DataType: "string"},
89+
{Name: "region", Value: validRegions[rand.Intn(len(validRegions))], DataType: "string"},
8790
}
8891

8992
err := options.RunSchematicUpgradeTest()

0 commit comments

Comments
 (0)