Skip to content
This repository was archived by the owner on Jul 3, 2023. It is now read-only.

Commit cd77e66

Browse files
kavya498hkantare
authored andcommitted
Support: KMS Modules
1 parent df1482f commit cd77e66

29 files changed

+787
-0
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
terraform.tfstate
2+
terraform.tfstate.backup
3+
terraform.tfplan
4+
.terraform.tfstate.lock.info
5+
.terraform

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
Extending the adopted spec, each change should have a link to its
6+
corresponding pull request appended.
7+
8+
## [1.0.0] - 2020-02-10
9+
10+
This is the initial release of the module, with support for IBM-Cloud Key Management services

CONTRIBUTING.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Contributing
2+
3+
This document provides guidelines for contributing to the module. When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change.
4+
5+
## File structure
6+
7+
The project has the following folders and files:
8+
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
9+
```
10+
├── README.md
11+
├── modules/
12+
│ ├── nestedA/
13+
│ │ ├── README.md
14+
│ │ ├── variables.tf
15+
│ │ ├── main.tf
16+
│ │ ├── outputs.tf
17+
│ ├── nestedB/
18+
│ ├── .../
19+
├── examples/
20+
│ ├── exampleA/
21+
│ │ ├── main.tf
22+
│ ├── exampleB/
23+
│ ├── .../
24+
25+
```
26+
27+
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
28+
29+
Please make sure you are changes are inline with directory structure mentined as above.

README.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,66 @@
11
# terraform-ibm-kms
22
Terraform modules to create and work with IBM Key Management Service
3+
4+
The supported modules are
5+
* [Provisioning Key protect Instance](./modules/instance)
6+
* [Creating or Importing Key Protect Key](./modules/key)
7+
8+
## Example Usage
9+
```
10+
data "ibm_resource_group" "resource_group" {
11+
name = var.resource_group
12+
}
13+
14+
module "kms_instance" {
15+
source = "terraform-ibm-modules/kms/ibm//modules/instance"
16+
resource_group_id = data.ibm_resource_group.resource_group.id
17+
service_name = var.service_name
18+
location = var.location
19+
plan = "tiered-pricing"
20+
tags = var.tags
21+
allowed_network_policy = var.allowed_network_policy
22+
}
23+
24+
module "kms_key" {
25+
source = "terraform-ibm-modules/kms/ibm//modules/key"
26+
kms_instance_guid = module.kms_instance.kms_instance-guid
27+
name = var.name
28+
standard_key_type = var.standard_key_type
29+
force_delete = var.force_delete
30+
network_access_allowed = var.network_access_allowed
31+
}
32+
33+
```
34+
35+
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
36+
## Inputs
37+
| Name | Description | Type |Default |Required |
38+
|--------------------------|----------------------------------------------------------------|:-------|:--------|:--------|
39+
| resource\_group | Name of the resource group |`string`| n/a | yes |
40+
| service_name | A descriptive name used to identify the resource instance |`string`| n/a | yes |
41+
| location | Target location or environment to create the resource instance |`string`| n/a | yes |
42+
| tags | Tags for the KMS Instance |`set` | n/a | no |
43+
| allowed_network_policy | Types of the service endpoints. |`string`| n/a | no |
44+
| kms_instance_guid | GUID of the Instance |`string`| n/a | yes |
45+
| name | Name of the Key |`string`| n/a | yes |
46+
| standard_key_type | Determines if it has to be a standard key or root key |`bool` | false | no |
47+
| force_delete | Determines if it has to be force deleted |`bool` | false | no |
48+
| network_access_allowed | public or private |`string`| `public`| no |
49+
50+
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
51+
52+
## Usage
53+
54+
To run this example you need to execute:
55+
56+
```bash
57+
$ terraform init
58+
$ terraform plan
59+
$ terraform apply
60+
```
61+
62+
Run `terraform destroy` when you don't need these resources.
63+
64+
## Note:
65+
* All optional fields are given value `null` in varaible.tf file. User can configure the same by overwriting with appropriate values.
66+
* Provide `version` attribute in terraform block in versions.tf file to use specific version of terraform provider

examples/import-key/README.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# KMS instance KMS Key Example
2+
3+
This example is used to create a standard or root key on KMS Instance
4+
## Example Usage
5+
```
6+
data "ibm_resource_group" "resource_group" {
7+
name = var.resource_group
8+
}
9+
10+
module "kms_instance" {
11+
source = "terraform-ibm-modules/kms/ibm//modules/instance"
12+
resource_group_id = data.ibm_resource_group.resource_group.id
13+
service_name = var.service_name
14+
location = var.location
15+
plan = "tiered-pricing"
16+
tags = var.tags
17+
allowed_network_policy = var.allowed_network_policy
18+
}
19+
20+
module "kms_key" {
21+
source = "terraform-ibm-modules/kms/ibm//modules/key"
22+
kms_instance_guid = module.kms_instance.kms_instance-guid
23+
name = var.name
24+
standard_key_type = var.standard_key_type
25+
force_delete = var.force_delete
26+
network_access_allowed = var.network_access_allowed
27+
}
28+
29+
```
30+
31+
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
32+
## Inputs
33+
| Name | Description | Type |Default |Required |
34+
|--------------------------|----------------------------------------------------------------|:-------|:--------|:--------|
35+
| resource\_group | Name of the resource group |`string`| n/a | yes |
36+
| service_name | A descriptive name used to identify the resource instance |`string`| n/a | yes |
37+
| location | Target location or environment to create the resource instance |`string`| n/a | yes |
38+
| tags | Tags for the KMS Instance |`set` | n/a | no |
39+
| allowed_network_policy | Types of the service endpoints. |`string`| n/a | no |
40+
| kms_instance_guid | GUID of the Instance |`string`| n/a | yes |
41+
| name | Name of the Key |`string`| n/a | yes |
42+
| standard_key_type | Determines if it has to be a standard key or root key |`bool` | false | no |
43+
| force_delete | Determines if it has to be force deleted |`bool` | false | no |
44+
| network_access_allowed | public or private |`string`| `public`| no |
45+
| key_material | Key Payload. |`string`| n/a | yes |
46+
47+
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
48+
49+
## Usage
50+
51+
To run this example you need to execute:
52+
53+
```bash
54+
$ terraform init
55+
$ terraform plan
56+
$ terraform apply
57+
```
58+
59+
Run `terraform destroy` when you don't need these resources.
60+
61+
## Note:
62+
* All optional fields are given value `null` in varaible.tf file. User can configure the same by overwriting with appropriate values.
63+
* Provide `version` attribute in terraform block in versions.tf file to use specific version of terraform provider

