Skip to content

Commit 63cf787

Browse files
committed
fix: reviewed PR for design standards
1 parent ff9b4fd commit 63cf787

File tree

6 files changed

+109
-112
lines changed

6 files changed

+109
-112
lines changed

ibm_catalog.json

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@
2323
"short_description": "Deploys the External Secrets Operator (ESO) on an IBM Cloud Kubernetes Service (IKS) OpenShift cluster.",
2424
"long_description": "This architecture allows to deploy the External Secrets Operator (ESO) and the related configuration on an IBM Cloud OpenShift Cluster to manage the secrets deployed on the cluster through IBM Cloud Secrets Manager. For more information about the External Secrets Operator, please refer to the [External Secrets Operator documentation](https://external-secrets.io/latest/).",
2525
"offering_docs_url": "https://github.com/terraform-ibm-modules/terraform-ibm-external-secrets-operator/blob/main/solutions/fully-configurable/README.md",
26-
"offering_icon_url": "https://raw.githubusercontent.com/terraform-ibm-modules/terraform-ibm-external-secrets-operator/refs/heads/da_task_11723/deploy-arch-ibm-eso.svg",
26+
"offering_icon_url": "https://raw.githubusercontent.com/terraform-ibm-modules/terraform-ibm-external-secrets-operator/refs/heads/main/deploy-arch-ibm-eso.svg",
2727
"provider_name": "IBM",
2828
"features": [
2929
{
3030
"title": "Deploys the External Secrets Operator (ESO) in existing cluster",
31-
"description": "This architecture allows to deploy the External Secrets Operator on an existing IBM Cloud OpenShift Cluster."
31+
"description": "This architecture allows to deploy the External Secrets Operator on an existing IBM Cloud OpenShift Cluster.<br/>For more details about the features and the options available please refer to this [page](https://github.com/terraform-ibm-modules/terraform-ibm-external-secrets-operator/blob/main/solutions/fully-configurable/DA-details.md)"
3232
},
3333
{
3434
"title": "Configures the External Secrets Operator (ESO) Cluster Secrets Stores and Secrets Stores with the related ServiceIDs, Secrets Groups and authentication methods",
@@ -103,7 +103,7 @@
103103
"required": true
104104
},
105105
{
106-
"key": "sm_ibmcloud_api_key"
106+
"key": "secrets_manager_ibmcloud_api_key"
107107
},
108108
{
109109
"key": "eso_namespace"
@@ -251,23 +251,15 @@
251251
"architecture": {
252252
"features": [
253253
{
254-
"title": "Deploys the External Secrets Operator (ESO) in existing cluster",
255-
"description": "This architecture allows to deploy the External Secrets Operator on an existing IBM Cloud OpenShift Cluster."
256-
},
257-
{
258-
"title": "Configures the External Secrets Operator (ESO) Cluster Secrets Stores and Secrets Stores with the related ServiceIDs, Secrets Groups and authentication methods",
259-
"description": "Deploy and configure ESO Cluster Secret Store resources for cluster scoped secrets store and ESO Secret Store resources for namespace scoped secrets store.<br/>For more details about Cluster Secret Store please refer to this [documentation](https://external-secrets.io/latest/api/clustersecretstore/).<br/>For more details about Secret Store please refer to this [documentation](https://external-secrets.io/latest/api/secretstore/).<br/>Both the Secret Store types support two different authentication methods, IAM API key and Truster Profile.<br/>For more details about configuring the Stores through this architecture input please refer to this [page](https://raw.githubusercontent.com/terraform-ibm-modules/terraform-ibm-external-secrets-operator/refs/heads/da_task_11723/solutions/fully-configurable/DA-eso-configuration.md)"
260-
},
261-
{
262-
"title": "Deploys and configures Stakater Reloader into the cluster",
263-
"description": "The architecture allows to optionally deploy Stakater Reloader into the cluster that helps with refreshing the cluster's secrets values by reloading pods when needed.<br/>For more information about Stakater Reloader, please refer to the [Stakater Reloader documentation](https://github.com/stakater/Reloader)."
254+
"title": " ",
255+
"description": "Configured to use IBM secure by default standards, but can be edited to fit your use case."
264256
}
265257
],
266258
"diagrams": [
267259
{
268260
"diagram": {
269261
"caption": "External Secrets Operator architecture on IBM Cloud OpenShift cluster",
270-
"url": "https://raw.githubusercontent.com/terraform-ibm-modules/terraform-ibm-external-secrets-operator/refs/heads/da_task_11723/reference-architecture/eso.svg",
262+
"url": "https://raw.githubusercontent.com/terraform-ibm-modules/terraform-ibm-external-secrets-operator/main/reference-architecture/reference-architecture/eso.svg",
271263
"type": "image/svg+xml"
272264
},
273265
"description": "This architecture supports deploying External Secrets Operator on IBM Cloud OpenShift cluster."
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# Terraform IBM External Secrets Operator
2+
3+
This architecture allows to deploy [External Secrets Operator](https://external-secrets.io/latest/) (also known as ESO) on an existing IBM Cloud OpenShift Cluster
4+
5+
External Secrets Operator synchronizes secrets in the Kubernetes cluster with secrets that are mapped in [Secrets Manager](https://cloud.ibm.com/docs/secrets-manager).
6+
7+
The architecture provides the following features:
8+
- Install and configure External Secrets Operator (ESO).
9+
- Customise External Secret Operator deployment on specific cluster workers by configuration approriate NodeSelector and Tolerations in the ESO helm release [More details below](#customise-eso-deployment-on-specific-cluster-nodes)
10+
- Deploy and configure [ClusterSecretStore](https://external-secrets.io/latest/api/clustersecretstore/) resources for cluster scope secrets store
11+
- Deploy and configure [SecretStore](https://external-secrets.io/latest/api/secretstore/) resources for namespace scope secrets store
12+
- Leverage on two authentication methods to be configured on the single stores instances:
13+
- IAM apikey standard authentication
14+
- IAM Trusted profile
15+
16+
The current version of the architecture supports multitenants configuration by setting up "ESO as a service" (ref. https://cloud.redhat.com/blog/how-to-setup-external-secrets-operator-eso-as-a-service) for both authentication methods<br/>
17+
[More details](https://github.com/terraform-ibm-modules/terraform-ibm-external-secrets-operator#example-of-multitenancy-configuration-example-in-namespaced-externalsecrets-stores)
18+
19+
### Pod Reloader
20+
21+
The architecture allows also to deploy optionally Stakater Reloader](https://github.com/stakater/Reloader): when secrets are updated, depending on you configuration pods may need to be restarted to pick up the new secrets. To do this you can use it.
22+
By default, the module deploys this to watch for changes in secrets and configmaps and trigger a rolling update of the related pods.
23+
To have Reloader watch a secret or configMap add the annotation `reloader.stakater.com/auto: "true"` to the secret or configMap, the same annotation can be added to deployments to have them restarted when the secret or configMap changes.
24+
25+
This can be further configured as needed, for more details see https://github.com/stakater/Reloader By default it watches all namespaces.
26+
If you do not need it please set `reloader_deployed = false` in the input variable value.
27+
28+
### Output content and Secrets configuration
29+
30+
This architecture doesn't provide support for configuring the Secrets and the ESO external-secrets structures needed to synchronize the secret with Secrets Manager.
31+
However its output provides, for each Cluster Secrets Store and Secrets Store configured in input, the IDs for the ServiceIDs, for the Account and Service Secrets Groups and so on: these output structures can be easily used in a terraform template to configure and deploy the secrets on the cluster.
32+
The code below is an example of generating a username/password secret on Secrets Manager to deploy a dockerjson cluster secret for each Cluster Secrets Store:
33+
34+
```
35+
##################################################################
36+
# creation of generic username/password secret
37+
# (for example to store artifactory username and API key)
38+
##################################################################
39+
40+
locals {
41+
# secret value for sm_userpass_secret
42+
userpass_apikey = sensitive("password-payload-example")
43+
}
44+
45+
# Create username_password secret and store in secret manager
46+
module "sm_userpass_secret" {
47+
for_each = local.cluster_secrets_stores_account_secrets_groups
48+
source = "terraform-ibm-modules/secrets-manager-secret/ibm"
49+
version = "1.7.0"
50+
region = local.sm_region
51+
secrets_manager_guid = local.sm_guid
52+
secret_group_id = each.value.secrets_group.secret_group_id
53+
#tfsec:ignore:general-secrets-no-plaintext-exposure
54+
secret_name = "${each.key}-usernamepassword-secret" # checkov:skip=CKV_SECRET_6
55+
secret_description = "example secret for ${each.value.name}" #tfsec:ignore:general-secrets-no-plaintext-exposure # checkov:skip=CKV_SECRET_6
56+
secret_payload_password = local.userpass_apikey # pragma: allowlist secret
57+
secret_type = "username_password" #checkov:skip=CKV_SECRET_6
58+
#tfsec:ignore:general-secrets-no-plaintext-exposure
59+
secret_username = "artifactory-user" # checkov:skip=CKV_SECRET_6: does not require high entropy string as is static value
60+
secret_auto_rotation = false
61+
secret_auto_rotation_interval = 0
62+
secret_auto_rotation_unit = null
63+
providers = {
64+
ibm = ibm.ibm-sm
65+
}
66+
}
67+
68+
##################################################################
69+
# ESO externalsecrets with cluster scope and apikey authentication
70+
##################################################################
71+
72+
# ESO externalsecret with cluster scope creating a dockerconfigjson type secret
73+
module "external_secret_usr_pass" {
74+
for_each = local.cluster_secrets_store_account_serviceid_apikey_secrets
75+
depends_on = [module.eso_clustersecretsstore]
76+
source = "../../modules/eso-external-secret"
77+
es_kubernetes_secret_type = "dockerconfigjson" #checkov:skip=CKV_SECRET_6
78+
sm_secret_type = "username_password" #checkov:skip=CKV_SECRET_6
79+
sm_secret_id = each.value.secrets_manager_secret.secret_id
80+
es_kubernetes_namespace = var.eso_secretsstores_configuration.cluster_secrets_stores[each.key].namespace
81+
eso_store_name = each.key
82+
es_container_registry = "example-registry-local.artifactory.com"
83+
es_kubernetes_secret_name = "dockerconfigjson-uc" #checkov:skip=CKV_SECRET_6
84+
es_helm_rls_name = "es-docker-uc"
85+
}
86+
87+
output "sm_userpass_secret" {
88+
value = module.sm_userpass_secret
89+
}
90+
```
Lines changed: 2 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -1,90 +1,3 @@
1-
# Terraform IBM External Secrets Operator
1+
# Cloud automation for External Secrets Operator (Fully configurable)
22

3-
This architecture allows to deploy [External Secrets Operator](https://external-secrets.io/latest/) (also known as ESO) on an existing IBM Cloud OpenShift Cluster
4-
5-
External Secrets Operator synchronizes secrets in the Kubernetes cluster with secrets that are mapped in [Secrets Manager](https://cloud.ibm.com/docs/secrets-manager).
6-
7-
The architecture provides the following features:
8-
- Install and configure External Secrets Operator (ESO).
9-
- Customise External Secret Operator deployment on specific cluster workers by configuration approriate NodeSelector and Tolerations in the ESO helm release [More details below](#customise-eso-deployment-on-specific-cluster-nodes)
10-
- Deploy and configure [ClusterSecretStore](https://external-secrets.io/latest/api/clustersecretstore/) resources for cluster scope secrets store
11-
- Deploy and configure [SecretStore](https://external-secrets.io/latest/api/secretstore/) resources for namespace scope secrets store
12-
- Leverage on two authentication methods to be configured on the single stores instances:
13-
- IAM apikey standard authentication
14-
- IAM Trusted profile
15-
16-
The current version of the architecture supports multitenants configuration by setting up "ESO as a service" (ref. https://cloud.redhat.com/blog/how-to-setup-external-secrets-operator-eso-as-a-service) for both authentication methods<br/>
17-
[More details](https://github.com/terraform-ibm-modules/terraform-ibm-external-secrets-operator#example-of-multitenancy-configuration-example-in-namespaced-externalsecrets-stores)
18-
19-
### Pod Reloader
20-
21-
The architecture allows also to deploy optionally Stakater Reloader](https://github.com/stakater/Reloader): when secrets are updated, depending on you configuration pods may need to be restarted to pick up the new secrets. To do this you can use it.
22-
By default, the module deploys this to watch for changes in secrets and configmaps and trigger a rolling update of the related pods.
23-
To have Reloader watch a secret or configMap add the annotation `reloader.stakater.com/auto: "true"` to the secret or configMap, the same annotation can be added to deployments to have them restarted when the secret or configMap changes.
24-
25-
This can be further configured as needed, for more details see https://github.com/stakater/Reloader By default it watches all namespaces.
26-
If you do not need it please set `reloader_deployed = false` in the input variable value.
27-
28-
### Output content and Secrets configuration
29-
30-
This architecture doesn't provide support for configuring the Secrets and the ESO external-secrets structures needed to synchronize the secret with Secrets Manager.
31-
However its output provides, for each Cluster Secrets Store and Secrets Store configured in input, the IDs for the ServiceIDs, for the Account and Service Secrets Groups and so on: these output structures can be easily used in a terraform template to configure and deploy the secrets on the cluster.
32-
The code below is an example of generating a username/password secret on Secrets Manager to deploy a dockerjson cluster secret for each Cluster Secrets Store:
33-
34-
```
35-
##################################################################
36-
# creation of generic username/password secret
37-
# (for example to store artifactory username and API key)
38-
##################################################################
39-
40-
locals {
41-
# secret value for sm_userpass_secret
42-
userpass_apikey = sensitive("password-payload-example")
43-
}
44-
45-
# Create username_password secret and store in secret manager
46-
module "sm_userpass_secret" {
47-
for_each = local.cluster_secrets_stores_account_secrets_groups
48-
source = "terraform-ibm-modules/secrets-manager-secret/ibm"
49-
version = "1.7.0"
50-
region = local.sm_region
51-
secrets_manager_guid = local.sm_guid
52-
secret_group_id = each.value.secrets_group.secret_group_id
53-
#tfsec:ignore:general-secrets-no-plaintext-exposure
54-
secret_name = "${each.key}-usernamepassword-secret" # checkov:skip=CKV_SECRET_6
55-
secret_description = "example secret for ${each.value.name}" #tfsec:ignore:general-secrets-no-plaintext-exposure # checkov:skip=CKV_SECRET_6
56-
secret_payload_password = local.userpass_apikey # pragma: allowlist secret
57-
secret_type = "username_password" #checkov:skip=CKV_SECRET_6
58-
#tfsec:ignore:general-secrets-no-plaintext-exposure
59-
secret_username = "artifactory-user" # checkov:skip=CKV_SECRET_6: does not require high entropy string as is static value
60-
secret_auto_rotation = false
61-
secret_auto_rotation_interval = 0
62-
secret_auto_rotation_unit = null
63-
providers = {
64-
ibm = ibm.ibm-sm
65-
}
66-
}
67-
68-
##################################################################
69-
# ESO externalsecrets with cluster scope and apikey authentication
70-
##################################################################
71-
72-
# ESO externalsecret with cluster scope creating a dockerconfigjson type secret
73-
module "external_secret_usr_pass" {
74-
for_each = local.cluster_secrets_store_account_serviceid_apikey_secrets
75-
depends_on = [module.eso_clustersecretsstore]
76-
source = "../../modules/eso-external-secret"
77-
es_kubernetes_secret_type = "dockerconfigjson" #checkov:skip=CKV_SECRET_6
78-
sm_secret_type = "username_password" #checkov:skip=CKV_SECRET_6
79-
sm_secret_id = each.value.secrets_manager_secret.secret_id
80-
es_kubernetes_namespace = var.eso_secretsstores_configuration.cluster_secrets_stores[each.key].namespace
81-
eso_store_name = each.key
82-
es_container_registry = "example-registry-local.artifactory.com"
83-
es_kubernetes_secret_name = "dockerconfigjson-uc" #checkov:skip=CKV_SECRET_6
84-
es_helm_rls_name = "es-docker-uc"
85-
}
86-
87-
output "sm_userpass_secret" {
88-
value = module.sm_userpass_secret
89-
}
90-
```
3+
:exclamation: **Important:** This solution is not intended to be called by other modules because it contains a provider configuration and is not compatible with the `for_each`, `count`, and `depends_on` arguments. For more information, see [Providers Within Modules](https://developer.hashicorp.com/terraform/language/modules/develop/providers).

solutions/fully-configurable/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ locals {
2121
cluster_region = module.crn_parser_cluster.region
2222
sm_region = module.crn_parser_sm.region
2323
sm_guid = module.crn_parser_sm.service_instance
24-
sm_ibmcloud_api_key = var.sm_ibmcloud_api_key == null ? var.ibmcloud_api_key : var.sm_ibmcloud_api_key
24+
sm_ibmcloud_api_key = var.secrets_manager_ibmcloud_api_key == null ? var.ibmcloud_api_key : var.secrets_manager_ibmcloud_api_key
2525
}
2626

2727
data "ibm_container_cluster_config" "cluster_config" {

solutions/fully-configurable/provider.tf

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
provider "ibm" {
2-
ibmcloud_api_key = var.ibmcloud_api_key
3-
visibility = var.provider_visibility
4-
region = local.cluster_region
2+
ibmcloud_api_key = var.ibmcloud_api_key
3+
visibility = var.provider_visibility
4+
region = local.cluster_region
5+
private_endpoint_type = (var.provider_visibility == "private" && local.cluster_region == "ca-mon") ? "vpe" : null
56
}
67

78
provider "ibm" {
8-
ibmcloud_api_key = local.sm_ibmcloud_api_key
9-
visibility = var.provider_visibility
10-
region = local.sm_region
11-
alias = "ibm-sm"
9+
ibmcloud_api_key = local.sm_ibmcloud_api_key
10+
visibility = var.provider_visibility
11+
region = local.sm_region
12+
alias = "ibm-sm"
13+
private_endpoint_type = (var.provider_visibility == "private" && local.sm_region == "ca-mon") ? "vpe" : null
1214
}
1315

1416
provider "kubernetes" {

solutions/fully-configurable/variables.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ variable "ibmcloud_api_key" {
88
sensitive = true
99
}
1010

11-
variable "sm_ibmcloud_api_key" {
11+
variable "secrets_manager_ibmcloud_api_key" {
1212
type = string
1313
description = "API key to authenticate on Secrets Manager instance. If null the ibmcloud_api_key will be used."
1414
default = null

0 commit comments

Comments
 (0)