Skip to content

Commit 4083979

Browse files
authored
feat: initial release (#3)
1 parent c7584d2 commit 4083979

File tree

25 files changed

+685
-255
lines changed

25 files changed

+685
-255
lines changed

.github/CODEOWNERS

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
# Primary owner should be listed first in list of global owners, followed by any secondary owners
2-
* @ocofaigh @daniel-butler-irl
2+
3+
* @iamar7 @shemau

.github/settings.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ repository:
2222

2323
# Uncomment this description property
2424
# and update the description to the current repo description.
25-
# description: ""
25+
description: "This module supports configuring an IBM Cloud Monitoring instance and IBM Cloud Metrics Routing."
2626

2727
# Use a comma-separated list of topics to set on the repo (ensure not to use any caps in the topic string).
2828
topics: terraform, ibm-cloud, terraform-module, core-team, cloud-monitoring, metrics, observability

.secrets.baseline

Lines changed: 2 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": "2024-11-22T17:36:38Z",
6+
"generated_at": "2025-04-09T08:26:47Z",
77
"plugins_used": [
88
{
99
"name": "AWSKeyDetector"
@@ -82,7 +82,7 @@
8282
"hashed_secret": "ff9ee043d85595eb255c05dfe32ece02a53efbb2",
8383
"is_secret": false,
8484
"is_verified": false,
85-
"line_number": 74,
85+
"line_number": 41,
8686
"type": "Secret Keyword",
8787
"verified_result": null
8888
}

README.md

Lines changed: 81 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,27 @@
1-
<!-- Update this title with a descriptive name. Use sentence case. -->
2-
# Terraform modules template project
3-
4-
<!--
5-
Update status and "latest release" badges:
6-
1. For the status options, see https://terraform-ibm-modules.github.io/documentation/#/badge-status
7-
2. Update the "latest release" badge to point to the correct module's repo. Replace "terraform-ibm-module-template" in two places.
8-
-->
9-
[![Incubating (Not yet consumable)](https://img.shields.io/badge/status-Incubating%20(Not%20yet%20consumable)-red)](https://terraform-ibm-modules.github.io/documentation/#/badge-status)
10-
[![latest release](https://img.shields.io/github/v/release/terraform-ibm-modules/terraform-ibm-cloud-monitoring?logo=GitHub&sort=semver)](https://github.com/terraform-ibm-modules/terraform-ibm-cloud-monitoring/releases/latest)
1+
# IBM Cloud Monitoring module
2+
3+
[![Graduated (Supported)](https://img.shields.io/badge/Status-Graduated%20(Supported)-brightgreen)](https://terraform-ibm-modules.github.io/documentation/#/badge-status)
4+
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
115
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit)
6+
[![latest release](https://img.shields.io/github/v/release/terraform-ibm-modules/terraform-ibm-cloud-monitoring?logo=GitHub&sort=semver)](https://github.com/terraform-ibm-modules/terraform-ibm-cloud-monitoring/releases/latest)
127
[![Renovate enabled](https://img.shields.io/badge/renovate-enabled-brightgreen.svg)](https://renovatebot.com/)
13-
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
14-
15-
<!--
16-
Add a description of modules in this repo.
17-
Expand on the repo short description in the .github/settings.yml file.
188

19-
For information, see "Module names and descriptions" at
20-
https://terraform-ibm-modules.github.io/documentation/#/implementation-guidelines?id=module-names-and-descriptions
21-
-->
9+
This module supports configuring an IBM Cloud Monitoring instance, metrics routing target, routes and settings.
2210

23-
TODO: Replace this with a description of the modules in this repo.
24-
25-
26-
<!-- The following content is automatically populated by the pre-commit hook -->
27-
<!-- BEGIN OVERVIEW HOOK -->
2811
## Overview
12+
2913
* [terraform-ibm-cloud-monitoring](#terraform-ibm-cloud-monitoring)
14+
* [Submodules](./modules)
15+
* [metrics_routing](./modules/metrics_routing)
3016
* [Examples](./examples)
31-
* [Advanced example](./examples/advanced)
32-
* [Basic example](./examples/basic)
17+
* [Advanced example](./examples/advanced)
18+
* [Basic example](./examples/basic)
3319
* [Contributing](#contributing)
34-
<!-- END OVERVIEW HOOK -->
35-
36-
37-
<!--
38-
If this repo contains any reference architectures, uncomment the heading below and link to them.
39-
(Usually in the `/reference-architectures` directory.)
40-
See "Reference architecture" in the public documentation at
41-
https://terraform-ibm-modules.github.io/documentation/#/implementation-guidelines?id=reference-architecture
42-
-->
43-
<!-- ## Reference architectures -->
4420

45-
46-
<!-- Replace this heading with the name of the root level module (the repo name) -->
4721
## terraform-ibm-cloud-monitoring
4822

4923
### Usage
5024

51-
<!--
52-
Add an example of the use of the module in the following code block.
53-
54-
Use real values instead of "var.<var_name>" or other placeholder values
55-
unless real values don't help users know what to change.
56-
-->
57-
5825
```hcl
5926
terraform {
6027
required_version = ">= 1.9.0"
@@ -75,46 +42,65 @@ provider "ibm" {
7542
region = local.region
7643
}
7744
78-
module "module_template" {
79-
source = "terraform-ibm-modules/<replace>/ibm"
45+
# IBM Cloud Monitoring
46+
47+
module "cloud_monitoring" {
48+
source = ""terraform-ibm-modules/cloud_monitoring/ibm""
8049
version = "X.Y.Z" # Replace "X.Y.Z" with a release version to lock into a specific release
8150
region = local.region
82-
name = "instance-name"
83-
resource_group_id = "xxXXxxXXxXxXXXXxxXxxxXXXXxXXXXX" # Replace with the actual ID of resource group to use
51+
resource_group_id = "xxXXxxXXxXxXXXXxxXxxxXXXXxXXXXX"
8452
}
85-
```
8653
87-
### Required access policies
54+
# IBM Cloud Metrics Routing
8855
89-
<!-- PERMISSIONS REQUIRED TO RUN MODULE
90-
If this module requires permissions, uncomment the following block and update
91-
the sample permissions, following the format.
92-
Replace the 'Sample IBM Cloud' service and roles with applicable values.
93-
The required information can usually be found in the services official
94-
IBM Cloud documentation.
95-
To view all available service permissions, you can go in the
96-
console at Manage > Access (IAM) > Access groups and click into an existing group
97-
(or create a new one) and in the 'Access' tab click 'Assign access'.
98-
-->
56+
module "metric_router" {
57+
source = "terraform-ibm-modules/cloud_monitoring/ibm//modules/metrics_routing"
58+
version = "X.Y.Z" # Replace "X.Y.Z" with a release version to lock into a specific release
9959
100-
<!--
101-
You need the following permissions to run this module:
60+
metrics_router_targets = [
61+
{
62+
# ID of the Cloud Monitoring instance
63+
destination_crn = "crn:v1:bluemix:public:sysdig-monitor:eu-de:a/xxXXxxXXxXxXXXXxxXxxxXXXXxXXXXX:xxxxxx-XXXX-XXXX-XXXX-xxxxxx::"
64+
target_region = "us-south"
65+
target_name = "my-mr-target"
66+
}
67+
]
68+
69+
metrics_router_routes = [
70+
{
71+
name = "my-mr-route"
72+
rules = [
73+
{
74+
action = "send"
75+
targets = [{
76+
id = module.metric_router.metric_router_targets["my-mr-target"].id
77+
}]
78+
inclusion_filters = [{
79+
operand = "location"
80+
operator = "is"
81+
values = ["us-east"]
82+
}]
83+
}
84+
]
85+
}
86+
]
87+
}
10288
103-
- Service
104-
- **Resource group only**
105-
- `Viewer` access on the specific resource group
106-
- **Sample IBM Cloud** service
107-
- `Editor` platform access
108-
- `Manager` service access
109-
-->
89+
```
11090

111-
<!-- NO PERMISSIONS FOR MODULE
112-
If no permissions are required for the module, uncomment the following
113-
statement instead the previous block.
114-
-->
91+
### Required access policies
11592

116-
<!-- No permissions are needed to run this module.-->
93+
You need the following permissions to run this module.
11794

95+
* Service
96+
* **Resource group only**
97+
* `Viewer` access on the specific resource group
98+
* **Cloud Monitoring**
99+
* `Editor` platform access
100+
* `Manager` service access
101+
* **IBM Cloud Metrics Routing** (Required if creating metrics routing routes & target)
102+
* `Editor` platform access
103+
* `Manager` service access
118104

119105
<!-- The following content is automatically populated by the pre-commit hook -->
120106
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
@@ -123,7 +109,7 @@ statement instead the previous block.
123109
| Name | Version |
124110
|------|---------|
125111
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.9.0 |
126-
| <a name="requirement_ibm"></a> [ibm](#requirement\_ibm) | >= 1.71.2, < 2.0.0 |
112+
| <a name="requirement_ibm"></a> [ibm](#requirement\_ibm) | >= 1.76.1, < 2.0.0 |
127113

128114
### Modules
129115

@@ -133,25 +119,36 @@ No modules.
133119

134120
| Name | Type |
135121
|------|------|
136-
| [ibm_resource_instance.cos_instance](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/resources/resource_instance) | resource |
122+
| [ibm_resource_instance.cloud_monitoring](https://registry.terraform.io/providers/ibm-cloud/ibm/latest/docs/resources/resource_instance) | resource |
123+
| [ibm_resource_key.resource_key](https://registry.terraform.io/providers/ibm-cloud/ibm/latest/docs/resources/resource_key) | resource |
124+
| [ibm_resource_tag.cloud_monitoring_tag](https://registry.terraform.io/providers/ibm-cloud/ibm/latest/docs/resources/resource_tag) | resource |
137125

138126
### Inputs
139127

140128
| Name | Description | Type | Default | Required |
141129
|------|-------------|------|---------|:--------:|
142-
| <a name="input_name"></a> [name](#input\_name) | A descriptive name used to identify the resource instance. | `string` | n/a | yes |
143-
| <a name="input_plan"></a> [plan](#input\_plan) | The name of the plan type supported by service. | `string` | `"standard"` | no |
144-
| <a name="input_resource_group_id"></a> [resource\_group\_id](#input\_resource\_group\_id) | The ID of the resource group where you want to create the service. | `string` | n/a | yes |
145-
| <a name="input_resource_tags"></a> [resource\_tags](#input\_resource\_tags) | List of resource tag to associate with the instance. | `list(string)` | `[]` | no |
130+
| <a name="input_access_tags"></a> [access\_tags](#input\_access\_tags) | Access Management Tags associated with the IBM Cloud Monitoring instance (Optional, array of strings). | `list(string)` | `[]` | no |
131+
| <a name="input_enable_platform_metrics"></a> [enable\_platform\_metrics](#input\_enable\_platform\_metrics) | Receive platform metrics in the provisioned IBM Cloud Monitoring instance. Only 1 instance in a given region can be enabled for platform metrics. | `bool` | `false` | no |
132+
| <a name="input_instance_name"></a> [instance\_name](#input\_instance\_name) | The name of the IBM Cloud Monitoring instance to create. Defaults to 'cloud-monitoring-<region>' | `string` | `null` | no |
133+
| <a name="input_manager_key_name"></a> [manager\_key\_name](#input\_manager\_key\_name) | The name to give the IBM Cloud Monitoring manager key. | `string` | `"SysdigManagerKey"` | no |
134+
| <a name="input_manager_key_tags"></a> [manager\_key\_tags](#input\_manager\_key\_tags) | Tags associated with the IBM Cloud Monitoring manager key. | `list(string)` | `[]` | no |
135+
| <a name="input_plan"></a> [plan](#input\_plan) | The IBM Cloud Monitoring plan to provision. Available: lite, graduated-tier | `string` | `"lite"` | no |
136+
| <a name="input_region"></a> [region](#input\_region) | The IBM Cloud region where Cloud Monitoring instance will be created. | `string` | `"us-south"` | no |
137+
| <a name="input_resource_group_id"></a> [resource\_group\_id](#input\_resource\_group\_id) | The id of the IBM Cloud resource group where the Cloud Monitoring instance will be created. | `string` | n/a | yes |
138+
| <a name="input_resource_tags"></a> [resource\_tags](#input\_resource\_tags) | Tags associated with the IBM Cloud Monitoring instance (Optional, array of strings). | `list(string)` | `[]` | no |
139+
| <a name="input_service_endpoints"></a> [service\_endpoints](#input\_service\_endpoints) | The type of the service endpoint that will be set for the Sisdig instance. | `string` | `"public-and-private"` | no |
146140

147141
### Outputs
148142

149143
| Name | Description |
150144
|------|-------------|
151-
| <a name="output_account_id"></a> [account\_id](#output\_account\_id) | An alpha-numeric value identifying the account ID. |
152-
| <a name="output_crn"></a> [crn](#output\_crn) | The CRN of the resource instance. |
153-
| <a name="output_guid"></a> [guid](#output\_guid) | The GUID of the resource instance. |
154-
| <a name="output_id"></a> [id](#output\_id) | The unique identifier of the resource instance. |
145+
| <a name="output_access_key"></a> [access\_key](#output\_access\_key) | The cloud monitoring access key for agents to use |
146+
| <a name="output_account_id"></a> [account\_id](#output\_account\_id) | The account id where cloud monitoring instance is provisioned. |
147+
| <a name="output_crn"></a> [crn](#output\_crn) | The id of the provisioned cloud monitoring instance. |
148+
| <a name="output_guid"></a> [guid](#output\_guid) | The guid of the provisioned cloud monitoring instance. |
149+
| <a name="output_manager_key_name"></a> [manager\_key\_name](#output\_manager\_key\_name) | The cloud monitoring manager key name |
150+
| <a name="output_name"></a> [name](#output\_name) | The name of the provisioned cloud monitoring instance. |
151+
| <a name="output_resource_group_id"></a> [resource\_group\_id](#output\_resource\_group\_id) | The resource group where cloud monitoring monitor instance resides |
155152
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
156153

157154
<!-- Leave this section as is so that your module has a link to local development environment set-up steps for contributors to follow -->

cra-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ CRA_TARGETS:
1313
# 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.
1414
# SCC_REGION: "" # The IBM Cloud region that the SCC instance is in. If not provided, a default global value will be used.
1515
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.
16-
TF_VAR_prefix: "mock"
16+
TF_VAR_prefix: "monitoring"
1717
TF_VAR_region: "us-south"

examples/advanced/README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# Advanced 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-
<!-- Add text below should describe exactly what resources are provisioned / configured by the example -->
3+
Example that configures:
4+
5+
- IBM Cloud Monitoring instance
6+
- IBM Cloud Metrics Routing

examples/advanced/main.tf

Lines changed: 68 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
########################################################################################################################
2-
# Resource group
3-
########################################################################################################################
1+
##############################################################################
2+
# Resource Group
3+
##############################################################################
44

55
module "resource_group" {
66
source = "terraform-ibm-modules/resource-group/ibm"
@@ -10,23 +10,71 @@ module "resource_group" {
1010
existing_resource_group_name = var.resource_group
1111
}
1212

13-
########################################################################################################################
14-
# COS
15-
########################################################################################################################
16-
17-
#
18-
# Developer tips:
19-
# - Call the local module / modules in the example to show how they can be consumed
20-
# - Include the actual module source as a code comment like below so consumers know how to consume from correct location
21-
#
22-
23-
module "cos" {
24-
source = "../.."
25-
# remove the above line and uncomment the below 2 lines to consume the module from the registry
26-
# source = "terraform-ibm-modules/<replace>/ibm"
27-
# version = "X.Y.Z" # Replace "X.Y.Z" with a release version to lock into a specific release
28-
name = "${var.prefix}-cos"
13+
##############################################################################
14+
# Cloud Monitoring
15+
##############################################################################
16+
17+
locals {
18+
cloud_monitoring_instance_name = "${var.prefix}-cloud-monitoring"
19+
metrics_router_target_name = "${var.prefix}-cloud-monitoring-target"
20+
}
21+
22+
module "cloud_monitoring" {
23+
source = "../../"
2924
resource_group_id = module.resource_group.resource_group_id
25+
region = var.region
3026
resource_tags = var.resource_tags
31-
plan = "cos-one-rate-plan"
27+
access_tags = var.access_tags
28+
plan = "graduated-tier"
29+
instance_name = local.cloud_monitoring_instance_name
30+
}
31+
32+
##############################################################################
33+
# IBM Cloud Metrics Routing
34+
# - Cloud Monitoring target
35+
# - Metrics Router route to the cloud monitoring target
36+
##############################################################################
37+
38+
module "metrics_routing" {
39+
source = "../../modules/metrics_routing"
40+
41+
metrics_router_targets = [
42+
{
43+
destination_crn = module.cloud_monitoring.crn
44+
target_name = local.metrics_router_target_name
45+
target_region = var.region
46+
}
47+
]
48+
49+
metrics_router_routes = [
50+
{
51+
name = "${var.prefix}-metric-routing-route"
52+
rules = [
53+
{
54+
action = "send"
55+
targets = [{
56+
id = module.metrics_routing.metrics_router_targets[local.metrics_router_target_name].id
57+
}]
58+
inclusion_filters = [{
59+
operand = "location"
60+
operator = "is"
61+
values = ["us-south"]
62+
}]
63+
}
64+
]
65+
}
66+
]
67+
68+
##############################################################################
69+
# - Global Metrics Routing configuration
70+
##############################################################################
71+
72+
metrics_router_settings = {
73+
default_targets = [{
74+
id = module.metrics_routing.metrics_router_targets[local.metrics_router_target_name].id
75+
}]
76+
permitted_target_regions = ["us-south", "eu-de", "us-east", "eu-es", "eu-gb", "au-syd", "br-sao", "ca-tor", "jp-tok", "jp-osa"]
77+
primary_metadata_region = var.region
78+
private_api_endpoint_only = false
79+
}
3280
}

0 commit comments

Comments
 (0)