Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: onboarding module to ibm registery #484

Merged
merged 4 commits into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion .secrets.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"files": "go.sum|^.secrets.baseline$",
"lines": null
},
"generated_at": "2023-06-10T00:13:05Z",
"generated_at": "2023-11-22T11:03:19Z",
"plugins_used": [
{
"name": "AWSKeyDetector"
Expand Down Expand Up @@ -86,6 +86,16 @@
"type": "Secret Keyword",
"verified_result": null
}
],
"ibm_catalog.json": [
{
"hashed_secret": "2a66dd6b2184e0722c4f448eaac79a1897987a30",
"is_secret": false,
"is_verified": false,
"line_number": 21,
"type": "Secret Keyword",
"verified_result": null
}
]
},
"version": "0.13.1+ibm.61.dss",
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ You need the following permissions to run this module.
<!-- BEGIN EXAMPLES HOOK -->
## Examples

- [ End to end example with default values](examples/default)
- [ An example that uses existing KMS](examples/existing-kms)
- [ Basic example](examples/basic)
- [ Default example](examples/default)
rajatagarwal-ibm marked this conversation as resolved.
Show resolved Hide resolved
<!-- END EXAMPLES HOOK -->
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
### Requirements
Expand Down
6 changes: 6 additions & 0 deletions examples/basic/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Basic example

A simple example that shows how to create a key ring in an existing IBM Key Management Service (KMS) instance.

The following resources are provisioned by this example:
- A key ring in an existing Key Management Service (KMS) instance.
5 changes: 5 additions & 0 deletions examples/basic/catalogValidationValues.json.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"ibmcloud_api_key": $VALIDATION_APIKEY,
"existing_kms_instance_guid": $HPCS_US_SOUTH_GUID,
"prefix": $PREFIX
}
2 changes: 0 additions & 2 deletions examples/existing-kms/main.tf → examples/basic/main.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


##############################################################################
# Key Ring module
##############################################################################
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
15 changes: 8 additions & 7 deletions examples/default/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# End to end example with default values
# Default example
rajatagarwal-ibm marked this conversation as resolved.
Show resolved Hide resolved

An end-to-end example that uses the module's default variable values.
This example will:
- Create a new resource group (if existing one is not passed in).
- Create a new KMS (Key Protect) instance in the region and resource group provided.
- Create a Key Ring within the KMS Instance.
- Create a Key within the KMS Key Ring and Instance.
A simple example that shows how to create a key ring in an IBM Key Management Service (KMS) instance.
rajatagarwal-ibm marked this conversation as resolved.
Show resolved Hide resolved

The following resources are provisioned by this example:
- A new resource group, if an existing one is not passed in.
- An IBM Key Protect instance.
- A key ring in the IBM Key Protect instance.
- A key within the key ring.
3 changes: 0 additions & 3 deletions examples/existing-kms/README.md

This file was deleted.

51 changes: 51 additions & 0 deletions ibm_catalog.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"products": [
{
"name": "terraform-ibm-kms-key-ring",
"label": "KMS Key Ring module",
"product_kind": "module",
"tags": [
"dev_ops",
"target_terraform",
"terraform",
"module"
],
"keywords": [
"terraform",
"key protect",
"hpcs",
"key ring",
"encryption"
],
"short_description": "Terraform module to create a key ring in an IBM Key Management Service",
"long_description": "Use this module to create a key ring to help organize keys in an IBM Key Management Services (KMS) instance. The KMS can be IBM Key Protect or IBM Cloud Hyper Protect Crypto Services(HPCS) instance. For more information, about key rings, see creating key rings in Key Protect (https://cloud.ibm.com/docs/key-protect?topic=key-protect-grouping-keys#create-key-ring-api) instance and managing key rings in HPCS (https://cloud.ibm.com/docs/hs-crypto?topic=hs-crypto-managing-key-rings&interface=ui) instance.\n\n#### Usage\n```hcl\nprovider \"ibm\" {\n ibmcloud_api_key = \"XXXXXXXXXX\"\n # Must be the same region the KMS instance is in\n region = \"us-south\"\n}\n\nmodule \"kms_key_ring\" {\n # Replace \"X.X.X\" with a release version to lock into a specific release\n source = \"https://cm.globalcatalog.cloud.ibm.com/api/v1-beta/offering/source?archive=tgz&kind=terraform&name=terraform-ibm-kms-key-ring&version=X.X.X\"\n instance_id = \"XXxxXXxx-xxxx-XXXX-xxxx-XXxxXXxx\"\n key_ring_id = \"my-key-ring\"\n}\n```",
rajatagarwal-ibm marked this conversation as resolved.
Show resolved Hide resolved
"offering_docs_url": "https://github.com/terraform-ibm-modules/terraform-ibm-key-protect/blob/main/README.md",
"offering_icon_url": "https://raw.githubusercontent.com/terraform-ibm-modules/documentation/main/icons/key_protect_icon.svg",
"features": [
{
"title": "Create a key ring",
rajatagarwal-ibm marked this conversation as resolved.
Show resolved Hide resolved
"description": "Create a key ring in an IBM Key Management Service (KMS) instance."
}
],
"flavors": [
rajatagarwal-ibm marked this conversation as resolved.
Show resolved Hide resolved
{
"label": "Basic",
"name": "basic",
"working_directory": "examples/basic",
"architecture": {
"diagrams": [
{
"diagram": {
"caption": "Basic example",
"url": "https://raw.githubusercontent.com/terraform-ibm-modules/documentation/main/icons/ModuleExampleDiagram.svg",
"type": "image/svg+xml"
},
"description": "A simple example that shows how to create a key ring in an existing IBM Hyper Protect Crypto Service (HPCS) instance."
}
]
}
}
]
}
]
}
6 changes: 3 additions & 3 deletions tests/pr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
// Use existing resource group for tests
const resourceGroup = "geretain-test-key-protect-key-ring"
const defaultExampleTerraformDir = "examples/default"
const existingKmsExampleTerraformDir = "examples/existing-kms"
const basicExampleTerraformDir = "examples/basic"

// Define a struct with fields that match the structure of the YAML data
const yamlLocation = "../common-dev-assets/common-go-assets/common-permanent-resources.yaml"
Expand Down Expand Up @@ -53,12 +53,12 @@ func TestRunDefaultExample(t *testing.T) {
assert.NotNil(t, output, "Expected some output")
}

func TestRunExistingKMSExample(t *testing.T) {
func TestRunBasicExample(t *testing.T) {
t.Parallel()

options := testhelper.TestOptionsDefault(&testhelper.TestOptions{
Testing: t,
TerraformDir: existingKmsExampleTerraformDir,
TerraformDir: basicExampleTerraformDir,
Prefix: "hpcs",
TerraformVars: map[string]interface{}{
"existing_kms_instance_guid": permanentResources["hpcs_south"],
Expand Down