Skip to content
Merged
Show file tree
Hide file tree
Changes from 11 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
2 changes: 1 addition & 1 deletion ibm_catalog.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
"url": "https://raw.githubusercontent.com/terraform-ibm-modules/terraform-ibm-secrets-manager-public-cert-engine/main/reference-architecture/secrets_manager_public_cert_engine.svg",
"type": "image/svg+xml"
},
"description": "This architcture supports creating secrets manager public certificates engine within a secrets manager instance."
"description": "This architecture supports creating secrets manager public certificates engine within a secrets manager instance."
}
]
},
Expand Down
45 changes: 36 additions & 9 deletions tests/pr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,18 @@
package test

import (
"log"
"os"
"testing"

"github.com/gruntwork-io/terratest/modules/logger"
"github.com/gruntwork-io/terratest/modules/terraform"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/terraform-ibm-modules/ibmcloud-terratest-wrapper/cloudinfo"
"github.com/terraform-ibm-modules/ibmcloud-terratest-wrapper/common"
"github.com/terraform-ibm-modules/ibmcloud-terratest-wrapper/testaddons"
"github.com/terraform-ibm-modules/ibmcloud-terratest-wrapper/testhelper"
"github.com/terraform-ibm-modules/ibmcloud-terratest-wrapper/testschematic"
"log"
"os"
"testing"
)

// Define a struct with fields that match the structure of the YAML data
Expand Down Expand Up @@ -174,11 +176,11 @@ func TestPlanValidation(t *testing.T) {
options.TerraformOptions.NoColor = true
options.TerraformOptions.Logger = logger.Discard
options.TerraformOptions.Vars = map[string]interface{}{
"prefix": options.Prefix,
"existing_secrets_manager_crn": permanentResources["secretsManagerCRN"],
"acme_letsencrypt_private_key": "PRIVATE_KEY_VALUE", // pragma: allowlist secret
"skip_iam_authorization_policy": true,
"provider_visibility": "public",
"prefix": options.Prefix,
"existing_secrets_manager_crn": permanentResources["secretsManagerCRN"],
"acme_letsencrypt_private_key_secrets_manager_secret_crn": permanentResources["acme_letsencrypt_private_key_secret_crn"], // pragma: allowlist secret
"skip_iam_authorization_policy": true,
"provider_visibility": "public",
}

// Init
Expand All @@ -190,3 +192,28 @@ func TestPlanValidation(t *testing.T) {
assert.Nil(t, planErr, "Terraform plan should not error")
assert.NotNil(t, planOutput, "Expected Terraform plan output")
}

func TestSecretManagerDefaultConfiguration(t *testing.T) {
t.Parallel()

options := testaddons.TestAddonsOptionsDefault(&testaddons.TestAddonOptions{
Testing: t,
Prefix: "pbsme",
ResourceGroup: resourceGroup,
QuietMode: true, // Suppress logs except on failure
Copy link
Contributor

@whoffler whoffler Sep 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have a look at similar PR where we set inputs on SMs dependencies to avoid creating too many routes in our account.

Make sure to set option OverrideInputMappings: core.BoolPtr(true) in the TestAddonOptions, it allows us to set inputs on variables that would otherwise contain a reference (otherwise SM existing_secrets_manager_crn may not be set as expected)

})

options.AddonConfig = cloudinfo.NewAddonConfigTerraform(
options.Prefix,
"deploy-arch-secrets-manager-public-cert-engine",
"fully-configurable",
map[string]interface{}{
"prefix": options.Prefix,
"existing_secrets_manager_crn": permanentResources["secretsManagerCRN"],
"acme_letsencrypt_private_key_secrets_manager_secret_crn": permanentResources["acme_letsencrypt_private_key_secret_crn"], // pragma: allowlist secret
},
)

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