Last updated:
dash0_aws_metric_scrape_config
Manages the CloudWatch metric scrape configuration of a Dash0 AWS integration: which CloudWatch namespaces and metrics Dash0 collects, optionally filtered by resource.
Each AWS integration has exactly one scrape configuration. Declare at most one dash0_aws_metric_scrape_config per integration: two resources, configurations or stacks that manage the same integration overwrite each other on every apply. The configuration belongs to the integration's dataset, so the resource has no dataset attribute.
The spec.namespaces list is the complete set of namespaces to scrape. An empty list (namespaces: []) stops all scraping for the integration.
Destroying the resource clears the scrape configuration, so Dash0 stops scraping CloudWatch metrics for the integration. The AWS integration itself is kept.
Dash0 records the first client that writes a scrape configuration as its owner (the origin) and keeps that owner until the configuration is cleared. If another API client or Terraform configuration already manages the integration's scrape configuration, this resource takes over its content but Dash0 keeps showing the previous owner. To make Terraform the owner, clear the existing scrape configuration once before the first apply. A scrape configuration created in the Dash0 UI has no owner. After you import it, Terraform manages its content but does not set its own origin.
See About AWS Monitoring for how the AWS integration works.
Example Usage
# Manage which CloudWatch metrics Dash0 scrapes for an AWS integration.
# Each integration has exactly one scrape configuration, so declare at most one
# dash0_aws_metric_scrape_config per integration_id across all your Terraform
# configurations: two of them overwrite each other on every apply.
#
# Destroying this resource clears the scrape configuration (Dash0 stops
# scraping CloudWatch metrics for the integration); the integration stays.
#
# For an integration deployed with aws_cloudformation_stack, replace the UUID
# below with aws_cloudformation_stack.dash0_integration.outputs["IntegrationId"].
# IntegrationId is a Dash0 UUID, not the stack ID or TechnicalId IAM external ID.
# See the AWS integration via CloudFormation guide for the complete setup.
resource "dash0_aws_metric_scrape_config" "prod" {
integration_id = "27755ed0-0009-422d-8c11-19c6dd72df98"
aws_metric_scrape_config_yaml = <<-YAML
apiVersion: dash0.com/v1alpha1
kind: Dash0AwsMetricScrapeConfig
spec:
namespaces:
- namespace: AWS/Lambda
metrics:
- Errors
- Invocations
- namespace: AWS/SQS
metrics:
- ApproximateAgeOfOldestMessage
- NumberOfMessagesSent
YAML
}
# An empty namespaces list keeps the resource but stops all scraping:
#
# spec:
# namespaces: []
# You can also load the YAML definition from a file:
#
# resource "dash0_aws_metric_scrape_config" "prod" {
# integration_id = "27755ed0-0009-422d-8c11-19c6dd72df98"
# aws_metric_scrape_config_yaml = file("${path.module}/scrape-config.yaml")
# }Schema
Required
aws_metric_scrape_config_yaml(String) The scrape configuration in YAML format, withapiVersion: dash0.com/v1alpha1,kind: Dash0AwsMetricScrapeConfigand aspec.namespaceslist. Each entry names a CloudWatchnamespace, themetricsto collect from it, and an optionalfilter.spec.integrationFilteroptionally applies to all namespaces.metadata.name, labels and annotations are managed by Dash0 and ignored, and the order of namespaces and metrics does not matter.integration_id(String) The id (UUID) of the Dash0 AWS integration whose scrape configuration this resource manages. Changing this value forces the resource to be recreated.
Read-Only
origin(String) Thedash0.com/originlabel of the scrape configuration, which records who manages it. Generated on creation astf_<uuid>and refreshed from Dash0 on read. Null for a configuration imported without an origin.
Import
Import is supported using the following syntax:
The terraform import command can be used, for example:
#!/bin/bash
# The import ID is the id (UUID) of the AWS integration: there is one scrape
# configuration per integration, and no dataset prefix.
terraform import dash0_aws_metric_scrape_config.prod 27755ed0-0009-422d-8c11-19c6dd72df98