Skip to content

Latest commit

 

History

History
83 lines (61 loc) · 4.73 KB

README.md

File metadata and controls

83 lines (61 loc) · 4.73 KB

Github Actions

Terraform AWS Cost Anomaly Detection

Description

The purpose of this module is convenience wrapper for provisioning one or more Cost Anomaly monitors and setting up the nofitications for them.

Usage

Add example usage here

module "cost_anomaly_detection" {
  source = "../../"

  monitors = local.monitors
  notifications = {
    email = {
      addresses = var.notification_email_addresses
    }
    slack = {
      channel     = jsondecode(data.aws_secretsmanager_secret_version.notification.secret_string).channel
      webhook_url = jsondecode(data.aws_secretsmanager_secret_version.notification.secret_string).webhook_url
    }
  }
  tags = var.tags
}
}

Update Documentation

The terraform-docs utility is used to generate this README. Follow the below steps to update:

  1. Make changes to the .terraform-docs.yml file
  2. Fetch the terraform-docs binary (https://terraform-docs.io/user-guide/installation/)
  3. Run terraform-docs markdown table --output-file ${PWD}/README.md --output-mode inject .

Requirements

Name Version
terraform >= 1.0.7
aws >= 5.0.0

Providers

Name Version
aws >= 5.0.0

Modules

Name Source Version
notifications appvia/notifications/aws 1.0.2

Resources

Name Type
aws_ce_anomaly_monitor.this resource
aws_ce_anomaly_subscription.this resource

Inputs

Name Description Type Default Required
monitors A collection of cost anomaly monitors to create
list(object({
name = string
# The name of the monitor
monitor_type = optional(string, "DIMENSIONAL")
# The type of monitor to create
monitor_dimension = optional(string, "DIMENSIONAL")
# The dimension to monitor
monitor_specification = optional(string, null)
# The specification to monitor
notify = optional(object({
frequency = string
# The frequency of notifications
threshold_expression = optional(any, null)
# The threshold expression to use for notifications
}), {
frequency = "DAILY"
})
}))
n/a yes
notifications The configuration of the notification
object({
email = optional(object({
addresses = list(string)
}), null)
slack = optional(object({
secret_name = optional(string, null)
# An optional secret name in the AWS Secrets Manager, containing this information
lambda_name = optional(string, "cost-anomaly-notification")
# The name of the Lambda function to use for notifications
webhook_url = optional(string, null)
# The URL of the Slack webhook to use for notifications, required if secret_name is not provided
}), null)
})
n/a yes
tags A map of tags to add to all resources map(string) n/a yes
accounts_id_to_name A mapping of account id and account name - used by notification lamdba to map an account ID to a human readable name map(string) null no
enable_notification_creation Indicates whether to create a notification lambda stack, default is true, but useful to toggle if using existing resources bool true no
enable_sns_topic_creation Indicates whether to create an SNS topic within this module bool true no
sns_topic_arn The ARN of an existing SNS topic for notifications string null no
sns_topic_name The name of an existing or new SNS topic for notifications string "cost-anomaly-notifications" no

Outputs

No outputs.