Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Metrics Router module

This module supports provisioning the following:

  • IBM Cloud Metrics Routing
    • Use IBM Cloud® Metrics Routing to configure the routing of platform metrics generated in your IBM Cloud account.
    • IBM Cloud Metrics Routing is a platform service, to manage platform metrics at the account-level by configuring targets and routes that define where data points are routed.
    • IBM Cloud Metrics Routing actively manages metrics generated by MR enabled services. Visit here to see the list of services that have adopted IBM Cloud Metrics Routing.
    • IBM Cloud Metrics Routing can only route metrics that are generated in supported regions. In regions where IBM Cloud Metrics Routing is unavailable, metrics continue to be collected and managed using the Monitoring service.

Usage

# Locals
locals {
  region      = "us-south"
}

terraform {
  required_version = ">= 1.0.0"
  required_providers {
    ibm = {
      source  = "ibm-cloud/ibm"
      version = "X.Y.Z" # lock into a supported provider version
    }
  }
}
provider "ibm" {
  ibmcloud_api_key = XXXXXXXXXXXX #pragma: allowlist secret
  region           = local.region
}

# Create Metric Router target and route
module "metric_router" {
  source    = "terraform-ibm-modules/observability-instances/ibm//modules/metrics_routing"
  version   = "X.Y.Z" # Replace "X.Y.Z" with a release version to lock into a specific release
  # Create Metric Router target
  metric_router_targets = [
    {
      # ID of the Cloud logs instance
      destination_crn   = "crn:v1:bluemix:public:sysdig-monitor:eu-de:a/xxXXxxXXxXxXXXXxxXxxxXXXXxXXXXX:xxxxxx-XXXX-XXXX-XXXX-xxxxxx::"
      target_region = "us-south"
      target_name   = "my-mr-target"
    }
  ]
  metric_router_routes = [
    {
        name = "my-mr-route"
        rules = [
            {
                action = "send"
                targets = [{
                    id = module.metric_router.metric_router_targets["my-mr-target"].id
                }]
                inclusion_filters = [{
                    operand = "location"
                    operator = "is"
                    values = ["us-east"]
                }]
            }
        ]
    }
  ]
}

Required IAM access policies

You need the following permissions to run this module.

  • Service
    • Metric Routing (Required if creating Metric routes and targets)
      • Editor platform access
      • Manager service access

Requirements

Name Version
terraform >= 1.0.0
ibm >= 1.69.2, < 2.0.0
time >= 0.9.1, < 1.0.0

Modules

No modules.

Resources

Name Type
ibm_iam_authorization_policy.metrics_router_cloud_monitoring resource
ibm_metrics_router_route.metrics_router_routes resource
ibm_metrics_router_settings.metrics_router_settings resource
ibm_metrics_router_target.metrics_router_targets resource
time_sleep.wait_for_cloud_monitoring_auth_policy resource

Inputs

Name Description Type Default Required
metrics_router_routes List of routes for IBM Metrics Router
list(object({
name = string
rules = list(object({
action = optional(string, "send")
targets = optional(list(object({
id = string
})))
inclusion_filters = list(object({
operand = string
operator = string
values = list(string)
}))
}))
}))
[] no
metrics_router_settings Global settings for Metrics Routing
object({
permitted_target_regions = optional(list(string))
primary_metadata_region = optional(string)
backup_metadata_region = optional(string)
private_api_endpoint_only = optional(bool, false)
default_targets = optional(list(object({
id = string
})))
})
null no
metrics_router_targets List of Metrics Router targets to be created.
list(object({
destination_crn = string
target_name = string
target_region = optional(string)
skip_mrouter_sysdig_iam_auth_policy = optional(bool, false)
}))
[] no

Outputs

Name Description
metrics_router_routes The created metrics routing routes.
metrics_router_settings The global metrics routing settings.
metrics_router_targets The created metrics routing targets.