Skip to content

Commit 3c56a4f

Browse files
authored
fix: updated the Secrets Manager instance to provision with public and private endpoints enabled (#69)
1 parent 4ba07a2 commit 3c56a4f

File tree

5 files changed

+30
-12
lines changed

5 files changed

+30
-12
lines changed

.secrets.baseline

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"files": "go.sum|^.secrets.baseline$",
44
"lines": null
55
},
6-
"generated_at": "2024-06-13T19:58:20Z",
6+
"generated_at": "2024-06-14T19:58:20Z",
77
"plugins_used": [
88
{
99
"name": "AWSKeyDetector"

ibm_catalog.json

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -233,28 +233,37 @@
233233
],
234234
"iam_permissions": [
235235
{
236-
"role_crns": ["crn:v1:bluemix:public:iam::::serviceRole:Manager"],
236+
"role_crns": [
237+
"crn:v1:bluemix:public:iam::::serviceRole:Manager"
238+
],
237239
"service_name": "cloud-object-storage"
238240
},
239241
{
240-
"role_crns": ["crn:v1:bluemix:public:iam::::serviceRole:Manager"],
242+
"role_crns": [
243+
"crn:v1:bluemix:public:iam::::serviceRole:Manager"
244+
],
241245
"service_name": "hs-crypto"
242246
},
243247
{
244-
"role_crns": ["crn:v1:bluemix:public:iam::::role:Administrator"],
248+
"role_crns": [
249+
"crn:v1:bluemix:public:iam::::role:Administrator"
250+
],
245251
"service_name": "iam-identity"
246252
},
247253
{
248-
"role_crns": ["crn:v1:bluemix:public:iam::::serviceRole:Manager"],
254+
"role_crns": [
255+
"crn:v1:bluemix:public:iam::::serviceRole:Manager"
256+
],
249257
"service_name": "kms"
250258
},
251259
{
252-
"role_crns": ["crn:v1:bluemix:public:iam::::role:Administrator"],
260+
"role_crns": [
261+
"crn:v1:bluemix:public:iam::::role:Administrator"
262+
],
253263
"service_name": "is.vpc"
254264
}
255265
],
256266
"architecture": {
257-
"descriptions": "",
258267
"features": [
259268
{
260269
"title": "Separate VPC for management",

solutions/e2e/main.tf

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,20 @@ module "sm_resource_group" {
4747

4848
# Create a new SM instance if not using an existing one
4949
resource "ibm_resource_instance" "secrets_manager" {
50+
provider = ibm.ibm-sm
5051
count = (var.use_sm && var.existing_sm_instance_guid == null) ? 1 : 0
5152
name = "${var.prefix}-sm-instance"
5253
service = "secrets-manager"
5354
plan = var.sm_service_plan
5455
location = local.sm_region
5556
resource_group_id = local.sm_rg_id
5657
tags = var.resource_tags
58+
parameters = {
59+
"allowed_network" = "public-and-private"
60+
}
5761
timeouts {
5862
create = "20m" # Extending provisioning time to 20 minutes
5963
}
60-
provider = ibm.ibm-sm
6164
}
6265

6366
# Configure private cert engine if provisioning a new SM instance

tests/pr_test.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,17 @@ func TestMain(m *testing.M) {
2828
rsaKeyPair, _ := ssh.GenerateRSAKeyPairE(tSsh, 4096)
2929
sshPublicKey := strings.TrimSuffix(rsaKeyPair.PublicKey, "\n") // removing trailing new lines
3030
sshPrivateKey := "<<EOF\n" + rsaKeyPair.PrivateKey + "EOF"
31-
os.Setenv("TF_VAR_ssh_key", sshPublicKey)
32-
os.Setenv("TF_VAR_ssh_private_key", sshPrivateKey)
31+
if err := os.Setenv("TF_VAR_ssh_key", sshPublicKey); err != nil {
32+
tSsh.Fatalf("failed to set TF_VAR_ssh_key: %v", err) // pragma: allowlist secret
33+
}
34+
if err := os.Setenv("TF_VAR_ssh_private_key", sshPrivateKey); err != nil {
35+
tSsh.Fatalf("failed to set TF_VAR_ssh_private_key: %v", err) // pragma: allowlist secret
36+
}
3337

3438
// use trial instance for tests
35-
os.Setenv("TF_VAR_sm_service_plan", "trial")
39+
if err := os.Setenv("TF_VAR_sm_service_plan", "trial"); err != nil {
40+
tSsh.Fatalf("failed to set TF_VAR_sm_service_plan: %v", err)
41+
}
3642
os.Exit(m.Run())
3743
}
3844

0 commit comments

Comments
 (0)