Resource: aws_ce_anomaly_monitor

Provides a CE Anomaly Monitor.

Example Usage

There are two main types of a Cost Anomaly Monitor: DIMENSIONAL and CUSTOM.

Dimensional Example

resource "aws_ce_anomaly_monitor" "service_monitor" {
  name              = "AWSServiceMonitor"
  monitor_type      = "DIMENSIONAL"
  monitor_dimension = "SERVICE"
}

Custom Example

resource "aws_ce_anomaly_monitor" "test" {
  name         = "AWSCustomAnomalyMonitor"
  monitor_type = "CUSTOM"

  monitor_specification = jsonencode({
    And            = null
    CostCategories = null
    Dimensions     = null
    Not            = null
    Or             = null

    Tags = {
      Key          = "CostCenter"
      MatchOptions = null
      Values = [
        "10000"
      ]
    }
  })
}

Argument Reference

The following arguments are required:

Attribute Reference

This resource exports the following attributes in addition to the arguments above:

Import

In Terraform v1.5.0 and later, use an import block to import aws_ce_anomaly_monitor using the id. For example:

import {
  to = aws_ce_anomaly_monitor.example
  id = "costAnomalyMonitorARN"
}

Using terraform import, import aws_ce_anomaly_monitor using the id. For example:

% terraform import aws_ce_anomaly_monitor.example costAnomalyMonitorARN