Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: terraform-ibm-modules/terraform-ibm-secrets-manager-secret-group
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.2.2
Choose a base ref
...
head repository: terraform-ibm-modules/terraform-ibm-secrets-manager-secret-group
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v1.2.3
Choose a head ref

Commits on Jun 15, 2024

  1. Copy the full SHA
    8c43638 View commit details
  2. Copy the full SHA
    522fd77 View commit details

Commits on Jun 16, 2024

  1. Copy the full SHA
    9d38a4a View commit details

Commits on Jun 22, 2024

  1. Copy the full SHA
    07d8746 View commit details
  2. Copy the full SHA
    b64b05c View commit details

Commits on Jun 29, 2024

  1. Copy the full SHA
    4491163 View commit details
  2. Copy the full SHA
    91cc8d1 View commit details
  3. Copy the full SHA
    32935f3 View commit details

Commits on Jul 6, 2024

  1. Copy the full SHA
    4216892 View commit details
  2. Copy the full SHA
    dddd9f2 View commit details

Commits on Jul 12, 2024

  1. Update ibm_catalog.json (#189)

    * Update ibm_catalog.json
    
    * update baseline
    ocofaigh authored Jul 12, 2024
    Copy the full SHA
    94405e9 View commit details

Commits on Jul 13, 2024

  1. Copy the full SHA
    7c378e3 View commit details

Commits on Jul 20, 2024

  1. Copy the full SHA
    ed44a1e View commit details

Commits on Jul 27, 2024

  1. Copy the full SHA
    eae3db1 View commit details
  2. Copy the full SHA
    62ffc9b View commit details

Commits on Aug 3, 2024

  1. Copy the full SHA
    774d53a View commit details
  2. Copy the full SHA
    65e85ad View commit details

Commits on Aug 10, 2024

  1. Copy the full SHA
    2b31d9b View commit details
  2. Copy the full SHA
    b2f47fc View commit details

Commits on Aug 17, 2024

  1. Copy the full SHA
    80dbafa View commit details
  2. Copy the full SHA
    b34fa6b View commit details

Commits on Aug 18, 2024

  1. Copy the full SHA
    d611946 View commit details

Commits on Aug 24, 2024

  1. Copy the full SHA
    4678430 View commit details
  2. Copy the full SHA
    3d8942b View commit details

Commits on Aug 31, 2024

  1. Copy the full SHA
    5bc66d6 View commit details

Commits on Sep 7, 2024

  1. Copy the full SHA
    65e0bf8 View commit details

Commits on Sep 14, 2024

  1. Copy the full SHA
    b7f3b15 View commit details

Commits on Sep 21, 2024

  1. Copy the full SHA
    3b4da2d View commit details

Commits on Sep 28, 2024

  1. Copy the full SHA
    f833c0d View commit details

Commits on Oct 5, 2024

  1. Copy the full SHA
    d1c52a8 View commit details

Commits on Oct 6, 2024

  1. Copy the full SHA
    12ef079 View commit details

Commits on Oct 12, 2024

  1. Copy the full SHA
    bd18637 View commit details

Commits on Oct 19, 2024

  1. Copy the full SHA
    e04bd02 View commit details
  2. Copy the full SHA
    3f314fd View commit details

Commits on Oct 21, 2024

  1. Copy the full SHA
    9a9c0e1 View commit details

Commits on Oct 27, 2024

  1. Copy the full SHA
    8edd7ff View commit details
  2. Copy the full SHA
    3d6d18a View commit details

Commits on Nov 2, 2024

  1. Copy the full SHA
    35ff840 View commit details

Commits on Nov 9, 2024

  1. Copy the full SHA
    19a0ad9 View commit details

Commits on Nov 10, 2024

  1. Copy the full SHA
    7cce9a8 View commit details

Commits on Nov 23, 2024

  1. Copy the full SHA
    a674610 View commit details
  2. Copy the full SHA
    8866b3b View commit details

Commits on Nov 24, 2024

  1. Copy the full SHA
    3072573 View commit details

Commits on Nov 29, 2024

  1. Copy the full SHA
    bd97ed1 View commit details

Commits on Nov 30, 2024

  1. Copy the full SHA
    06ce643 View commit details

Commits on Dec 7, 2024

  1. Copy the full SHA
    5b36a46 View commit details
  2. Copy the full SHA
    cfd6d53 View commit details

Commits on Dec 14, 2024

  1. Copy the full SHA
    90bef4e View commit details
  2. Copy the full SHA
    94d2b85 View commit details

Commits on Dec 18, 2024

  1. Copy the full SHA
    7f83122 View commit details
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ on:

jobs:
call-terraform-ci-pipeline:
uses: terraform-ibm-modules/common-pipeline-assets/.github/workflows/common-terraform-module-ci-v2.yml@v1.22.3
uses: terraform-ibm-modules/common-pipeline-assets/.github/workflows/common-terraform-module-ci-v2.yml@v1.22.5
secrets: inherit
with:
craSCCv2: true
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -8,5 +8,5 @@ on:

jobs:
call-terraform-release-pipeline:
uses: terraform-ibm-modules/common-pipeline-assets/.github/workflows/common-release.yml@v1.22.3
uses: terraform-ibm-modules/common-pipeline-assets/.github/workflows/common-release.yml@v1.22.5
secrets: inherit
6 changes: 3 additions & 3 deletions .secrets.baseline
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
"files": "go.sum|^.secrets.baseline$",
"lines": null
},
"generated_at": "2023-12-09T07:19:06Z",
"generated_at": "2025-01-28T11:35:27Z",
"plugins_used": [
{
"name": "AWSKeyDetector"
@@ -82,7 +82,7 @@
"hashed_secret": "ff9ee043d85595eb255c05dfe32ece02a53efbb2",
"is_secret": false,
"is_verified": false,
"line_number": 15,
"line_number": 17,
"type": "Secret Keyword",
"verified_result": null
}
@@ -92,7 +92,7 @@
"hashed_secret": "2a66dd6b2184e0722c4f448eaac79a1897987a30",
"is_secret": false,
"is_verified": false,
"line_number": 20,
"line_number": 21,
"type": "Secret Keyword",
"verified_result": null
}
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -9,6 +9,8 @@

