Skip to content

Commit 46baee5

Browse files
feat: initial release (#2)
1 parent a1c2c2c commit 46baee5

23 files changed

+1367
-229
lines changed

README.md

Lines changed: 62 additions & 120 deletions
Large diffs are not rendered by default.

cra-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# More info about this file at https://github.com/terraform-ibm-modules/common-pipeline-assets/blob/main/.github/workflows/terraform-test-pipeline.md#cra-config-yaml
22
version: "v1"
33
CRA_TARGETS:
4-
- CRA_TARGET: "examples/basic" # Target directory for CRA scan. If not provided, the CRA Scan will not be run.
4+
- CRA_TARGET: "examples/complete" # Target directory for CRA scan. If not provided, the CRA Scan will not be run.
55
CRA_IGNORE_RULES_FILE: "cra-tf-validate-ignore-rules.json" # CRA Ignore file to use. If not provided, it checks the repo root directory for `cra-tf-validate-ignore-rules.json`
66
# CRA_ENVIRONMENT_VARIABLES: # An optional map of environment variables for CRA, where the key is the variable name and value is the value. Useful for providing TF_VARs.
77
# TF_VAR_sample: "sample value"

cra-tf-validate-ignore-rules.json

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
11
{
2-
"scc_rules": []
3-
}
2+
"scc_rules": [
3+
{
4+
"scc_rule_id": "rule-216e2449-27d7-4afc-929a-b66e196a9cf9",
5+
"description": "Check whether Flow Logs for VPC are enabled",
6+
"ignore_reason": "This rule is not relevant to the module itself, just the VPC resource is used in the example that is scanned",
7+
"is_valid": false
8+
}
9+
]
10+
}

examples/basic/README.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
# Basic example
22

3-
<!-- There is a pre-commit hook that will take the title of each example add include it in the repos main README.md -->
4-
<!-- The text below should describe exactly what resources are provisioned / configured by the example -->
5-
6-
An end-to-end basic example that will provision the following:
7-
- A new resource group if one is not passed in.
8-
- A new Cloud Object Storage instance.
3+
This example uses the IBM Cloud terraform provider to:
4+
- Create a new resource group if one is not passed in.
5+
- Create a new RabbitMQ instance in the resource group and region provided.

examples/basic/main.tf

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
##############################################################################
2-
# Resource group
2+
# Resource Group
33
##############################################################################
44

55
module "resource_group" {
@@ -11,14 +11,13 @@ module "resource_group" {
1111
}
1212

1313
##############################################################################
14-
# COS instance
14+
# RabbitMQ
1515
##############################################################################
1616

17-
resource "ibm_resource_instance" "cos_instance" {
18-
name = "${var.prefix}-cos"
17+
module "icd_rabbitmq" {
18+
source = "../.."
1919
resource_group_id = module.resource_group.resource_group_id
20-
service = "cloud-object-storage"
21-
plan = "standard"
22-
location = "global"
20+
instance_name = "${var.prefix}-rabbitmq"
21+
region = var.region
2322
tags = var.resource_tags
2423
}

examples/basic/outputs.tf

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,12 @@
22
# Outputs
33
##############################################################################
44

5-
output "cos_instance_id" {
6-
description = "COS instance id"
7-
value = ibm_resource_instance.cos_instance.id
5+
output "id" {
6+
description = "rabbitmq instance id"
7+
value = module.icd_rabbitmq.id
88
}
99

10-
output "resource_group_name" {
11-
description = "Resource group name"
12-
value = module.resource_group.resource_group_name
13-
}
14-
15-
output "resource_group_id" {
16-
description = "Resource group ID"
17-
value = module.resource_group.resource_group_id
10+
output "version" {
11+
description = "rabbitmq instance version"
12+
value = module.icd_rabbitmq.version
1813
}

examples/basic/provider.tf

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
##############################################################################
2-
# Provider config
3-
##############################################################################
4-
51
provider "ibm" {
62
ibmcloud_api_key = var.ibmcloud_api_key
73
region = var.region

examples/basic/variables.tf

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
##############################################################################
2-
# Input variables
3-
##############################################################################
4-
51
variable "ibmcloud_api_key" {
62
type = string
73
description = "The IBM Cloud API Key"
@@ -17,12 +13,12 @@ variable "region" {
1713
variable "prefix" {
1814
type = string
1915
description = "Prefix to append to all resources created by this example"
20-
default = "basic"
16+
default = "rabbitmq"
2117
}
2218

2319
variable "resource_group" {
2420
type = string
25-
description = "The name of an existing resource group to provision resources in to. If not set a new resource group will be created using the prefix variable"
21+
description = "An existing resource group name to use for this example, if unset a new resource group will be created"
2622
default = null
2723
}
2824

examples/basic/version.tf

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
terraform {
22
required_version = ">= 1.3.0"
3-
4-
# Ensure that there is always 1 example locked into the lowest provider version of the range defined in the main
5-
# module's version.tf (usually a basic example), and 1 example that will always use the latest provider version.
63
required_providers {
4+
# Pin to the lowest provider version of the range defined in the main module's version.tf to ensure lowest version still works
75
ibm = {
86
source = "IBM-Cloud/ibm"
9-
version = "1.49.0"
7+
version = "1.54.0"
108
}
119
}
1210
}

examples/complete/README.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
# Complete example
1+
# Complete example with BYOK encryption, CBR rules, autoscaling, and service credentials creation
22

3-
<!-- There is a pre-commit hook that will take the title of each example add include it in the repos main README.md -->
4-
<!-- Add text below should describe exactly what resources are provisioned / configured by the example -->
3+
An end-to-end example that does the following:
4+
5+
- Create a new resource group if one is not passed in.
6+
- Create Key Protect instance with root key.
7+
- Create a new Messages for RabbitMQ instance with BYOK encryption and autoscaling enabled.
8+
- Create service credentials for the instance.
9+
- Create a Virtual Private Cloud (VPC).
10+
- Create Context Based Restriction (CBR) to only allow RabbitMQ to be accessible from the VPC.

0 commit comments

Comments
 (0)