|
| 1 | +# Secret Manager secrets module |
| 2 | + |
| 3 | +You can use this submodule to create of secret groups or secrets in an existing Secret Manager instance. |
| 4 | + |
| 5 | +The submodule extends the [secrets](https://github.com/terraform-ibm-modules/terraform-ibm-secrets-manager-secret) and [secret_group](https://github.com/terraform-ibm-modules/terraform-ibm-secrets-manager-secret-group) module by including support for multiple secrets. |
| 6 | + |
| 7 | +### Usage |
| 8 | + |
| 9 | +```hcl |
| 10 | +provider "ibm" { |
| 11 | + ibmcloud_api_key = "XXXXXXXXXXXXXX" # pragma: allowlist secret |
| 12 | + region = "us-south" |
| 13 | +} |
| 14 | +
|
| 15 | +module "secrets_manager" { |
| 16 | + source = "terraform-ibm-modules/secrets-manager/ibm//modules/secrets" |
| 17 | + version = "X.X.X" # Replace "X.X.X" with a release version to lock into a specific release |
| 18 | + existing_sm_instance_guid = "xxXXxxXXxXxXXXXxxXxxxXXXXxXXXXX" |
| 19 | + existing_sm_instance_region = "us-south" |
| 20 | + endpoint_type = "public" |
| 21 | + secrets = [{ |
| 22 | + secret_group_name = "secret-group" |
| 23 | + secrets = [{ |
| 24 | + secret_name = "secret1" |
| 25 | + secret_type = "arbitrary" |
| 26 | + secret_username = "test" |
| 27 | + secret_payload_password = "test" |
| 28 | + }, |
| 29 | + { |
| 30 | + secret_name = "secret2" |
| 31 | + secret_type = "arbitrary" |
| 32 | + secret_username = "test" |
| 33 | + secret_payload_password = "test" |
| 34 | + } |
| 35 | + ] |
| 36 | + } |
| 37 | + ] |
| 38 | +} |
| 39 | +``` |
| 40 | + |
| 41 | +<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK --> |
| 42 | +### Requirements |
| 43 | + |
| 44 | +| Name | Version | |
| 45 | +|------|---------| |
| 46 | +| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.3.0 | |
| 47 | +| <a name="requirement_ibm"></a> [ibm](#requirement\_ibm) | >=1.62.0, <2.0.0 | |
| 48 | + |
| 49 | +### Modules |
| 50 | + |
| 51 | +| Name | Source | Version | |
| 52 | +|------|--------|---------| |
| 53 | +| <a name="module_secret_groups"></a> [secret\_groups](#module\_secret\_groups) | terraform-ibm-modules/secrets-manager-secret-group/ibm | 1.2.2 | |
| 54 | +| <a name="module_secrets"></a> [secrets](#module\_secrets) | terraform-ibm-modules/secrets-manager-secret/ibm | 1.3.2 | |
| 55 | + |
| 56 | +### Resources |
| 57 | + |
| 58 | +| Name | Type | |
| 59 | +|------|------| |
| 60 | +| [ibm_sm_secret_groups.existing_secret_groups](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/data-sources/sm_secret_groups) | data source | |
| 61 | + |
| 62 | +### Inputs |
| 63 | + |
| 64 | +| Name | Description | Type | Default | Required | |
| 65 | +|------|-------------|------|---------|:--------:| |
| 66 | +| <a name="input_endpoint_type"></a> [endpoint\_type](#input\_endpoint\_type) | The service endpoint type to communicate with the provided secrets manager instance. Possible values are `public` or `private` | `string` | `"public"` | no | |
| 67 | +| <a name="input_existing_sm_instance_guid"></a> [existing\_sm\_instance\_guid](#input\_existing\_sm\_instance\_guid) | Instance ID of Secrets Manager instance in which the Secret will be added. | `string` | n/a | yes | |
| 68 | +| <a name="input_existing_sm_instance_region"></a> [existing\_sm\_instance\_region](#input\_existing\_sm\_instance\_region) | Region which the Secret Manager is deployed. | `string` | n/a | yes | |
| 69 | +| <a name="input_secrets"></a> [secrets](#input\_secrets) | Secret Manager secrets configurations. | <pre>list(object({<br> secret_group_name = string<br> secret_group_description = optional(string)<br> existing_secret_group = optional(bool, false)<br> secrets = optional(list(object({<br> secret_name = string<br> secret_description = optional(string)<br> secret_type = optional(string)<br> imported_cert_certificate = optional(string)<br> imported_cert_private_key = optional(string)<br> imported_cert_intermediate = optional(string)<br> secret_username = optional(string)<br> secret_labels = optional(list(string), [])<br> secret_payload_password = optional(string, "")<br> secret_auto_rotation = optional(bool, true)<br> secret_auto_rotation_unit = optional(string, "day")<br> secret_auto_rotation_interval = optional(number, 89)<br> service_credentials_ttl = optional(string, "7776000") # 90 days<br> service_credentials_source_service_crn = optional(string)<br> service_credentials_source_service_role = optional(string)<br> })))<br> }))</pre> | `[]` | no | |
| 70 | + |
| 71 | +### Outputs |
| 72 | + |
| 73 | +| Name | Description | |
| 74 | +|------|-------------| |
| 75 | +| <a name="output_secret_groups"></a> [secret\_groups](#output\_secret\_groups) | IDs of the created Secret Group | |
| 76 | +| <a name="output_secrets"></a> [secrets](#output\_secrets) | List of secret mananger secret config data | |
| 77 | +<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK --> |
0 commit comments