Skip to content

Commit f800a0f

Browse files
fix: fixed incorrect DA config (#240)
1 parent 1f80075 commit f800a0f

File tree

6 files changed

+144
-36
lines changed

6 files changed

+144
-36
lines changed

ibm_catalog.json

Lines changed: 108 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,24 @@
103103
{
104104
"key": "ibmcloud_api_key"
105105
},
106+
{
107+
"key": "provider_visibility",
108+
"options": [
109+
{
110+
"displayname": "private",
111+
"value": "private"
112+
},
113+
{
114+
"displayname": "public",
115+
"value": "public"
116+
},
117+
{
118+
"displayname": "public-and-private",
119+
"value": "public-and-private"
120+
}
121+
],
122+
"hidden": true
123+
},
106124
{
107125
"key": "existing_secrets_manager_crn",
108126
"required": true
@@ -111,6 +129,73 @@
111129
"key": "prefix",
112130
"required": true
113131
},
132+
{
133+
"key": "secrets_manager_region",
134+
"required": true,
135+
"virtual": true,
136+
"default_value": "us-south",
137+
"description": "The region to provision a new Secrets Manager instance in.",
138+
"options": [
139+
{
140+
"displayname": "Osaka (jp-osa)",
141+
"value": "jp-osa"
142+
},
143+
{
144+
"displayname": "Sydney (au-syd)",
145+
"value": "au-syd"
146+
},
147+
{
148+
"displayname": "Tokyo (jp-tok)",
149+
"value": "jp-tok"
150+
},
151+
{
152+
"displayname": "Frankfurt (eu-de)",
153+
"value": "eu-de"
154+
},
155+
{
156+
"displayname": "London (eu-gb)",
157+
"value": "eu-gb"
158+
},
159+
{
160+
"displayname": "Madrid (eu-es)",
161+
"value": "eu-es"
162+
},
163+
{
164+
"displayname": "Dallas (us-south)",
165+
"value": "us-south"
166+
},
167+
{
168+
"displayname": "Toronto (ca-tor)",
169+
"value": "ca-tor"
170+
},
171+
{
172+
"displayname": "Washington DC (us-east)",
173+
"value": "us-east"
174+
},
175+
{
176+
"displayname": "Sao Paulo (br-sao)",
177+
"value": "br-sao"
178+
}
179+
]
180+
},
181+
{
182+
"key": "secrets_manager_service_plan",
183+
"required": true,
184+
"virtual": true,
185+
"type": "string",
186+
"options": [
187+
{
188+
"displayname": "Standard",
189+
"value": "standard"
190+
},
191+
{
192+
"displayname": "Trial",
193+
"value": "trial"
194+
}
195+
],
196+
"default_value": "__NOT_SET__",
197+
"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)."
198+
},
114199
{
115200
"key": "ibmcloud_cis_api_key"
116201
},
@@ -143,10 +228,11 @@
143228
]
144229
},
145230
{
146-
"key": "acme_letsencrypt_private_key"
231+
"key": "acme_letsencrypt_private_key",
232+
"required": true
147233
},
148234
{
149-
"key":"private_key_secrets_manager_secret_crn"
235+
"key":"acme_letsencrypt_private_key_secrets_manager_secret_crn"
150236
},
151237
{
152238
"key":"skip_iam_authorization_policy"
@@ -155,24 +241,40 @@
155241
"dependencies": [
156242
{
157243
"name": "deploy-arch-ibm-secrets-manager",
158-
"description":"Configures Secrets Manager instance for the public certificates engine to be provisioned in.",
244+
"description": "Create a new Secrets Manager instance.",
159245
"id": "6d6ebc76-7bbd-42f5-8bc7-78f4fabd5944-global",
160-
"version": "v2.6.1",
246+
"version": "v2.6.3",
161247
"flavors": [
162-
"fully-configurable"
248+
"fully-configurable"
163249
],
164250
"catalog_id": "7a4d68b4-cf8b-40cd-a3d1-f49aff526eb3",
165251
"optional": true,
166252
"on_by_default": true,
167253
"input_mapping": [
254+
{
255+
"dependency_input": "prefix",
256+
"version_input": "prefix",
257+
"reference_version": true
258+
},
259+
{
260+
"dependency_input": "region",
261+
"version_input": "secrets_manager_region",
262+
"reference_version": true
263+
},
264+
{
265+
"dependency_input": "service_plan",
266+
"version_input": "secrets_manager_service_plan",
267+
"reference_version": true
268+
},
168269
{
169270
"dependency_output": "secrets_manager_crn",
170271
"version_input": "existing_secrets_manager_crn"
171272
}
172273
]
173274
}
174275
],
175-
"dependency_version_2": true
276+
"dependency_version_2": true,
277+
"terraform_version": "1.10.5"
176278
}
177279
]
178280
}

