Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions examples/advanced/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,11 @@

<!-- There is a pre-commit hook that will take the title of each example add include it in the repos main README.md -->
<!-- Add text below should describe exactly what resources are provisioned / configured by the example -->

An end-to-end advanced example that will provision the following:
- A new resource group if one is not passed in.
- A new Cloud Logs instance.
- A new Key Protect instance with a root key.
- A new COS instance and KMS encrypted bucket.
- An Activity Tracker target for the new COS bucket, Cloud Logs instance and Event Streams instance.
- And Activity Tracker route for the above created targets.
4 changes: 3 additions & 1 deletion examples/basic/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ The text below should describe exactly what resources are provisioned / configur

An end-to-end basic example that will provision the following:
- A new resource group if one is not passed in.
- A new standard plan Cloud Object Storage instance using the root level module.
- A new COS instance and bucket.
- An Activity Tracker target for the new COS bucket.
- An Activity Tracker route for the COS bucket target.
58 changes: 21 additions & 37 deletions examples/basic/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,41 +11,27 @@ module "resource_group" {
}

##############################################################################
# Event Streams
# COS instance and bucket
##############################################################################

locals {
topic_name = "${var.prefix}-topic"
}

module "event_streams" {
source = "terraform-ibm-modules/event-streams/ibm"
version = "4.1.7"
es_name = "${var.prefix}-eventsteams"
tags = var.resource_tags
region = var.region
module "cos" {
source = "terraform-ibm-modules/cos/ibm"
version = "10.2.21"
resource_group_id = module.resource_group.resource_group_id
plan = "standard"
topics = [{
name = local.topic_name
partitions = 1
config = {
"cleanup.policy" = "delete"
"retention.ms" = "86400000" # 1 Day
"retention.bytes" = "10485760" # 10 MB
"segment.bytes" = "536870912" # 512 MB
}
}, ]
region = var.region
cos_instance_name = "${var.prefix}-cos"
cos_tags = var.resource_tags
bucket_name = "${var.prefix}-bucket"
}

##############################################################################
# - Activity Tracker Event Routing config:
# - Event Streams AT target
# - AT route event stream target
# - COS bucket AT target
# - AT route to COS bucket target
##############################################################################

locals {
es_target_name = "${var.prefix}-es-at-target"
bucket_target_name = "${var.prefix}-cos-at-target"
}

module "activity_tracker" {
Expand All @@ -54,25 +40,23 @@ module "activity_tracker" {
# 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

# Activity Tracker target
eventstreams_targets = [
# COS bucket target
cos_targets = [
{
instance_id = module.event_streams.id
brokers = [module.event_streams.kafka_brokers_sasl[0]]
topic = local.topic_name
target_region = var.region
target_name = local.es_target_name
service_to_service_enabled = true
skip_atracker_es_iam_auth_policy = false
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 = "${var.prefix}-cos-target"
}
]

# Activity Tracker route
# Activity Tracker route to COS bucket
activity_tracker_routes = [
{
locations = ["*", "global"]
target_ids = [module.activity_tracker.activity_tracker_targets[local.es_target_name].id]
route_name = "${var.prefix}-at-route"
target_ids = [module.activity_tracker.activity_tracker_targets[local.bucket_target_name].id]
route_name = "${var.prefix}-cos-route"
}
]
}
5 changes: 0 additions & 5 deletions examples/basic/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ output "resource_group_id" {
value = module.resource_group.resource_group_id
}

output "event_streams_crn" {
description = "The CRN of the event stream resource instance."
value = module.event_streams.crn
}

output "event_routing_targets" {
value = module.activity_tracker.activity_tracker_targets
description = "The created AT event routing target."
Expand Down
8 changes: 4 additions & 4 deletions ibm_catalog.json
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@
"name": "deploy-arch-ibm-cos",
"description": "Enable this to create an IBM Cloud Object Storage(COS) instance. The buckets to store events will be created by the Activity Tracker Event Routing deployable architecture.",
"id": "68921490-2778-4930-ac6d-bae7be6cd958-global",
"version": "v10.2.1",
"version": "v10.2.21",
"flavors": [
"instance"
],
Expand Down Expand Up @@ -347,7 +347,7 @@
"name": "deploy-arch-ibm-kms",
"description": "Enable when you want to create your own managed keys to encrypt the buckets. Select only if existing KMS instance or Key is not provided. ",
"id": "2cad4789-fa90-4886-9c9e-857081c273ee-global",
"version": "v5.1.19",
"version": "v5.1.27",
"flavors": [
"fully-configurable"
],
Expand Down Expand Up @@ -383,7 +383,7 @@
"fully-configurable"
],
"id": "63d8ae58-fbf3-41ce-b844-0fb5b85882ab-global",
"version": "v1.6.11",
"version": "v1.6.28",
"optional": true,
"on_by_default": true,
"input_mapping": [
Expand Down Expand Up @@ -411,7 +411,7 @@
"name": "deploy-arch-ibm-cloud-monitoring",
"description": "Configure IBM Cloud Monitoring to collect the platform metrics.",
"id": "73debdbf-894f-4c14-81c7-5ece3a70b67d-global",
"version": "v1.6.4",
"version": "v1.7.2",
"flavors": [
"fully-configurable"
],
Expand Down
47 changes: 16 additions & 31 deletions tests/pr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,14 @@ import (
"github.com/terraform-ibm-modules/ibmcloud-terratest-wrapper/testschematic"
)

// Use existing resource group
/*
Global variables
*/
const resourceGroup = "geretain-test-resources"
const yamlLocation = "../common-dev-assets/common-go-assets/common-permanent-resources.yaml"
const fullyConfigurableTerraformDir = "solutions/fully-configurable"
const AccountSettingsDADir = "solutions/event-routing-account-settings"
const terraformVersion = "terraform_v1.10" // This should match the version in the ibm_catalog.json

// Removed "in-che" from validRegions since it isn’t supported under the Standard plan of Event Streams.
var validRegions = []string{
Expand All @@ -44,7 +47,6 @@ var validRegions = []string{
var IgnoreUpdates = []string{
"module.account_routing_settings.ibm_atracker_settings.atracker_settings[0]",
}

var permanentResources map[string]interface{}

func TestMain(m *testing.M) {
Expand All @@ -59,7 +61,7 @@ func TestMain(m *testing.M) {
os.Exit(m.Run())
}

func setupexistingOptions(t *testing.T, cloudLogsPrefix string) (preReqTfOptions *terraform.Options, err error) {
func setupExistingOptions(t *testing.T, cloudLogsPrefix string) (preReqTfOptions *terraform.Options, err error) {

realTerraformDir := "./resources"
tempTerraformDir, tempCopyErr := files.CopyTerraformFolderToTemp(realTerraformDir, cloudLogsPrefix)
Expand Down Expand Up @@ -109,11 +111,12 @@ func TestFullyConfigurableInSchematics(t *testing.T) {
Tags: []string{"test-schematic"},
DeleteWorkspaceOnFail: false,
WaitJobCompleteMinutes: 60,
TerraformVersion: terraformVersion,
})

cloudLogsPrefix := fmt.Sprintf("cloud-logs-%s", strings.ToLower(random.UniqueId()))

existingTerraformOptions, err := setupexistingOptions(t, cloudLogsPrefix)
existingTerraformOptions, err := setupExistingOptions(t, cloudLogsPrefix)

if err != nil {
assert.True(t, err == nil, "cloud logs instance creation failed")
Expand Down Expand Up @@ -162,16 +165,18 @@ func TestFullyConfigurableUpgradeInSchematics(t *testing.T) {
"*.tf",
fullyConfigurableTerraformDir + "/*.tf",
},
ResourceGroup: resourceGroup,
TemplateFolder: fullyConfigurableTerraformDir,
Tags: []string{"test-schematic"},
DeleteWorkspaceOnFail: false,
WaitJobCompleteMinutes: 60,
ResourceGroup: resourceGroup,
TemplateFolder: fullyConfigurableTerraformDir,
Tags: []string{"test-schematic"},
DeleteWorkspaceOnFail: false,
WaitJobCompleteMinutes: 60,
CheckApplyResultForUpgrade: true,
TerraformVersion: terraformVersion,
})

cloudLogsPrefix := fmt.Sprintf("cloud-logs-%s", strings.ToLower(random.UniqueId()))

existingTerraformOptions, err := setupexistingOptions(t, cloudLogsPrefix)
existingTerraformOptions, err := setupExistingOptions(t, cloudLogsPrefix)

if err != nil {
assert.True(t, err == nil, "cloud logs instance creation failed")
Expand Down Expand Up @@ -237,6 +242,7 @@ func TestRunAccountSettings(t *testing.T) {
Tags: []string{"er-da-test"},
DeleteWorkspaceOnFail: false,
WaitJobCompleteMinutes: 60,
TerraformVersion: terraformVersion,
IgnoreUpdates: testhelper.Exemptions{ // Ignore for consistency check
List: IgnoreUpdates,
},
Expand Down Expand Up @@ -274,24 +280,3 @@ func TestActivityTrackerDefaultConfiguration(t *testing.T) {
err := options.RunAddonTest()
require.NoError(t, err)
}

func TestActivityTrackerDependencyPermutations(t *testing.T) {
t.Skip("Skipping dependency permutations until the test is fixed")
t.Parallel()
options := testaddons.TestAddonsOptionsDefault(&testaddons.TestAddonOptions{
Testing: t,
Prefix: "act-per",
AddonConfig: cloudinfo.AddonConfig{
OfferingName: "deploy-arch-ibm-activity-tracker",
OfferingFlavor: "fully-configurable",
Inputs: map[string]interface{}{
"prefix": "act-per",
"region": validRegions[rand.Intn(len(validRegions))],
"existing_resource_group_name": resourceGroup,
},
},
})

err := options.RunAddonPermutationTest()
assert.NoError(t, err, "Dependency permutation test should not fail")
}