Skip to content

Commit 9931045

Browse files
authored
feat: initial release (#1)
1 parent 145690d commit 9931045

28 files changed

+612
-199
lines changed

.github/settings.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ repository:
1515
# By changing this field, you rename the repository.
1616

1717
# Uncomment this name property and set the name to the current repo name.
18-
# name: ""
18+
name: "terraform-ibm-secrets-manager"
1919

2020
# The description is displayed under the repository name on the
2121
# organization page and in the 'About' section of the repository.
2222

2323
# Uncomment this description property
2424
# and update the description to the current repo description.
25-
# description: ""
25+
description: "This module creates a Secrets Manager instance"
2626

2727
# Use a comma-separated list of topics to set on the repo (ensure not to use any caps in the topic string).
28-
topics: terraform, ibm-cloud, terraform-module
28+
topics: core-team, terraform, ibm-cloud, terraform-module, secrets-manager, supported, graduated

.secrets.baseline

Lines changed: 13 additions & 2 deletions
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": "2023-06-03T04:42:19Z",
6+
"generated_at": "2023-11-29T09:46:00Z",
77
"plugins_used": [
88
{
99
"name": "AWSKeyDetector"
@@ -76,7 +76,18 @@
7676
"name": "TwilioKeyDetector"
7777
}
7878
],
79-
"results": {},
79+
"results": {
80+
"README.md": [
81+
{
82+
"hashed_secret": "33da8d0e8af2efc260f01d8e5edfcc5c5aba44ad",
83+
"is_secret": true,
84+
"is_verified": false,
85+
"line_number": 32,
86+
"type": "Secret Keyword",
87+
"verified_result": null
88+
}
89+
]
90+
},
8091
"version": "0.13.1+ibm.61.dss",
8192
"word_list": {
8293
"file": null,

README.md

Lines changed: 50 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
11
# Secrets Manager module
22

3-
<!--
4-
Update status and "latest release" badges:
5-
1. For the status options, see https://github.ibm.com/GoldenEye/documentation/blob/master/status.md
6-
2. Update the "latest release" badge to point to the correct module's repo. Replace "module-template" in two places.
7-
-->
8-
[![Incubating (Not yet consumable)](https://img.shields.io/badge/status-Incubating%20(Not%20yet%20consumable)-red)](https://terraform-ibm-modules.github.io/documentation/#/badge-status)
3+
4+
[![Graduated (Supported)](https://img.shields.io/badge/Status-Graduated%20(Supported)-brightgreen)](https://terraform-ibm-modules.github.io/documentation/#/badge-status)
95
[![latest release](https://img.shields.io/github/v/release/terraform-ibm-modules/terraform-ibm-secrets-manager?logo=GitHub&sort=semver)](https://github.com/terraform-ibm-modules/terraform-ibm-secrets-manager/releases/latest)
106
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit)
117
[![Renovate enabled](https://img.shields.io/badge/renovate-enabled-brightgreen.svg)](https://renovatebot.com/)
128
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
139

1410
<!-- Add a description of module(s) in this repo -->
15-
TODO: Replace me with description of the module(s) in this repo
11+
This module is used to provision and configure an IBM Cloud [Secrets Manager](https://cloud.ibm.com/docs/secrets-manager?topic=secrets-manager-getting-started) instance.
1612

1713

1814
<!-- Below content is automatically populated via pre-commit hook -->
@@ -21,64 +17,43 @@ TODO: Replace me with description of the module(s) in this repo
2117
* [terraform-ibm-secrets-manager](#terraform-ibm-secrets-manager)
2218
* [Examples](./examples)
2319
* [Basic example](./examples/basic)
24-
* [Complete example](./examples/complete)
20+
* [Complete example with BYOK encryption](./examples/complete)
21+
* [Complete example with private only instance and KYOK encryption](./examples/complete-private)
2522
* [Contributing](#contributing)
2623
<!-- END OVERVIEW HOOK -->
2724

2825

29-
<!--
30-
If this repo contains any reference architectures, uncomment the heading below and links to them.
31-
(Usually in the `/reference-architectures` directory.)
32-
See "Reference architecture" in Authoring Guidelines in the public documentation at
33-
https://terraform-ibm-modules.github.io/documentation/#/implementation-guidelines?id=reference-architecture
34-
-->
35-
<!-- ## Reference architectures -->
36-
37-
38-
<!-- This heading should always match the name of the root level module (aka the repo name) -->
3926
## terraform-ibm-secrets-manager
4027

4128
### Usage
4229

43-
<!--
44-
Add an example of the use of the module in the following code block.
45-
46-
Use real values instead of "var.<var_name>" or other placeholder values
47-
unless real values don't help users know what to change.
48-
-->
49-
5030
```hcl
51-
31+
provider "ibm" {
32+
ibmcloud_api_key = "XXXXXXXXXXXXXX"
33+
region = "us-south"
34+
}
35+
module "secrets_manager" {
36+
source = "terraform-ibm-modules/secrets-manager/ibm"
37+
version = "X.X.X" # Replace "X.X.X" with a release version to lock into a specific release
38+
resource_group_id = "xxXXxxXXxXxXXXXxxXxxxXXXXxXXXXX"
39+
region = "us-south"
40+
secrets_manager_name = "my-secrets-manager"
41+
sm_service_plan = "trial"
42+
service_endpoints = "public-and-private"
43+
}
5244
```
5345

54-
### Required IAM access policies
55-
56-
<!-- PERMISSIONS REQUIRED TO RUN MODULE
57-
If this module requires permissions, uncomment the following block and update
58-
the sample permissions, following the format.
59-
Replace the sample Account and IBM Cloud service names and roles with the
60-
information in the console at
61-
Manage > Access (IAM) > Access groups > Access policies.
62-
-->
6346

64-
<!--
47+
## Required IAM access policies
6548
You need the following permissions to run this module.
6649

6750
- Account Management
68-
- **Sample Account Service** service
69-
- `Editor` platform access
70-
- `Manager` service access
51+
- **Resource Group** service
52+
- `Viewer` platform access
7153
- IAM Services
72-
- **Sample Cloud Service** service
54+
- **Secrets Manager** service
7355
- `Administrator` platform access
74-
-->
75-
76-
<!-- NO PERMISSIONS FOR MODULE
77-
If no permissions are required for the module, uncomment the following
78-
statement instead the previous block.
79-
-->
80-
81-
<!-- No permissions are needed to run this module.-->
56+
- `Manager` service access
8257

8358

8459
<!-- Below content is automatically populated via pre-commit hook -->
@@ -87,23 +62,45 @@ statement instead the previous block.
8762

8863
| Name | Version |
8964
|------|---------|
90-
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.3.0, <1.6.0 |
65+
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= v1.0.0, <1.6.0 |
66+
| <a name="requirement_ibm"></a> [ibm](#requirement\_ibm) | >= 1.56.1, < 2.0.0 |
67+
| <a name="requirement_time"></a> [time](#requirement\_time) | >= 0.9.1, < 1.0.0 |
9168

9269
### Modules
9370

94-
No modules.
71+
| Name | Source | Version |
72+
|------|--------|---------|
73+
| <a name="module_cbr_rule"></a> [cbr\_rule](#module\_cbr\_rule) | terraform-ibm-modules/cbr/ibm//modules/cbr-rule-module | 1.16.0 |
9574

9675
### Resources
9776

98-
No resources.
77+
| Name | Type |
78+
|------|------|
79+
| [ibm_iam_authorization_policy.policy](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/resources/iam_authorization_policy) | resource |
80+
| [ibm_resource_instance.secrets_manager_instance](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/resources/resource_instance) | resource |
81+
| [time_sleep.wait_for_authorization_policy](https://registry.terraform.io/providers/hashicorp/time/latest/docs/resources/sleep) | resource |
9982

10083
### Inputs
10184

102-
No inputs.
85+
| Name | Description | Type | Default | Required |
86+
|------|-------------|------|---------|:--------:|
87+
| <a name="input_cbr_rules"></a> [cbr\_rules](#input\_cbr\_rules) | (Optional, list) List of CBR rules to create | <pre>list(object({<br> description = string<br> account_id = string<br> rule_contexts = list(object({<br> attributes = optional(list(object({<br> name = string<br> value = string<br> }))) }))<br> enforcement_mode = string<br> }))</pre> | `[]` | no |
88+
| <a name="input_existing_kms_instance_guid"></a> [existing\_kms\_instance\_guid](#input\_existing\_kms\_instance\_guid) | The GUID of the Hyper Protect Crypto Services or Key Protect instance in which the key specified in `kms_key_crn` is coming from. Required only if `kms_encryption_enabled` is set to true, and `skip_iam_authorization_policy` is set to false. | `string` | `null` | no |
89+
| <a name="input_kms_encryption_enabled"></a> [kms\_encryption\_enabled](#input\_kms\_encryption\_enabled) | Set this to true to control the encryption keys used to encrypt the data that you store in Secrets Manager. If set to false, the data that you store is encrypted at rest by using envelope encryption. For more details, see https://cloud.ibm.com/docs/secrets-manager?topic=secrets-manager-mng-data&interface=ui#about-encryption. | `bool` | `false` | no |
90+
| <a name="input_kms_key_crn"></a> [kms\_key\_crn](#input\_kms\_key\_crn) | The root key CRN of a Key Management Service like Key Protect or Hyper Protect Crypto Services (HPCS) that you want to use for encryption. Only used if `kms_encryption_enabled` is set to true. | `string` | `null` | no |
91+
| <a name="input_region"></a> [region](#input\_region) | The region to provision the Secrets Manager instance to. | `string` | n/a | yes |
92+
| <a name="input_resource_group_id"></a> [resource\_group\_id](#input\_resource\_group\_id) | The ID of the resource group to provision the Secrets Manager instance to. | `string` | n/a | yes |
93+
| <a name="input_secrets_manager_name"></a> [secrets\_manager\_name](#input\_secrets\_manager\_name) | The name to give the Secrets Manager instance. | `string` | n/a | yes |
94+
| <a name="input_service_endpoints"></a> [service\_endpoints](#input\_service\_endpoints) | The types of service endpoints to set on the Secrets Manager instance. Possible values are `public`, `private` or `public-and-private`. | `string` | `"public-and-private"` | no |
95+
| <a name="input_skip_iam_authorization_policy"></a> [skip\_iam\_authorization\_policy](#input\_skip\_iam\_authorization\_policy) | Set to true to skip the creation of an IAM authorization policy that permits all Secrets Manager instances in the resource group to read the encryption key from the KMS instance. If set to false, pass in a value for the KMS instance in the `existing_kms_instance_guid` variable. In addition, no policy is created if `kms_encryption_enabled` is set to false. | `bool` | `false` | no |
96+
| <a name="input_sm_service_plan"></a> [sm\_service\_plan](#input\_sm\_service\_plan) | The Secrets Manager plan to provision. | `string` | `"standard"` | no |
97+
| <a name="input_sm_tags"></a> [sm\_tags](#input\_sm\_tags) | The list of resource tags that you want to associate with your Secrets Manager instance. | `list(string)` | `[]` | no |
10398

10499
### Outputs
105100

106-
No outputs.
101+
| Name | Description |
102+
|------|-------------|
103+
| <a name="output_secrets_manager_guid"></a> [secrets\_manager\_guid](#output\_secrets\_manager\_guid) | GUID of Secrets-Manager instance |
107104
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
108105

109106
<!-- Leave this section as is so that your module has a link to local development environment set up steps for contributors to follow -->

examples/basic/README.md

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
# Basic example
22

3-
<!--
4-
The basic example should call the module(s) stored in this repository with a basic configuration.
5-
Note, there is a pre-commit hook that will take the title of each example and include it in the repos main README.md.
6-
The text below should describe exactly what resources are provisioned / configured by the example.
7-
-->
3+
A simple example that shows how to provision a basic Trial instance of Secrets Manager.
84

9-
An end-to-end basic example that will provision the following:
10-
- A new resource group if one is not passed in.
11-
- A new Cloud Object Storage instance.
5+
The following resources are provisioned by this example:
6+
7+
- A new resource group, if an existing one is not passed in.
8+
- A Trial instance of Secrets Manager.

examples/basic/main.tf

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
########################################################################################################################
2-
# Resource group
3-
########################################################################################################################
4-
51
module "resource_group" {
62
source = "terraform-ibm-modules/resource-group/ibm"
73
version = "1.1.4"
@@ -10,15 +6,11 @@ module "resource_group" {
106
existing_resource_group_name = var.resource_group
117
}
128

13-
########################################################################################################################
14-
# COS instance
15-
########################################################################################################################
16-
17-
resource "ibm_resource_instance" "cos_instance" {
18-
name = "${var.prefix}-cos"
19-
resource_group_id = module.resource_group.resource_group_id
20-
service = "cloud-object-storage"
21-
plan = "standard"
22-
location = "global"
23-
tags = var.resource_tags
9+
module "secrets_manager" {
10+
source = "../.."
11+
resource_group_id = module.resource_group.resource_group_id
12+
region = var.region
13+
secrets_manager_name = "${var.prefix}-secrets-manager" #tfsec:ignore:general-secrets-no-plaintext-exposure
14+
sm_service_plan = "trial"
15+
sm_tags = var.resource_tags
2416
}

examples/basic/outputs.tf

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,4 @@
1-
########################################################################################################################
2-
# Outputs
3-
########################################################################################################################
4-
5-
output "cos_instance_id" {
6-
description = "COS instance id"
7-
value = ibm_resource_instance.cos_instance.id
8-
}
9-
10-
output "resource_group_name" {
11-
description = "Resource group name"
12-
value = module.resource_group.resource_group_name
13-
}
14-
15-
output "resource_group_id" {
16-
description = "Resource group ID"
17-
value = module.resource_group.resource_group_id
1+
output "secrets_manager_guid" {
2+
value = module.secrets_manager.secrets_manager_guid
3+
description = "GUID of Secrets Manager instance."
184
}

examples/basic/provider.tf

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
########################################################################################################################
2-
# Provider config
3-
########################################################################################################################
4-
51
provider "ibm" {
62
ibmcloud_api_key = var.ibmcloud_api_key
73
region = var.region

examples/basic/variables.tf

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,24 @@
1-
########################################################################################################################
2-
# Input variables
3-
########################################################################################################################
4-
51
variable "ibmcloud_api_key" {
62
type = string
7-
description = "The IBM Cloud API Key"
3+
description = "The IBM Cloud API key this account authenticates to"
84
sensitive = true
95
}
106

11-
variable "region" {
7+
variable "prefix" {
128
type = string
13-
description = "Region to provision all resources created by this example"
14-
default = "us-south"
9+
description = "Prefix for sm instance"
10+
default = "secrets-manager-test"
1511
}
1612

17-
variable "prefix" {
13+
variable "region" {
1814
type = string
19-
description = "Prefix to append to all resources created by this example"
20-
default = "basic"
15+
description = "Region where resources will be created"
16+
default = "us-east"
2117
}
2218

2319
variable "resource_group" {
2420
type = string
25-
description = "The name of an existing resource group to provision resources in to. If not set a new resource group will be created using the prefix variable"
21+
description = "An existing resource group name to use for this example, if unset a new resource group will be created"
2622
default = null
2723
}
2824

examples/basic/version.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
terraform {
2-
required_version = ">= 1.3.0, <1.6.0"
2+
required_version = ">= v1.0.0, <1.6.0"
33

44
# Ensure that there is always 1 example locked into the lowest provider version of the range defined in the main
5-
# module's version.tf (usually a basic example), and 1 example that will always use the latest provider version.
5+
# module's version.tf (this example), and 1 example that will always use the latest provider version (complete example).
66
required_providers {
77
ibm = {
88
source = "IBM-Cloud/ibm"
9-
version = "1.49.0"
9+
version = "1.56.1"
1010
}
1111
}
1212
}

0 commit comments

Comments
 (0)