This module creates a secret group in an IBM Cloud Secrets Manager instance. For more information, see [Best practices for organizing secrets and assigning access](https://cloud.ibm.com/docs/secrets-manager?topic=secrets-manager-best-practices-organize-secrets#best-practices-secret-groups).

![Secrets Manager secret group module](./images/sm_secret-group.svg)

## Usage
```hcl
provider "ibm" {
@@ -44,7 +46,7 @@ You need the following permissions to run this module.
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.3.0 |
| <a name="requirement_ibm"></a> [ibm](#requirement\_ibm) | >= 1.51.0, <2.0.0 |
| <a name="requirement_ibm"></a> [ibm](#requirement\_ibm) | >= 1.76.0, <2.0.0 |

### Modules

@@ -77,6 +79,7 @@ No modules.
## Examples

- [ Basic example](examples/basic)
- [ Private-Only Secret Manager example](examples/private)
<!-- END EXAMPLES HOOK -->

<!-- BEGIN CONTRIBUTING HOOK -->
1 change: 1 addition & 0 deletions cra-config.yaml
Original file line number Diff line number Diff line change
@@ -9,3 +9,4 @@ CRA_TARGETS:
# SCC_INSTANCE_ID: "" # The SCC instance ID to use to download profile for CRA scan. If not provided, a default global value will be used.
# SCC_REGION: "" # The IBM Cloud region that the SCC instance is in. If not provided, a default global value will be used.
# PROFILE_ID: "" # The Profile ID input for CRA SCC scan. If not provided, a default global value will be used.
PROFILE_ID: "fe96bd4d-9b37-40f2-b39f-a62760e326a3" # SCC profile ID (currently set to 'IBM Cloud Framework for Financial Services' '1.7.0' profile).
24 changes: 11 additions & 13 deletions examples/basic/main.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
locals {
sm_guid = var.existing_sm_instance_guid == null ? ibm_resource_instance.secrets_manager[0].guid : var.existing_sm_instance_guid
sm_guid = var.existing_sm_instance_guid == null ? module.secrets_manager[0].secrets_manager_guid : var.existing_sm_instance_guid
sm_region = var.existing_sm_instance_region == null ? var.region : var.existing_sm_instance_region
}

@@ -9,7 +9,7 @@ locals {

module "resource_group" {
source = "terraform-ibm-modules/resource-group/ibm"
version = "1.1.5"
version = "1.1.6"
# if an existing resource group is not set (null) create a new one using prefix
resource_group_name = var.resource_group == null ? "${var.prefix}-resource-group" : null
existing_resource_group_name = var.resource_group
@@ -19,17 +19,15 @@ module "resource_group" {
## Create prerequisite. Secrets Manager and Secret Group
##################################################################

resource "ibm_resource_instance" "secrets_manager" {
count = var.existing_sm_instance_guid == null ? 1 : 0
name = "${var.prefix}-sm-instance"
service = "secrets-manager"
plan = var.sm_service_plan
location = var.region
resource_group_id = module.resource_group.resource_group_id
tags = var.resource_tags
timeouts {
create = "20m" # Extending provisioning time to 20 minutes
}
module "secrets_manager" {
count = var.existing_sm_instance_guid != null ? 0 : 1
source = "terraform-ibm-modules/secrets-manager/ibm"
version = "1.25.1"
secrets_manager_name = "${var.prefix}-sm-instance"
sm_service_plan = var.sm_service_plan
region = local.sm_region
resource_group_id = module.resource_group.resource_group_id
sm_tags = var.resource_tags
}

##################################################################
2 changes: 1 addition & 1 deletion examples/basic/version.tf
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ terraform {
# Pin to the lowest provider version of the range defined in the main module to ensure lowest version still works
ibm = {
source = "IBM-Cloud/ibm"
version = "1.51.0"
version = "1.76.0"
}
}
}
9 changes: 9 additions & 0 deletions examples/private/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Private-Only Secret Manager example

An end-to-end example that uses a private-only Secret Manager. This example uses the IBM Cloud terraform provider to:
- Create a new resource group if one is not passed in.
- Create a new secrets manager if one is not passed in.
- Create a new secrets manager group and private secret engine if existing secrets manager is not passed in.
- Create a new private certifcate inside a secrets manager.

<!-- Add your example and link to it from the module's main readme file. -->
55 changes: 55 additions & 0 deletions examples/private/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
##################################################################
## Create RG
##################################################################

module "resource_group" {
source = "terraform-ibm-modules/resource-group/ibm"
version = "1.1.6"
# if an existing resource group is not set (null) create a new one using prefix
resource_group_name = var.resource_group == null ? "${var.prefix}-resource-group" : null
existing_resource_group_name = var.resource_group
}

##################################################################
## Create prerequisite. Secrets Manager and Secret Group
##################################################################

locals {
validate_sm_region_cnd = var.existing_sm_instance_crn != null && var.existing_sm_instance_region == null
validate_sm_region_msg = "existing_sm_instance_region must also be set when value given for existing_sm_instance_guid."
# tflint-ignore: terraform_unused_declarations
validate_sm_region_chk = regex(
"^${local.validate_sm_region_msg}$",
(!local.validate_sm_region_cnd
? local.validate_sm_region_msg
: ""))

sm_region = var.existing_sm_instance_region == null ? var.region : var.existing_sm_instance_region
}

module "secrets_manager" {
source = "terraform-ibm-modules/secrets-manager/ibm"
version = "1.25.1"
existing_sm_instance_crn = var.existing_sm_instance_crn
resource_group_id = module.resource_group.resource_group_id
region = local.sm_region
secrets_manager_name = "${var.prefix}-sm"
sm_service_plan = "trial"
allowed_network = "private-only"
endpoint_type = "private"
sm_tags = var.resource_tags
}

##################################################################
## Example creating secret group
##################################################################

module "secrets_manager_group_acct" {
source = "../.."
region = local.sm_region
secrets_manager_guid = module.secrets_manager.secrets_manager_guid
#tfsec:ignore:general-secrets-no-plaintext-exposure
secret_group_name = "${var.prefix}-example-group" #checkov:skip=CKV_SECRET_6: does not require high entropy string as is static value
secret_group_description = "secret group used for examples" #tfsec:ignore:general-secrets-no-plaintext-exposure
endpoint_type = "private"
}
10 changes: 10 additions & 0 deletions examples/private/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
##############################################################################
# Outputs
##############################################################################

output "secret_group_id" {
description = "ID of the created Secret Group"
value = module.secrets_manager_group_acct.secret_group_id
}

##############################################################################
4 changes: 4 additions & 0 deletions examples/private/provider.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
provider "ibm" {
ibmcloud_api_key = var.ibmcloud_api_key
region = var.region
}
41 changes: 41 additions & 0 deletions examples/private/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
variable "ibmcloud_api_key" {
type = string
description = "The IBM Cloud API Token"
sensitive = true
}

variable "region" {
type = string
description = "Region to deploy resources in"
default = "us-south"
}

variable "prefix" {
type = string
description = "Prefix for name of all resource created by this example"
default = "test-sm-sg"
}

variable "resource_group" {
type = string
description = "An existing resource group name to use for this example, if unset a new resource group will be created"
default = null
}

variable "resource_tags" {
type = list(string)
description = "Optional list of tags to be added to created resources"
default = []
}

variable "existing_sm_instance_crn" {
type = string
description = "An existing Secrets Manager instance CRN. If not provided an new instance will be provisioned."
default = null
}

variable "existing_sm_instance_region" {
type = string
description = "The region of the existing Secrets Manager instance. Only required if value is passed into var.existing_sm_instance_guid"
default = null
}
10 changes: 10 additions & 0 deletions examples/private/version.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
terraform {
required_version = ">= 1.3.0"
required_providers {
# Pin to the lowest provider version of the range defined in the main module to ensure lowest version still works
ibm = {
source = "IBM-Cloud/ibm"
version = "1.76.0"
}
}
}
3 changes: 2 additions & 1 deletion ibm_catalog.json
Original file line number Diff line number Diff line change
@@ -8,7 +8,8 @@
"dev_ops",
"target_terraform",
"terraform",
"module"
"module",
"ibm_created"
],
"keywords": [
"terraform",
Loading