Skip to content
This repository was archived by the owner on Jun 17, 2025. It is now read-only.

Commit c9209c0

Browse files
authored
feat: initial module release (#2)
1 parent bc491a3 commit c9209c0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+2577
-346
lines changed

.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-03T03:40:11Z",
6+
"generated_at": "2023-06-07T13:09:19Z",
77
"plugins_used": [
88
{
99
"name": "AWSKeyDetector"
@@ -76,7 +76,18 @@
7676
"name": "TwilioKeyDetector"
7777
}
7878
],
79-
"results": {},
79+
"results": {
80+
"module-metadata.json": [
81+
{
82+
"hashed_secret": "99075eb0baa8cfda1cae029da06b57b93cc13a31",
83+
"is_secret": false,
84+
"is_verified": false,
85+
"line_number": 468,
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: 84 additions & 128 deletions
Large diffs are not rendered by default.

cra-tf-validate-ignore-rules.json

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
11
{
2-
"scc_rules": []
3-
}
2+
"scc_rules": [
3+
{
4+
"scc_rule_id": "rule-9b2d8054-bc93-44fd-901b-91f677287e84",
5+
"description": "Check whether Databases for PostgreSQL network access is restricted to a specific IP range",
6+
"ignore_reason": "This module supports restricting network access using Context Based Restrictions (CBRs), however SCC does not yet support scanning for CBR rules, hence the rule currently fails. SCC CBR support is being tracked in AHA SCC-961",
7+
"is_valid": true
8+
},
9+
{
10+
"scc_rule_id": "rule-216e2449-27d7-4afc-929a-b66e196a9cf9",
11+
"description": "Check whether Flow Logs for VPC are enabled",
12+
"ignore_reason": "This rule is not relevant to the module itself, just the VPC resource is used in the example that is scanned",
13+
"is_valid": false
14+
}
15+
]
16+
}

examples/backup/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Restore from backup example
2+
3+
This example provides an end-to-end executable flow of how a Enterprise DB can be created from a backup instance. This example uses the IBM Cloud terraform provider to:
4+
5+
- Create a new resource group if one is not passed in.
6+
- Create a new ICD Enterprise database instance if no existing backup crn is provided.
7+
- Create a restored ICD Enterprise database instance pointing to the backup of the first instance.

examples/backup/main.tf

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
##############################################################################
2+
# Resource Group
3+
##############################################################################
4+
5+
module "resource_group" {
6+
source = "git::https://github.com/terraform-ibm-modules/terraform-ibm-resource-group.git?ref=v1.0.5"
7+
# if an existing resource group is not set (null) create a new one using prefix
8+
resource_group_name = var.resource_group == null ? "${var.prefix}-resource-group" : null
9+
existing_resource_group_name = var.resource_group
10+
}
11+
12+
module "enterprise_db" {
13+
count = var.enterprise_db_backup_crn != null ? 0 : 1
14+
source = "../.."
15+
resource_group_id = module.resource_group.resource_group_id
16+
name = "${var.prefix}-edb"
17+
edb_version = var.edb_version
18+
region = var.region
19+
resource_tags = var.resource_tags
20+
access_tags = var.access_tags
21+
}
22+
23+
data "ibm_database_backups" "backup_database" {
24+
count = var.enterprise_db_backup_crn != null ? 0 : 1
25+
deployment_id = module.enterprise_db[0].id
26+
}
27+
28+
# New enterprise db instance pointing to the backup instance
29+
module "restored_enterprise_db" {
30+
source = "../.."
31+
resource_group_id = module.resource_group.resource_group_id
32+
name = "${var.prefix}-edb-restored"
33+
edb_version = var.edb_version
34+
region = var.region
35+
resource_tags = var.resource_tags
36+
access_tags = var.access_tags
37+
backup_crn = var.enterprise_db_backup_crn == null ? data.ibm_database_backups.backup_database[0].backups[0].backup_id : var.enterprise_db_backup_crn
38+
}

examples/backup/outputs.tf

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
##############################################################################
2+
# Outputs
3+
##############################################################################
4+
output "id" {
5+
description = "Enterprise DB instance id"
6+
value = var.enterprise_db_backup_crn == null ? module.enterprise_db[0].id : null
7+
}
8+
9+
output "restored_enterprise_db_id" {
10+
description = "Restored Enterprise DB instance id"
11+
value = module.restored_enterprise_db.id
12+
}
13+
14+
output "restored_enterprise_db_version" {
15+
description = "Restored Enterprise DB instance version"
16+
value = module.restored_enterprise_db.version
17+
}
File renamed without changes.

examples/backup/variables.tf

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
variable "ibmcloud_api_key" {
2+
type = string
3+
description = "The IBM Cloud API Key"
4+
sensitive = true
5+
}
6+
7+
variable "region" {
8+
type = string
9+
description = "Region to provision all resources created by this example."
10+
default = "us-south"
11+
}
12+
13+
variable "prefix" {
14+
type = string
15+
description = "Prefix to append to all resources created by this example"
16+
default = "edb-res"
17+
}
18+
19+
variable "edb_version" {
20+
description = "Version of the Enterprise DB instance. If no value passed, the current ICD preferred version is used."
21+
type = string
22+
default = null
23+
}
24+
25+
variable "resource_group" {
26+
type = string
27+
description = "An existing resource group name to use for this example, if unset a new resource group will be created"
28+
default = null
29+
}
30+
31+
variable "resource_tags" {
32+
type = list(string)
33+
description = "Optional list of tags to be added to created resources"
34+
default = []
35+
}
36+
37+
variable "access_tags" {
38+
type = list(string)
39+
description = "A list of access tags to apply to the Enterprise DB instance created by the module, see https://cloud.ibm.com/docs/account?topic=account-access-tags-tutorial for more details"
40+
default = []
41+
}
42+
43+
variable "enterprise_db_backup_crn" {
44+
type = string
45+
description = "The existing CRN of a backup resource to restore from. If null then it will create a new instance first and then create another instance pointing to the backup of the first instance."
46+
default = null
47+
}

examples/default/version.tf renamed to examples/backup/version.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
terraform {
2-
required_version = ">= 1.0.0"
2+
required_version = ">= 1.3.0"
33
required_providers {
44
# Pin to the lowest provider version of the range defined in the main module's version.tf to ensure lowest version still works
55
ibm = {

0 commit comments

Comments
 (0)