sns_topic_arn

Type string
Module cost-controls
Version 0.1.0

ARN of the SNS topic used for budget notifications. Available when the module creates its own SNS topic or when an existing topic is provided.

The ARN of the SNS topic used for budget notifications. This output is available when the module creates its own SNS topic or when an existing topic is provided.

Example Value

arn:aws:sns:us-east-1:123456789012:budget-alerts

Common Use Cases

Subscribe Additional Endpoints

resource "aws_sns_topic_subscription" "slack" {
  topic_arn = module.budget.sns_topic_arn
  protocol  = "https"
  endpoint  = "https://hooks.slack.com/services/XXX/YYY/ZZZ"
}

Lambda Integration

resource "aws_lambda_permission" "sns" {
  statement_id  = "AllowSNSInvoke"
  action        = "lambda:InvokeFunction"
  function_name = aws_lambda_function.cost_processor.function_name
  principal     = "sns.amazonaws.com"
  source_arn    = module.budget.sns_topic_arn
}

resource "aws_sns_topic_subscription" "lambda" {
  topic_arn = module.budget.sns_topic_arn
  protocol  = "lambda"
  endpoint  = aws_lambda_function.cost_processor.arn
}

Centralized Alerting

# Forward to central alerting SNS topic
resource "aws_sns_topic_subscription" "central" {
  topic_arn = module.budget.sns_topic_arn
  protocol  = "sns"
  endpoint  = var.central_alerts_topic_arn
}

Usage

module "cost_controls" {
  source  = "registry.patterneddesigns.ca/governance/cost-controls/aws"
  version = "0.1.0"
  # ... inputs
}

# Access this output
output "sns_topic_arn" {
  value = module.cost_controls.sns_topic_arn
}