Creates an AWS CloudWatch Observability Access Manager Sink and attaches a policy to it.

Terraform Template

resource "aws_oam_sink" "example" {
  name = "ExampleSink"
}

resource "aws_oam_sink_policy" "example" {
  policy = jsonencode({
 Version = "2012-10-17"
 Statement = [
 {
 Action = ["oam:CreateLink", "oam:UpdateLink"]
 Effect = "Allow"
 Resource = "*"
 Principal = {
 "AWS" = ["1111111111111", "222222222222"]
 }
 Condition = {
 "ForAllValues:StringEquals" = {
 "oam:ResourceTypes" = ["AWS::CloudWatch::Metric", "AWS::Logs::LogGroup"]
 }
 }
 }
 ]
 })
  sink_identifier = aws_oam_sink.example.id
}