Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 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
94 changes: 87 additions & 7 deletions ibm_catalog.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,79 @@
"key": "prefix",
"required": true
},
{
"key": "secrets_manager_region",
"required": true,
"virtual": true,
"default_value": "us-south",
"description": "The region to provision a new Secrets Manager instance in.",
"options": [
{
"displayname": "Osaka (jp-osa)",
"value": "jp-osa"
},
{
"displayname": "Sydney (au-syd)",
"value": "au-syd"
},
{
"displayname": "Tokyo (jp-tok)",
"value": "jp-tok"
},
{
"displayname": "Frankfurt (eu-de)",
"value": "eu-de"
},
{
"displayname": "London (eu-gb)",
"value": "eu-gb"
},
{
"displayname": "Madrid (eu-es)",
"value": "eu-es"
},
{
"displayname": "Dallas (us-south)",
"value": "us-south"
},
{
"displayname": "Toronto (ca-tor)",
"value": "ca-tor"
},
{
"displayname": "Washington DC (us-east)",
"value": "us-east"
},
{
"displayname": "Sao Paulo (br-sao)",
"value": "br-sao"
}
]
},
{
"key": "secrets_manager_service_plan",
"required": true,
"virtual": true,
"type": "string",
"options": [
{
"displayname": "Standard",
"value": "standard"
},
{
"displayname": "Trial",
"value": "trial"
}
],
"default_value": "standard",
"description": "The pricing plan to use when provisioning a Secrets Manager instance. Possible values: `standard`, `trial`. You can create only one Trial instance of Secrets Manager per account. Before you can create a new Trial instance, you must delete the existing Trial instance and its reclamation. [Learn more](https://cloud.ibm.com/docs/secrets-manager?topic=secrets-manager-create-instance&interface=ui#upgrade-instance-standard)."
},
{
"key": "ibmcloud_cis_api_key"
},
{
"key": "internet_services_crn"
"key": "internet_services_crn",
"required": true
},
{
"key": "internet_services_account_id"
Expand Down Expand Up @@ -143,10 +211,11 @@
]
},
{
"key": "acme_letsencrypt_private_key"
"key": "acme_letsencrypt_private_key",
"required": true
},
{
"key":"private_key_secrets_manager_secret_crn"
"key":"acme_letsencrypt_private_key_secrets_manager_secret_crn"
},
{
"key":"skip_iam_authorization_policy"
Expand All @@ -155,24 +224,35 @@
"dependencies": [
{
"name": "deploy-arch-ibm-secrets-manager",
"description":"Configures Secrets Manager instance for the public certificates engine to be provisioned in.",
"description": "Create a new Secrets Manager instance.",
"id": "6d6ebc76-7bbd-42f5-8bc7-78f4fabd5944-global",
"version": "v2.6.1",
"version": "v2.6.3",
"flavors": [
"fully-configurable"
"fully-configurable"
],
"catalog_id": "7a4d68b4-cf8b-40cd-a3d1-f49aff526eb3",
"optional": true,
"on_by_default": true,
"input_mapping": [
{
"dependency_input": "prefix",
"version_input": "prefix",
"reference_version": true
},
{
"dependency_input": "service_plan",
"version_input": "secrets_manager_service_plan",
"reference_version": true
},
{
"dependency_output": "secrets_manager_crn",
"version_input": "existing_secrets_manager_crn"
}
]
}
],
"dependency_version_2": true
"dependency_version_2": true,
"terraform_version": "1.10.5"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"ibmcloud_api_key": $VALIDATION_APIKEY,
"existing_secrets_manager_crn": $SM_CRN,
"prefix": $PREFIX,
"private_key_secrets_manager_secret_crn": $ACME_LETSENCRYPT_PRIVATE_KEY_SECRET_CRN,
"internet_services_crn": $CIS_INSTANCE_ID
"acme_letsencrypt_private_key": $ACME_KEY,
"internet_services_crn": $CIS_ID
}
2 changes: 1 addition & 1 deletion solutions/fully-configurable/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module "secrets_manager_crn_parser" {
module "secret_crn_parser" {
source = "terraform-ibm-modules/common-utilities/ibm//modules/crn-parser"
version = "1.1.0"
crn = var.private_key_secrets_manager_secret_crn
crn = var.acme_letsencrypt_private_key_secrets_manager_secret_crn
}

locals {
Expand Down
15 changes: 7 additions & 8 deletions solutions/fully-configurable/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ variable "existing_secrets_manager_crn" {
variable "prefix" {
type = string
nullable = true
description = "The prefix to be added to all resources created by this solution. To skip using a prefix, set this value to null or an empty string. The prefix must begin with a lowercase letter and may contain only lowercase letters, digits, and hyphens '-'. It should not exceed 16 characters, must not end with a hyphen('-'), and can not contain consecutive hyphens ('--'). Example: prod-0205-cos. [Learn more](https://terraform-ibm-modules.github.io/documentation/#/prefix.md)."
description = "The prefix to be added to all resources created by this solution. To skip using a prefix, set this value to null or an empty string. The prefix must begin with a lowercase letter and may contain only lowercase letters, digits, and hyphens '-'. It should not exceed 16 characters, must not end with a hyphen('-'), and can not contain consecutive hyphens ('--'). Example: prod-us-south. [Learn more](https://terraform-ibm-modules.github.io/documentation/#/prefix.md)."

validation {
# - null and empty string is allowed
Expand Down Expand Up @@ -46,8 +46,7 @@ variable "ibmcloud_cis_api_key" {

variable "internet_services_crn" {
type = string
description = "The CRN of the Internet Service instance to authorize Secrets Manager against. [Learn more](https://cloud.ibm.com/docs/secrets-manager?topic=secrets-manager-secrets-manager-cli#secrets-manager-configurations-cli)."
default = null
description = "The CRN of the Internet Service instance to authorize Secrets Manager against. For creating a public certificate, as Cloud Internet Service is being used for DNS hence `internet_service_crn` is a required input. [Learn more](https://cloud.ibm.com/docs/secrets-manager?topic=secrets-manager-secrets-manager-cli#secrets-manager-configurations-cli)."
}

variable "internet_services_account_id" {
Expand Down Expand Up @@ -87,9 +86,9 @@ variable "lets_encrypt_environment" {

variable "acme_letsencrypt_private_key" {
type = string
description = "The private key generated by the ACME account creation tool. Required if private_key_secrets_manager_secret_crn is not set. [Learn more](https://cloud.ibm.com/docs/secrets-manager?topic=secrets-manager-secrets-manager-cli#secrets-manager-configurations-cli)."
default = null
description = "The private key generated by the ACME account creation tool. Alternatively `acme_letsencrypt_private_key_secrets_manager_secret_crn` can be provided. Required if acme_letsencrypt_private_key_secrets_manager_secret_crn is not set. [Learn more](https://cloud.ibm.com/docs/secrets-manager?topic=secrets-manager-secrets-manager-cli#secrets-manager-configurations-cli)."
sensitive = true
default = null
}

variable "skip_iam_authorization_policy" {
Expand All @@ -98,16 +97,16 @@ variable "skip_iam_authorization_policy" {
default = false
}

variable "private_key_secrets_manager_secret_crn" {
variable "acme_letsencrypt_private_key_secrets_manager_secret_crn" {
type = string
description = "The secret CRN of your ACME private key. Required if acme_letsencrypt_private_key is not set. If both are set, this value will be used as the private key."
default = null

validation {
condition = (
var.private_key_secrets_manager_secret_crn != null ||
var.acme_letsencrypt_private_key_secrets_manager_secret_crn != null ||
var.acme_letsencrypt_private_key != null
)
error_message = "If `acme_letsencrypt_private_key` is not set, you must provide a value for `private_key_secrets_manager_secret_crn`."
error_message = "If `acme_letsencrypt_private_key` is not set, you must provide a value for `acme_letsencrypt_private_key_secrets_manager_secret_crn`."
}
}
20 changes: 4 additions & 16 deletions tests/pr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,24 +99,12 @@ func TestRunIAMExample(t *testing.T) {
assert.NotNil(t, output, "Expected some output")
}

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

options := setupOptions(t, "sm-pub-cert-eng-upg", IAMExampleTerraformDir)

output, err := options.RunTestUpgrade()
if !options.UpgradeTestSkipped {
assert.Nil(t, err, "This should not have errored")
assert.NotNil(t, output, "Expected some output")
}
}

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

options := testschematic.TestSchematicOptionsDefault(&testschematic.TestSchematicOptions{
Testing: t,
Prefix: "sm-pbce",
Prefix: "sm-pb",
TarIncludePatterns: []string{
"*.tf",
fullyConfigurableDir + "/*.tf",
Expand All @@ -132,7 +120,7 @@ func TestRunSolutionsFullyConfigurableSchematics(t *testing.T) {
{Name: "ibmcloud_api_key", Value: options.RequiredEnvironmentVars["TF_VAR_ibmcloud_api_key"], DataType: "string", Secure: true},
{Name: "prefix", Value: options.Prefix, DataType: "string"},
{Name: "existing_secrets_manager_crn", Value: permanentResources["secretsManagerCRN"], DataType: "string"},
{Name: "private_key_secrets_manager_secret_crn", Value: permanentResources["acme_letsencrypt_private_key_secret_crn"], DataType: "string"},
{Name: "acme_letsencrypt_private_key_secrets_manager_secret_crn", Value: permanentResources["acme_letsencrypt_private_key_secret_crn"], DataType: "string"},
{Name: "internet_services_crn", Value: permanentResources["cisInstanceId"], DataType: "string"},
{Name: "skip_iam_authorization_policy", Value: true, DataType: "bool"}, // A permanent cis-sm auth policy already exists in the account
}
Expand All @@ -146,7 +134,7 @@ func TestRunSolutionsFullyConfigurableUpgradeSchematics(t *testing.T) {

options := testschematic.TestSchematicOptionsDefault(&testschematic.TestSchematicOptions{
Testing: t,
Prefix: "sm-pbce-up",
Prefix: "sm-pb-up",
TarIncludePatterns: []string{
"*.tf",
fullyConfigurableDir + "/*.tf",
Expand All @@ -162,7 +150,7 @@ func TestRunSolutionsFullyConfigurableUpgradeSchematics(t *testing.T) {
{Name: "ibmcloud_api_key", Value: options.RequiredEnvironmentVars["TF_VAR_ibmcloud_api_key"], DataType: "string", Secure: true},
{Name: "prefix", Value: options.Prefix, DataType: "string"},
{Name: "existing_secrets_manager_crn", Value: permanentResources["secretsManagerCRN"], DataType: "string"},
{Name: "private_key_secrets_manager_secret_crn", Value: permanentResources["acme_letsencrypt_private_key_secret_crn"], DataType: "string"},
{Name: "acme_letsencrypt_private_key_secrets_manager_secret_crn", Value: permanentResources["acme_letsencrypt_private_key_secret_crn"], DataType: "string"},
{Name: "internet_services_crn", Value: permanentResources["cisInstanceId"], DataType: "string"},
{Name: "skip_iam_authorization_policy", Value: true, DataType: "bool"}, // A permanent cis-sm auth policy already exists in the account
}
Expand Down