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
4 changes: 2 additions & 2 deletions solutions/standard/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ module "kms" {
providers = {
ibm = ibm.kms
}
count = var.existing_kms_key_crn != null ? 0 : 1 # no need to create any KMS resources if passing an existing key or using IBM owned keys
count = var.existing_kms_key_crn != null || var.use_ibm_owned_encryption_key ? 0 : 1 # no need to create any KMS resources if passing an existing key or using IBM owned keys
source = "terraform-ibm-modules/kms-all-inclusive/ibm"
version = "4.16.8"
create_key_protect_instance = false
Expand Down Expand Up @@ -133,7 +133,7 @@ module "backup_kms" {
providers = {
ibm = ibm.kms
}
count = var.existing_backup_kms_key_crn != null ? 0 : var.existing_backup_kms_instance_crn != null ? 1 : 0
count = var.use_ibm_owned_encryption_key ? 0 : var.existing_backup_kms_key_crn != null ? 0 : var.existing_backup_kms_instance_crn != null ? 1 : 0
source = "terraform-ibm-modules/kms-all-inclusive/ibm"
version = "4.16.8"
create_key_protect_instance = false
Expand Down
2 changes: 1 addition & 1 deletion solutions/standard/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ variable "auto_scaling" {
##############################################################

variable "use_ibm_owned_encryption_key" {
type = string
type = bool
description = "Set to true to use the default IBM Cloud® Databases randomly generated keys for disk and backups encryption."
default = false
}
Expand Down
24 changes: 24 additions & 0 deletions tests/pr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,30 @@ func TestRunStandardSolution(t *testing.T) {
assert.NotNil(t, output, "Expected some output")
}

// Test the DA when using IBM owned encryption keys
func TestRunStandardSolutionIBMKeys(t *testing.T) {
t.Parallel()

options := testhelper.TestOptionsDefault(&testhelper.TestOptions{
Testing: t,
TerraformDir: standardSolutionTerraformDir,
Region: "us-south",
Prefix: "postgres-icd-key",
ResourceGroup: resourceGroup,
})

options.TerraformVars = map[string]interface{}{
"pg_version": "16",
"provider_visibility": "public",
"resource_group_name": options.Prefix,
"use_ibm_owned_encryption_key": true,
}

output, err := options.RunTestConsistency()
assert.Nil(t, err, "This should not have errored")
assert.NotNil(t, output, "Expected some output")
}

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

Expand Down