solutions/fully-configurable/catalogValidationValues.json.template

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
"ibmcloud_api_key": $VALIDATION_APIKEY,
33
"existing_secrets_manager_crn": $SM_CRN,
44
"prefix": $PREFIX,
5-
"private_key_secrets_manager_secret_crn": $ACME_LETSENCRYPT_PRIVATE_KEY_SECRET_CRN,
6-
"internet_services_crn": $CIS_INSTANCE_ID
5+
"acme_letsencrypt_private_key": $ACME_KEY,
6+
"internet_services_crn": $CIS_ID
77
}

solutions/fully-configurable/main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ module "secrets_manager_crn_parser" {
1515
module "secret_crn_parser" {
1616
source = "terraform-ibm-modules/common-utilities/ibm//modules/crn-parser"
1717
version = "1.1.0"
18-
crn = var.private_key_secrets_manager_secret_crn
18+
crn = var.acme_letsencrypt_private_key_secrets_manager_secret_crn
1919
}
2020

2121
locals {
@@ -38,7 +38,7 @@ module "secrets_manager_public_cert_engine" {
3838
internet_services_crn = var.internet_services_crn
3939
cis_account_id = var.internet_services_account_id
4040
internet_service_domain_id = var.internet_service_domain_id
41-
dns_config_name = "${local.prefix}${var.dns_config_name}"
41+
dns_config_name = var.dns_config_name
4242
ca_config_name = "${local.prefix}${var.ca_config_name}"
4343
lets_encrypt_environment = var.lets_encrypt_environment
4444
acme_letsencrypt_private_key = var.acme_letsencrypt_private_key
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
provider "ibm" {
22
ibmcloud_api_key = var.ibmcloud_api_key
33
region = local.existing_secrets_manager_region
4+
visibility = var.provider_visibility
45
}
56

67
provider "ibm" {
78
alias = "secret-store"
89
ibmcloud_api_key = var.ibmcloud_api_key
910
region = local.existing_secrets_manager_region
11+
visibility = var.provider_visibility
1012
}

solutions/fully-configurable/variables.tf

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,17 @@ variable "ibmcloud_api_key" {
44
sensitive = true
55
}
66

7+
variable "provider_visibility" {
8+
description = "Set the visibility value for the IBM terraform provider. Supported values are `public`, `private`, `public-and-private`. [Learn more](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/guides/custom-service-endpoints)."
9+
type = string
10+
default = "private"
11+
12+
validation {
13+
condition = contains(["public", "private", "public-and-private"], var.provider_visibility)
14+
error_message = "Invalid visibility option. Allowed values are 'public', 'private', or 'public-and-private'."
15+
}
16+
}
17+
718
variable "existing_secrets_manager_crn" {
819
type = string
920
description = "CRN of an existing secrets manager instance to create the secret engine in."
@@ -12,7 +23,7 @@ variable "existing_secrets_manager_crn" {
1223
variable "prefix" {
1324
type = string
1425
nullable = true
15-
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)."
26+
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)."
1627

1728
validation {
1829
# - null and empty string is allowed
@@ -46,7 +57,7 @@ variable "ibmcloud_cis_api_key" {
4657

4758
variable "internet_services_crn" {
4859
type = string
49-
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)."
60+
description = "The CRN of the Internet Service instance to authorize Secrets Manager against. For creating a public certificate, if using Cloud Internet Service for DNS then `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)."
5061
default = null
5162
}
5263

@@ -64,8 +75,13 @@ variable "internet_service_domain_id" {
6475

6576
variable "dns_config_name" {
6677
type = string
67-
description = "Name of the DNS config for the public_cert secrets engine. If a prefix input variable is specified, it is added to the value in the `<prefix>-value` format. [Learn more](https://cloud.ibm.com/docs/secrets-manager?topic=secrets-manager-secrets-manager-cli#secrets-manager-configurations-cli)."
68-
default = "certificate-dns"
78+
description = "Name of the DNS config for the public_cert secrets engine. If passing a value for `dns_config_name` a value for `internet_services_crn` is required. [Learn more](https://cloud.ibm.com/docs/secrets-manager?topic=secrets-manager-secrets-manager-cli#secrets-manager-configurations-cli)."
79+
default = null
80+
81+
validation {
82+
condition = var.dns_config_name != null ? var.internet_services_crn != null : true
83+
error_message = "A value for 'internet_services_crn' must be passed to create a DNS config for public certificate secrets engine."
84+
}
6985
}
7086

7187
variable "ca_config_name" {
@@ -87,9 +103,9 @@ variable "lets_encrypt_environment" {
87103

88104
variable "acme_letsencrypt_private_key" {
89105
type = string
90-
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)."
91-
default = null
106+
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)."
92107
sensitive = true
108+
default = null
93109
}
94110

95111
variable "skip_iam_authorization_policy" {
@@ -98,16 +114,16 @@ variable "skip_iam_authorization_policy" {
98114
default = false
99115
}
100116

101-
variable "private_key_secrets_manager_secret_crn" {
117+
variable "acme_letsencrypt_private_key_secrets_manager_secret_crn" {
102118
type = string
103119
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."
104120
default = null
105121

106122
validation {
107123
condition = (
108-
var.private_key_secrets_manager_secret_crn != null ||
124+
var.acme_letsencrypt_private_key_secrets_manager_secret_crn != null ||
109125
var.acme_letsencrypt_private_key != null
110126
)
111-
error_message = "If `acme_letsencrypt_private_key` is not set, you must provide a value for `private_key_secrets_manager_secret_crn`."
127+
error_message = "If `acme_letsencrypt_private_key` is not set, you must provide a value for `acme_letsencrypt_private_key_secrets_manager_secret_crn`."
112128
}
113129
}

tests/pr_test.go

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -99,24 +99,12 @@ func TestRunIAMExample(t *testing.T) {
9999
assert.NotNil(t, output, "Expected some output")
100100
}
101101

102-
func TestRunUpgradeExample(t *testing.T) {
103-
t.Parallel()
104-
105-
options := setupOptions(t, "sm-pub-cert-eng-upg", IAMExampleTerraformDir)
106-
107-
output, err := options.RunTestUpgrade()
108-
if !options.UpgradeTestSkipped {
109-
assert.Nil(t, err, "This should not have errored")
110-
assert.NotNil(t, output, "Expected some output")
111-
}
112-
}
113-
114102
func TestRunSolutionsFullyConfigurableSchematics(t *testing.T) {
115103
t.Parallel()
116104

117105
options := testschematic.TestSchematicOptionsDefault(&testschematic.TestSchematicOptions{
118106
Testing: t,
119-
Prefix: "sm-pbce",
107+
Prefix: "sm-pb",
120108
TarIncludePatterns: []string{
121109
"*.tf",
122110
fullyConfigurableDir + "/*.tf",
@@ -132,8 +120,7 @@ func TestRunSolutionsFullyConfigurableSchematics(t *testing.T) {
132120
{Name: "ibmcloud_api_key", Value: options.RequiredEnvironmentVars["TF_VAR_ibmcloud_api_key"], DataType: "string", Secure: true},
133121
{Name: "prefix", Value: options.Prefix, DataType: "string"},
134122
{Name: "existing_secrets_manager_crn", Value: permanentResources["secretsManagerCRN"], DataType: "string"},
135-
{Name: "private_key_secrets_manager_secret_crn", Value: permanentResources["acme_letsencrypt_private_key_secret_crn"], DataType: "string"},
136-
{Name: "internet_services_crn", Value: permanentResources["cisInstanceId"], DataType: "string"},
123+
{Name: "acme_letsencrypt_private_key_secrets_manager_secret_crn", Value: permanentResources["acme_letsencrypt_private_key_secret_crn"], DataType: "string"},
137124
{Name: "skip_iam_authorization_policy", Value: true, DataType: "bool"}, // A permanent cis-sm auth policy already exists in the account
138125
}
139126

@@ -146,7 +133,7 @@ func TestRunSolutionsFullyConfigurableUpgradeSchematics(t *testing.T) {
146133

147134
options := testschematic.TestSchematicOptionsDefault(&testschematic.TestSchematicOptions{
148135
Testing: t,
149-
Prefix: "sm-pbce-up",
136+
Prefix: "sm-pb-up",
150137
TarIncludePatterns: []string{
151138
"*.tf",
152139
fullyConfigurableDir + "/*.tf",
@@ -162,7 +149,8 @@ func TestRunSolutionsFullyConfigurableUpgradeSchematics(t *testing.T) {
162149
{Name: "ibmcloud_api_key", Value: options.RequiredEnvironmentVars["TF_VAR_ibmcloud_api_key"], DataType: "string", Secure: true},
163150
{Name: "prefix", Value: options.Prefix, DataType: "string"},
164151
{Name: "existing_secrets_manager_crn", Value: permanentResources["secretsManagerCRN"], DataType: "string"},
165-
{Name: "private_key_secrets_manager_secret_crn", Value: permanentResources["acme_letsencrypt_private_key_secret_crn"], DataType: "string"},
152+
{Name: "acme_letsencrypt_private_key_secrets_manager_secret_crn", Value: permanentResources["acme_letsencrypt_private_key_secret_crn"], DataType: "string"},
153+
{Name: "dns_config_name", Value: "cert-dns", DataType: "string"},
166154
{Name: "internet_services_crn", Value: permanentResources["cisInstanceId"], DataType: "string"},
167155
{Name: "skip_iam_authorization_policy", Value: true, DataType: "bool"}, // A permanent cis-sm auth policy already exists in the account
168156
}

0 commit comments

Comments
 (0)