Skip to content

Commit

Permalink
Tke a swing at creating an OAM sunk
Browse files Browse the repository at this point in the history
  • Loading branch information
tmclaugh committed Aug 17, 2024
1 parent c165b54 commit 51f85e8
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 2 deletions.
1 change: 1 addition & 0 deletions cfn-parameters.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"AwsOrgId": $secrets.AWS_ORG_ID,
"ObservabilityOu": "ou-c834-7gp1wa8v",
"TargetRegions": "us-east-1",
"DatadogHttpEndpointUrl": "https://aws-kinesis-http-intake.logs.us5.datadoghq.com/api/v2/logs?dd-protocol=aws-kinesis-firehose",
Expand Down
28 changes: 28 additions & 0 deletions stacksets/datadog-shipping/oam-sink-template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
AWSTemplateFormatVersion: '2010-09-09'
Description: AWS CloudWatch OAM Sink

Parameters:
AwsOrgId:
Type: String

Resources:
OamSink:
Type: AWS::OAM::Sink
Properties:
Name: OrganizationSink
Policy:
Version: '2012-10-17'
Statement:
- Effect: Allow
Principal: "*"
Resource: "*"
Action:
- "oam:CreateLink"
- "oam:UpdateLink"
Condition:
StringEquals:
aws:PrincipalOrgID: !Ref AwsOrgId
ForAllValues:StringEquals:
oam:ResourceTypes:
- "AWS::CloudWatch::Metric"
- "AWS::Logs::LogGroup"
33 changes: 31 additions & 2 deletions stacksets/datadog-shipping/stackset.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
Metadata:
localTemplateFile: &template_body ./logs-template.yaml
DatadogLogShipping:
localTemplateFile: &dd_logs_template_body ./logs-template.yaml
OamSink:
localTemplateFile: &oam_sink_template_body ./oam-sink-template.yaml

AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Expand All @@ -12,6 +15,8 @@ Parameters:
TargetRegions:
Type: CommaDelimitedList
Description: Regions to deploy to
AwsOrgId:
Type: String
DatadogHttpEndpointUrl:
Type: String
DatadogApiKey:
Expand Down Expand Up @@ -45,4 +50,28 @@ Resources:
FailureToleranceCount: 1
MaxConcurrentCount: 5
PermissionModel: SERVICE_MANAGED
TemplateBody: *template_body
TemplateBody: *dd_logs_template_body

CloudWatchOamSinkStacxkSet:
Type: AWS::CloudFormation::StackSet
Properties:
StackSetName: CloudWatchOamSink
Description: CloudWatch OAM Sink
Parameters:
- ParameterKey: AwsOrgId
ParameterValue: !Ref AwsOrgId
StackInstancesGroup:
- DeploymentTargets:
OrganizationalUnitIds: !Ref ObservabilityOu
Regions: !Ref TargetRegions
AutoDeployment:
Enabled: true
RetainStacksOnAccountRemoval: false
ManagedExecution:
Active: true
OperationPreferences:
RegionConcurrencyType: PARALLEL
FailureToleranceCount: 1
MaxConcurrentCount: 5
PermissionModel: SERVICE_MANAGED
TemplateBody: *oam_sink_template_body
3 changes: 3 additions & 0 deletions template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ Parameters:
TargetRegions:
Type: String
Description: List of OUs
AwsOrgId:
Type: String
ObservabilityOu:
Type: String
Description: OU of observability accounts
Expand All @@ -26,3 +28,4 @@ Resources:
TargetRegions: !Ref TargetRegions
DatadogHttpEndpointUrl: !Ref DatadogHttpEndpointUrl
DatadogApiKey: !Ref DatadogApiKey
AwsOrgId: !Ref AwsOrgId

0 comments on commit 51f85e8

Please sign in to comment.