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
14 changes: 7 additions & 7 deletions ibm_catalog.json
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,7 @@
],
"optional": true,
"on_by_default": false,
"version": "v3.0.7"
"version": "v3.0.23"
},
{
"name": "deploy-arch-ibm-kms",
Expand Down Expand Up @@ -609,7 +609,7 @@
],
"optional": true,
"on_by_default": true,
"version": "v5.1.19"
"version": "v5.1.27"
},
{
"name": "deploy-arch-ibm-cos",
Expand Down Expand Up @@ -641,7 +641,7 @@
],
"optional": true,
"on_by_default": true,
"version": "v10.2.1"
"version": "v10.2.21"
},
{
"name": "deploy-arch-ibm-cloud-logs",
Expand All @@ -651,7 +651,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 @@ -686,7 +686,7 @@
"name": "deploy-arch-ibm-cloud-monitoring",
"description": "Sets up a Cloud Monitoring instance 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 Expand Up @@ -725,7 +725,7 @@
"name": "deploy-arch-ibm-activity-tracker",
"description": "Configure Activity Tracker Event Routing to route the auditing events.",
"id": "918453c3-4f97-4583-8c4a-83ef12fc7916-global",
"version": "v1.2.25",
"version": "v1.2.34",
"flavors": [
"fully-configurable"
],
Expand Down Expand Up @@ -759,7 +759,7 @@
"name": "deploy-arch-ibm-scc-workload-protection",
"description": "Configure an IBM Cloud Security and Compliance Center Workload Protection instance to help you manage security and compliance for your organization.",
"id": "4322cf44-2289-49aa-a719-dd79e39b14dc-global",
"version": "v1.11.4",
"version": "v1.12.3",
"flavors": [
"fully-configurable"
],
Expand Down
6 changes: 3 additions & 3 deletions tests/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ go 1.24.0
toolchain go1.25.0

require (
github.com/IBM/go-sdk-core/v5 v5.21.0
github.com/gruntwork-io/terratest v0.50.0
github.com/stretchr/testify v1.11.1
github.com/terraform-ibm-modules/ibmcloud-terratest-wrapper v1.60.3
github.com/terraform-ibm-modules/ibmcloud-terratest-wrapper v1.60.9
)

require (
dario.cat/mergo v1.0.0 // indirect
github.com/IBM-Cloud/bluemix-go v0.0.0-20240719075425-078fcb3a55be // indirect
github.com/IBM-Cloud/power-go-client v1.12.0 // indirect
github.com/IBM/cloud-databases-go-sdk v0.8.0 // indirect
github.com/IBM/go-sdk-core/v5 v5.21.0 // indirect
github.com/IBM/platform-services-go-sdk v0.86.1 // indirect
github.com/IBM/project-go-sdk v0.3.6 // indirect
github.com/IBM/schematics-go-sdk v0.4.0 // indirect
Expand Down Expand Up @@ -93,7 +93,7 @@ require (
golang.org/x/crypto v0.41.0 // indirect
golang.org/x/mod v0.26.0 // indirect
golang.org/x/net v0.42.0 // indirect
golang.org/x/sync v0.16.0 // indirect
golang.org/x/sync v0.17.0 // indirect
golang.org/x/sys v0.35.0 // indirect
golang.org/x/text v0.28.0 // indirect
golang.org/x/tools v0.35.0 // indirect
Expand Down
8 changes: 4 additions & 4 deletions tests/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,8 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
github.com/terraform-ibm-modules/ibmcloud-terratest-wrapper v1.60.3 h1:eR7/W4+SmqfDfeD33ZVmtKrtM+KtcbAbURfjKAnXyic=
github.com/terraform-ibm-modules/ibmcloud-terratest-wrapper v1.60.3/go.mod h1:9Thq3InVLYHEtKIVABm8e1d7jvpIQqlKCJ8/d5wH6DY=
github.com/terraform-ibm-modules/ibmcloud-terratest-wrapper v1.60.9 h1:ntigNnXy4Ut6eVMfBUjQ5yoIZR5Rt419+pwfle4MO5c=
github.com/terraform-ibm-modules/ibmcloud-terratest-wrapper v1.60.9/go.mod h1:YBrRYc+5y5Pr9CXmY35lOqTQdlIjA4x4+3iVObXGOCE=
github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
github.com/tmccombs/hcl2json v0.6.4 h1:/FWnzS9JCuyZ4MNwrG4vMrFrzRgsWEOVi+1AyYUVLGw=
github.com/tmccombs/hcl2json v0.6.4/go.mod h1:+ppKlIW3H5nsAsZddXPy2iMyvld3SHxyjswOZhavRDk=
Expand Down Expand Up @@ -396,8 +396,8 @@ golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sync v0.16.0 h1:ycBJEhp9p4vXvUZNszeOq0kGTPghopOL8q0fq3vstxw=
golang.org/x/sync v0.16.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
golang.org/x/sync v0.17.0 h1:l60nONMj9l5drqw6jlhIELNv9I0A4OFgRsG9k2oT9Ug=
golang.org/x/sync v0.17.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
Expand Down
76 changes: 36 additions & 40 deletions tests/pr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"strings"
"testing"

"github.com/IBM/go-sdk-core/v5/core"
"github.com/gruntwork-io/terratest/modules/files"
"github.com/gruntwork-io/terratest/modules/logger"
"github.com/gruntwork-io/terratest/modules/random"
Expand All @@ -21,6 +22,9 @@ import (
"github.com/terraform-ibm-modules/ibmcloud-terratest-wrapper/testschematic"
)

/*
Global variables
*/
const basicExampleTerraformDir = "examples/basic"
const customSecurityGroupExampleTerraformDir = "examples/custom_security_group"
const defaultExampleTerraformDir = "examples/default"
Expand All @@ -32,9 +36,8 @@ const noprefixExampleTerraformDir = "examples/no-prefix"
const vpcWithDnsExampleTerraformDir = "examples/vpc-with-dns"
const fullyConfigFlavorDir = "solutions/fully-configurable"
const resourceGroup = "geretain-test-resources"

// Define a struct with fields that match the structure of the YAML data
const yamlLocation = "../common-dev-assets/common-go-assets/common-permanent-resources.yaml"
const terraformVersion = "terraform_v1.10" // This should match the version in the ibm_catalog.json

var permanentResources map[string]interface{}

Expand Down Expand Up @@ -198,18 +201,10 @@ func TestRunVpcWithDnsExample(t *testing.T) {
func TestFullyConfigurable(t *testing.T) {
t.Parallel()

// Verify ibmcloud_api_key variable is set
checkVariable := "TF_VAR_ibmcloud_api_key"
val, present := os.LookupEnv(checkVariable)
require.True(t, present, checkVariable+" environment variable not set")
require.NotEqual(t, "", val, checkVariable+" environment variable is empty")

prefix := "vpc-da"

options := testschematic.TestSchematicOptionsDefault(&testschematic.TestSchematicOptions{
Testing: t,
Region: "eu-de",
Prefix: prefix,
Prefix: "vpc-da",
TarIncludePatterns: []string{
"*.tf",
"dynamic_values/*.tf",
Expand All @@ -220,6 +215,7 @@ func TestFullyConfigurable(t *testing.T) {
Tags: []string{"vpc-da-test"},
DeleteWorkspaceOnFail: false,
WaitJobCompleteMinutes: 120,
TerraformVersion: terraformVersion,
})

options.TerraformVars = []testschematic.TestSchematicTerraformVar{
Expand Down Expand Up @@ -291,7 +287,7 @@ func TestFullyConfigurableWithFlowLogs(t *testing.T) {
require.True(t, present, checkVariable+" environment variable not set")
require.NotEqual(t, "", val, checkVariable+" environment variable is empty")

prefix := "vpc-da-fl"
prefix := fmt.Sprintf("vpc-f-%s", strings.ToLower(random.UniqueId()))
existingTerraformOptions := setupTerraform(t, prefix, "./existing-resources")

options := testschematic.TestSchematicOptionsDefault(&testschematic.TestSchematicOptions{
Expand All @@ -308,6 +304,7 @@ func TestFullyConfigurableWithFlowLogs(t *testing.T) {
Tags: []string{"vpc-da-test"},
DeleteWorkspaceOnFail: false,
WaitJobCompleteMinutes: 120,
TerraformVersion: terraformVersion,
})

options.TerraformVars = []testschematic.TestSchematicTerraformVar{
Expand All @@ -322,7 +319,7 @@ func TestFullyConfigurableWithFlowLogs(t *testing.T) {
{Name: "kms_encryption_enabled_bucket", Value: "true", DataType: "bool"},
{Name: "existing_kms_instance_crn", Value: permanentResources["hpcs_south_crn"], DataType: "string"},
{Name: "vpe_gateway_cloud_services", Value: []map[string]string{{"service_name": "kms"}, {"service_name": "cloud-object-storage"}}, DataType: "list(object{})"},
{Name: "vpe_gateway_cloud_service_by_crn", Value: []map[string]string{{"crn": terraform.Output(t, existingTerraformOptions, "postgresql_db_crn")}}, DataType: "list(object{})"},
{Name: "vpe_gateway_cloud_service_by_crn", Value: []map[string]string{{"crn": terraform.Output(t, existingTerraformOptions, "postgresql_db_crn"), "vpe_name": "pg"}}, DataType: "list(object{})"},
{Name: "vpn_gateways", Value: []map[string]string{{"name": options.Prefix + "-vpn", "subnet_name": "subnet-c"}}, DataType: "list(object{})"},
}

Expand All @@ -340,7 +337,7 @@ func TestRunUpgradeFullyConfigurable(t *testing.T) {
require.True(t, present, checkVariable+" environment variable not set")
require.NotEqual(t, "", val, checkVariable+" environment variable is empty")

prefix := "vpc-upg"
prefix := fmt.Sprintf("vpc-u-%s", strings.ToLower(random.UniqueId()))
existingTerraformOptions := setupTerraform(t, prefix, "./existing-resources")

options := testschematic.TestSchematicOptionsDefault(&testschematic.TestSchematicOptions{
Expand All @@ -353,10 +350,12 @@ func TestRunUpgradeFullyConfigurable(t *testing.T) {
"dynamic_values/config_modules/*/*.tf",
fullyConfigFlavorDir + "/*.tf",
},
TemplateFolder: fullyConfigFlavorDir,
Tags: []string{"vpc-da-test"},
DeleteWorkspaceOnFail: false,
WaitJobCompleteMinutes: 120,
TemplateFolder: fullyConfigFlavorDir,
Tags: []string{"vpc-da-test"},
DeleteWorkspaceOnFail: false,
WaitJobCompleteMinutes: 120,
CheckApplyResultForUpgrade: true,
TerraformVersion: terraformVersion,
})

options.TerraformVars = []testschematic.TestSchematicTerraformVar{
Expand All @@ -371,7 +370,7 @@ func TestRunUpgradeFullyConfigurable(t *testing.T) {
{Name: "kms_encryption_enabled_bucket", Value: "true", DataType: "bool"},
{Name: "existing_kms_instance_crn", Value: permanentResources["hpcs_south_crn"], DataType: "string"},
{Name: "vpe_gateway_cloud_services", Value: []map[string]string{{"service_name": "kms"}, {"service_name": "cloud-object-storage"}}, DataType: "list(object{})"},
{Name: "vpe_gateway_cloud_service_by_crn", Value: []map[string]string{{"crn": terraform.Output(t, existingTerraformOptions, "postgresql_db_crn")}}, DataType: "list(object{})"},
{Name: "vpe_gateway_cloud_service_by_crn", Value: []map[string]string{{"crn": terraform.Output(t, existingTerraformOptions, "postgresql_db_crn"), "vpe_name": "pg"}}, DataType: "list(object{})"},
{Name: "vpn_gateways", Value: []map[string]string{{"name": options.Prefix + "-vpn", "subnet_name": "subnet-c"}}, DataType: "list(object{})"},
}

Expand Down Expand Up @@ -409,7 +408,7 @@ func TestVpcAddonDefaultConfiguration(t *testing.T) {

options := testaddons.TestAddonsOptionsDefault(&testaddons.TestAddonOptions{
Testing: t,
Prefix: "vpc-def",
Prefix: "vpc-ad",
ResourceGroup: resourceGroup,
QuietMode: false, // Suppress logs except on failure
})
Expand All @@ -424,29 +423,26 @@ func TestVpcAddonDefaultConfiguration(t *testing.T) {
},
)

err := options.RunAddonTest()
require.NoError(t, err)
}

// TestDependencyPermutations runs dependency permutations for landing zone vpc and all its dependencies
func TestVpcDependencyPermutations(t *testing.T) {

t.Skip("Skipping dependency permutations until the test is fixed")
t.Parallel()
options := testaddons.TestAddonsOptionsDefault(&testaddons.TestAddonOptions{
Testing: t,
Prefix: "vpc-per",
AddonConfig: cloudinfo.AddonConfig{
OfferingName: "deploy-arch-ibm-slz-vpc",
// Disable target / route creation to prevent hitting quota in account
options.AddonConfig.Dependencies = []cloudinfo.AddonConfig{
{
OfferingName: "deploy-arch-ibm-cloud-monitoring",
OfferingFlavor: "fully-configurable",
Inputs: map[string]interface{}{
"prefix": "vpc-per",
"region": "us-south",
"existing_cos_instance_crn": permanentResources["general_test_storage_cos_instance_crn"],
"enable_metrics_routing_to_cloud_monitoring": false,
},
Enabled: core.BoolPtr(true),
},
})
{
OfferingName: "deploy-arch-ibm-activity-tracker",
OfferingFlavor: "fully-configurable",
Inputs: map[string]interface{}{
"enable_activity_tracker_event_routing_to_cloud_logs": false,
},
Enabled: core.BoolPtr(true),
},
}

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