examples/import-key/main.tf

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#########################################################################################
2+
# IBM Cloud Key Management Services Provisioning and Managing Keys
3+
# Copyright 2021 IBM
4+
#########################################################################################
5+
data "ibm_resource_group" "resource_group" {
6+
name = var.resource_group
7+
}
8+
9+
module "kms_instance" {
10+
source = "terraform-ibm-modules/kms/ibm//modules/instance"
11+
resource_group_id = data.ibm_resource_group.resource_group.id
12+
service_name = var.service_name
13+
location = var.location
14+
plan = "tiered-pricing"
15+
tags = var.tags
16+
allowed_network_policy = var.allowed_network_policy
17+
}
18+
19+
module "kms_key" {
20+
source = "terraform-ibm-modules/kms/ibm//modules/key"
21+
kms_instance_guid = module.kms_instance.kms_instance-guid
22+
name = var.name
23+
standard_key_type = var.standard_key_type
24+
force_delete = var.force_delete
25+
network_access_allowed = var.network_access_allowed
26+
key_material = var.key_material
27+
}

examples/import-key/outputs.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#########################################################################################
2+
# IBM Cloud Key Management Services Provisioning and Managing Keys
3+
# Copyright 2021 IBM
4+
#########################################################################################
5+
output "kms-key_ouput" {
6+
value = module.kms_key
7+
}

examples/import-key/variables.tf

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#########################################################################################
2+
# IBM Cloud Key Management Services Provisioning and Managing Keys
3+
# Copyright 2021 IBM
4+
#########################################################################################
5+
6+
variable "resource_group" {
7+
type = string
8+
description = "Resource group of instance"
9+
}
10+
variable "service_name" {
11+
type = string
12+
description = "Name of KMS Instance"
13+
}
14+
variable "location" {
15+
type = string
16+
description = "Location of KMS Instance"
17+
}
18+
variable "allowed_network_policy" {
19+
default = null
20+
type = string
21+
description = "Types of the service endpoints. Possible values are 'private', 'public-and-private'."
22+
}
23+
variable "tags" {
24+
default = null
25+
type = set(string)
26+
description = "Tags for the cms"
27+
}
28+
variable "name" {
29+
description = "Name of the Key"
30+
type = string
31+
}
32+
variable "network_access_allowed" {
33+
description = "Endpoint type of the Key"
34+
type = string
35+
default = null
36+
}
37+
variable "standard_key_type" {
38+
description = "Determines if it is a standard key or not"
39+
default = null
40+
type = bool
41+
}
42+
variable "force_delete" {
43+
description = "Determines if it has to be force deleted"
44+
default = null
45+
type = bool
46+
}
47+
variable "key_material" {
48+
description = "key_material of the Key"
49+
type = string
50+
}

examples/import-key/versions.tf

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#########################################################################################
2+
# IBM Cloud Key Management Services Provisioning and Managing Keys
3+
# Copyright 2021 IBM
4+
#########################################################################################
5+
terraform {
6+
required_providers {
7+
ibm = {
8+
source = "IBM-Cloud/ibm"
9+
}
10+
}
11+
}

examples/instance/README.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# KMS instance KMS Key Example
2+
3+
This example is used to create a KMS Instance
4+
## Example Usage
5+
```
6+
data "ibm_resource_group" "resource_group" {
7+
name = var.resource_group
8+
}
9+
10+
module "kms_instance" {
11+
source = "terraform-ibm-modules/kms/ibm//modules/instance"
12+
resource_group_id = data.ibm_resource_group.resource_group.id
13+
service_name = var.service_name
14+
location = var.location
15+
plan = "tiered-pricing"
16+
tags = var.tags
17+
allowed_network_policy = var.allowed_network_policy
18+
}
19+
20+
```
21+
22+
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
23+
## Inputs
24+
| Name | Description | Type |Default |Required |
25+
|--------------------------|----------------------------------------------------------------|:-------|:--------|:--------|
26+
| resource\_group | Name of the resource group |`string`| n/a | yes |
27+
| service_name | A descriptive name used to identify the resource instance |`string`| n/a | yes |
28+
| location | Target location or environment to create the resource instance |`string`| n/a | yes |
29+
| tags | Tags for the KMS Instance |`set` | n/a | no |
30+
| allowed_network_policy | Types of the service endpoints. |`string`| n/a | no |
31+
32+
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
33+
34+
## Usage
35+
36+
To run this example you need to execute:
37+
38+
```bash
39+
$ terraform init
40+
$ terraform plan
41+
$ terraform apply
42+
```
43+
44+
Run `terraform destroy` when you don't need these resources.
45+
46+
## Note:
47+
* All optional fields are given value `null` in varaible.tf file. User can configure the same by overwriting with appropriate values.
48+
* Provide `version` attribute in terraform block in versions.tf file to use specific version of terraform provider

0 commit comments

Comments
 (0)