Skip to content

Commit 705ddc1

Browse files
feat: renamed module to terraform-ibm-kms-key as official support added for HPCS (#398)
1 parent f5f3e42 commit 705ddc1

File tree

12 files changed

+117
-79
lines changed

12 files changed

+117
-79
lines changed

.github/settings.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ 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: "terraform-ibm-key-protect-key"
18+
name: "terraform-ibm-kms-key"
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: "Module for creation of Key Protect keys"
26-
topics: core-team, terraform, ibm-cloud, terraform-module, key-protect, kms
25+
description: "Module for creation of KMS keys"
26+
topics: core-team, terraform, ibm-cloud, terraform-module, key-protect, kms, hpcs

README.md

+16-16
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
1-
# Key Protect key module
1+
# KMS key module
22

33
[![Stable (With quality checks)](https://img.shields.io/badge/Status-Stable%20(With%20quality%20checks)-green?style=plastic)](https://terraform-ibm-modules.github.io/documentation/#/badge-status)
44
[![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)
55
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit)
6-
[![latest release](https://img.shields.io/github/v/release/terraform-ibm-modules/terraform-ibm-key-protect-key?logo=GitHub&sort=semver)](https://github.com/terraform-ibm-modules/terraform-ibm-key-protect-key/releases/latest)
6+
[![latest release](https://img.shields.io/github/v/release/terraform-ibm-modules/terraform-ibm-kms-key?logo=GitHub&sort=semver)](https://github.com/terraform-ibm-modules/terraform-ibm-kms-key/releases/latest)
77
[![Renovate enabled](https://img.shields.io/badge/renovate-enabled-brightgreen.svg)](https://renovatebot.com/)
88

9-
This module supports creating a standard or root key in an existing key ring and Key Protect instance. You can specify rotation and deletion policies.
9+
This module supports creating a standard or root key in an existing key ring and KMS instance. KMS can be Key Protect or Hyper Protect Crypto Services(HPCS) instance. You can specify rotation and deletion policies for the keys.
1010

1111
## Usage
1212

1313
```hcl
1414
provider "ibm" {
1515
ibmcloud_api_key = "XXXXXXXXXX"
16-
# Must be the same region the Key Protect instance is in
16+
# Must be the same region the KMS instance is in
1717
region = "us-south"
1818
}
1919
20-
# Key Protect root key
21-
module "key_protect_root_key" {
22-
source = "terraform-ibm-modules/key-protect-key/ibm"
20+
# KMS root key
21+
module "kms_root_key" {
22+
source = "terraform-ibm-modules/kms-key/ibm"
2323
version = "latest" # Replace "latest" with a release version to lock into a specific release
24-
key_protect_instance_id = ibm_resource_instance.key_protect_instance.guid
24+
kms_instance_id = ibm_resource_instance.kms_instance.guid
2525
key_name = "my-root-key"
2626
}
2727
28-
# Key Protect standard key
29-
module "key_protect_standard_key" {
30-
source = "terraform-ibm-modules/key-protect-key/ibm"
28+
# KMS standard key
29+
module "kms_standard_key" {
30+
source = "terraform-ibm-modules/kms-key/ibm"
3131
version = "latest" # Replace "latest" with a release version to lock into a specific release
32-
key_protect_instance_id = ibm_resource_instance.key_protect_instance.guid
32+
kms_instance_id = ibm_resource_instance.kms_instance.guid
3333
key_name = "my-standard-key"
3434
standard_key = true
3535
}
@@ -42,7 +42,7 @@ You need the following permissions to run this module.
4242
- **Resource Group** service
4343
- `Viewer` platform access
4444
- IAM Services
45-
- **Key Protect** service
45+
- **KMS** service
4646
- `Viewer` platform access
4747
- `Manager` service access
4848

@@ -76,12 +76,12 @@ No modules.
7676

7777
| Name | Description | Type | Default | Required |
7878
|------|-------------|------|---------|:--------:|
79-
| <a name="input_dual_auth_delete_enabled"></a> [dual\_auth\_delete\_enabled](#input\_dual\_auth\_delete\_enabled) | If set to true, Key Protect enables a dual authorization policy on a single key. Note: Once the dual authorization policy is set on the key, it cannot be reverted. A key with dual authorization policy enabled cannot be destroyed by using Terraform. | `bool` | `false` | no |
79+
| <a name="input_dual_auth_delete_enabled"></a> [dual\_auth\_delete\_enabled](#input\_dual\_auth\_delete\_enabled) | If set to true, KMS enables a dual authorization policy on a single key. Note: Once the dual authorization policy is set on the key, it cannot be reverted. A key with dual authorization policy enabled cannot be destroyed by using Terraform. | `bool` | `false` | no |
8080
| <a name="input_endpoint_type"></a> [endpoint\_type](#input\_endpoint\_type) | Endpoint to use when creating the Key | `string` | `"public"` | no |
8181
| <a name="input_force_delete"></a> [force\_delete](#input\_force\_delete) | Set as true to enable forcing deletion even if key is in use | `bool` | `false` | no |
8282
| <a name="input_key_name"></a> [key\_name](#input\_key\_name) | Name to give the key | `string` | n/a | yes |
83-
| <a name="input_key_protect_instance_id"></a> [key\_protect\_instance\_id](#input\_key\_protect\_instance\_id) | ID or GUID of Key Protect Instance | `string` | n/a | yes |
84-
| <a name="input_key_protect_key_ring_id"></a> [key\_protect\_key\_ring\_id](#input\_key\_protect\_key\_ring\_id) | The ID of the key ring where you want to add your Key Protect key | `string` | `"default"` | no |
83+
| <a name="input_kms_instance_id"></a> [kms\_instance\_id](#input\_kms\_instance\_id) | ID or GUID of KMS Instance | `string` | n/a | yes |
84+
| <a name="input_kms_key_ring_id"></a> [kms\_key\_ring\_id](#input\_kms\_key\_ring\_id) | The ID of the key ring where you want to add your KMS key | `string` | `"default"` | no |
8585
| <a name="input_rotation_interval_month"></a> [rotation\_interval\_month](#input\_rotation\_interval\_month) | The key rotation time interval in months. Rotation policy cannot be set for standard key, so value is ignored if var.standard\_key is true | `number` | `1` | no |
8686
| <a name="input_standard_key"></a> [standard\_key](#input\_standard\_key) | Set as true for Standard Key, false for Root Key | `bool` | `false` | no |
8787

examples/default/README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
An end-to-end example that uses the module's default variable values.
44
This example will:
55
- Create a new resource group (if existing one is not passed in).
6-
- Create a new Key Protect instance in the region and resource group provided.
7-
- Create a new Root Key in the Key Protect instance.
8-
- Create a new Standard Key in the Key Protect instance.
6+
- Create a new KMS (Key Protect) instance in the region and resource group provided.
7+
- Create a new Root Key in the KMS instance.
8+
- Create a new Standard Key in the KMS instance.

examples/default/main.tf

+12-12
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ module "resource_group" {
1111
}
1212

1313
##############################################################################
14-
# Key Protect instance
14+
# KMS (Key Protect) instance
1515
##############################################################################
1616

1717
resource "ibm_resource_instance" "key_protect_instance" {
@@ -24,22 +24,22 @@ resource "ibm_resource_instance" "key_protect_instance" {
2424
}
2525

2626
##############################################################################
27-
# Key Protect root key
27+
# KMS root key
2828
##############################################################################
2929

30-
module "key_protect_root_key" {
31-
source = "../.."
32-
key_protect_instance_id = ibm_resource_instance.key_protect_instance.guid
33-
key_name = "${var.prefix}-root-key"
30+
module "kms_root_key" {
31+
source = "../.."
32+
kms_instance_id = ibm_resource_instance.key_protect_instance.guid
33+
key_name = "${var.prefix}-root-key"
3434
}
3535

3636
##############################################################################
37-
# Key Protect standard key
37+
# KMS standard key
3838
##############################################################################
3939

40-
module "key_protect_standard_key" {
41-
source = "../.."
42-
key_protect_instance_id = ibm_resource_instance.key_protect_instance.guid
43-
key_name = "${var.prefix}-standard-key"
44-
standard_key = true
40+
module "kms_standard_key" {
41+
source = "../.."
42+
kms_instance_id = ibm_resource_instance.key_protect_instance.guid
43+
key_name = "${var.prefix}-standard-key"
44+
standard_key = true
4545
}

examples/default/outputs.tf

+10-10
Original file line numberDiff line numberDiff line change
@@ -13,33 +13,33 @@ output "instance_guid" {
1313
}
1414

1515
output "root_key_id" {
16-
description = "Key Protect Key ID"
17-
value = module.key_protect_root_key.key_id
16+
description = "Key Protect Root Key ID"
17+
value = module.kms_root_key.key_id
1818
}
1919

2020
output "root_key_rotation_interval_month" {
21-
description = "Month Interval for Rotation"
22-
value = module.key_protect_root_key.rotation_interval_month
21+
description = "Month Interval for Rotation of Root Key"
22+
value = module.kms_root_key.rotation_interval_month
2323
}
2424

2525
output "root_key_dual_auth_delete_enabled" {
2626
description = "Is Dual Auth Delete Enabled"
27-
value = module.key_protect_root_key.dual_auth_delete
27+
value = module.kms_root_key.dual_auth_delete
2828
}
2929

3030
output "standard_key_id" {
31-
description = "Key Protect Key ID"
32-
value = module.key_protect_standard_key.key_id
31+
description = "Key Protect Standard Key ID"
32+
value = module.kms_standard_key.key_id
3333
}
3434

3535
output "standard_key_rotation_interval_month" {
36-
description = "Month Interval for Rotation"
37-
value = module.key_protect_standard_key.rotation_interval_month
36+
description = "Month Interval for Rotation of Standard Key"
37+
value = module.kms_standard_key.rotation_interval_month
3838
}
3939

4040
output "standard_key_dual_auth_delete_enabled" {
4141
description = "Is Dual Auth Delete Enabled"
42-
value = module.key_protect_standard_key.dual_auth_delete
42+
value = module.kms_standard_key.dual_auth_delete
4343
}
4444

4545
output "resource_group_name" {

examples/default/variables.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ variable "region" {
1313
variable "prefix" {
1414
type = string
1515
description = "Prefix to append to all resources created by this example"
16-
default = "kp-key"
16+
default = "kms-key"
1717
}
1818

1919
variable "resource_group" {

examples/existing-kms/main.tf

+7-7
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@
33
##############################################################################
44

55
module "kms_root_key" {
6-
source = "../.."
7-
key_protect_instance_id = var.existing_kms_instance_guid
8-
key_name = "${var.prefix}-root-key"
6+
source = "../.."
7+
kms_instance_id = var.existing_kms_instance_guid
8+
key_name = "${var.prefix}-root-key"
99
}
1010

1111
##############################################################################
1212
# KMS standard key
1313
##############################################################################
1414

1515
module "kms_standard_key" {
16-
source = "../.."
17-
key_protect_instance_id = var.existing_kms_instance_guid
18-
key_name = "${var.prefix}-standard-key"
19-
standard_key = true
16+
source = "../.."
17+
kms_instance_id = var.existing_kms_instance_guid
18+
key_name = "${var.prefix}-standard-key"
19+
standard_key = true
2020
}

examples/existing-kms/outputs.tf

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
##############################################################################
44

55
output "root_key_id" {
6-
description = "Key Protect Key ID"
6+
description = "KMS Root Key ID"
77
value = module.kms_root_key.key_id
88
}
99

@@ -18,7 +18,7 @@ output "root_key_dual_auth_delete_enabled" {
1818
}
1919

2020
output "standard_key_id" {
21-
description = "Key Protect Key ID"
21+
description = "KMS Standard Key ID"
2222
value = module.kms_standard_key.key_id
2323
}
2424

main.tf

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
##############################################################################
2-
# Key Protect Key module
2+
# KMS Key module
33
##############################################################################
44

55
resource "ibm_kms_key" "key" {
6-
instance_id = var.key_protect_instance_id
6+
instance_id = var.kms_instance_id
77
key_name = var.key_name
8-
key_ring_id = var.key_protect_key_ring_id
8+
key_ring_id = var.kms_key_ring_id
99
standard_key = var.standard_key
1010
endpoint_type = var.endpoint_type
1111
force_delete = var.force_delete
@@ -14,7 +14,7 @@ resource "ibm_kms_key" "key" {
1414
resource "ibm_kms_key_policies" "root_key_policy" {
1515
count = var.standard_key ? 0 : 1
1616
endpoint_type = var.endpoint_type
17-
instance_id = var.key_protect_instance_id
17+
instance_id = var.kms_instance_id
1818
key_id = ibm_kms_key.key.key_id
1919
rotation {
2020
interval_month = var.rotation_interval_month
@@ -27,7 +27,7 @@ resource "ibm_kms_key_policies" "root_key_policy" {
2727
resource "ibm_kms_key_policies" "standard_key_policy" {
2828
count = var.standard_key ? 1 : 0
2929
endpoint_type = var.endpoint_type
30-
instance_id = var.key_protect_instance_id
30+
instance_id = var.kms_instance_id
3131
key_id = ibm_kms_key.key.key_id
3232
dual_auth_delete {
3333
enabled = var.dual_auth_delete_enabled

module-metadata.json

+11-11
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"dual_auth_delete_enabled": {
55
"name": "dual_auth_delete_enabled",
66
"type": "bool",
7-
"description": "If set to true, Key Protect enables a dual authorization policy on a single key. Note: Once the dual authorization policy is set on the key, it cannot be reverted. A key with dual authorization policy enabled cannot be destroyed by using Terraform.",
7+
"description": "If set to true, KMS enables a dual authorization policy on a single key. Note: Once the dual authorization policy is set on the key, it cannot be reverted. A key with dual authorization policy enabled cannot be destroyed by using Terraform.",
88
"default": false,
99
"pos": {
1010
"filename": "variables.tf",
@@ -55,10 +55,10 @@
5555
},
5656
"immutable": true
5757
},
58-
"key_protect_instance_id": {
59-
"name": "key_protect_instance_id",
58+
"kms_instance_id": {
59+
"name": "kms_instance_id",
6060
"type": "string",
61-
"description": "ID or GUID of Key Protect Instance",
61+
"description": "ID or GUID of KMS Instance",
6262
"required": true,
6363
"source": [
6464
"ibm_kms_key.key.instance_id",
@@ -75,10 +75,10 @@
7575
"service:kms|hs-crypto"
7676
]
7777
},
78-
"key_protect_key_ring_id": {
79-
"name": "key_protect_key_ring_id",
78+
"kms_key_ring_id": {
79+
"name": "kms_key_ring_id",
8080
"type": "string",
81-
"description": "The ID of the key ring where you want to add your Key Protect key",
81+
"description": "The ID of the key ring where you want to add your KMS key",
8282
"default": "default",
8383
"source": [
8484
"ibm_kms_key.key.key_ring_id"
@@ -174,9 +174,9 @@
174174
"attributes": {
175175
"endpoint_type": "endpoint_type",
176176
"force_delete": "force_delete",
177-
"instance_id": "key_protect_instance_id",
177+
"instance_id": "kms_instance_id",
178178
"key_name": "key_name",
179-
"key_ring_id": "key_protect_key_ring_id",
179+
"key_ring_id": "kms_key_ring_id",
180180
"standard_key": "standard_key"
181181
},
182182
"provider": {
@@ -194,7 +194,7 @@
194194
"attributes": {
195195
"count": "standard_key",
196196
"endpoint_type": "endpoint_type",
197-
"instance_id": "key_protect_instance_id"
197+
"instance_id": "kms_instance_id"
198198
},
199199
"provider": {
200200
"name": "ibm"
@@ -211,7 +211,7 @@
211211
"attributes": {
212212
"count": "standard_key",
213213
"endpoint_type": "endpoint_type",
214-
"instance_id": "key_protect_instance_id"
214+
"instance_id": "kms_instance_id"
215215
},
216216
"provider": {
217217
"name": "ibm"

0 commit comments

Comments
 (0)