-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Join sms_usage and notifications in cloud formation (#1231)
* rough in cloudformation join * tweak manifeset file for different environments * works * remove projection
- Loading branch information
Showing
7 changed files
with
138 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
# valid column types are [STRING INTEGER DECIMAL DATETIME BIT BOOLEAN JSON] | ||
# We have to use a cloudformation stack here because the provider has a bug in it | ||
# Ref: https://github.com/hashicorp/terraform-provider-aws/issues/34199 | ||
|
||
resource "aws_cloudformation_stack" "sms-usage-notifications" { | ||
name = "sms-usage-notifications" | ||
notification_arns = ["arn:aws:sns:ca-central-1:${var.account_id}:aws-controltower-SecurityNotifications"] | ||
|
||
template_body = jsonencode({ | ||
|
||
Resources = { | ||
smsusageJoined = { | ||
Type = "AWS::QuickSight::DataSet" | ||
Properties = { | ||
AwsAccountId = var.account_id | ||
DataSetId = "sms-usage-notifications" | ||
Name = "Notifications with SMS pricing" | ||
Permissions = [ | ||
{ | ||
Actions = [ | ||
"quicksight:DescribeDataSet", | ||
"quicksight:DescribeDataSetPermissions", | ||
"quicksight:DescribeIngestion", | ||
"quicksight:ListIngestions", | ||
"quicksight:PassDataSet" | ||
], | ||
Principal = aws_quicksight_group.dataset_viewer.arn | ||
}, | ||
{ | ||
Actions = [ | ||
"quicksight:DescribeDataSet", | ||
"quicksight:DescribeDataSetPermissions", | ||
"quicksight:DescribeIngestion", | ||
"quicksight:ListIngestions", | ||
"quicksight:PassDataSet", | ||
"quicksight:DeleteDataSet", | ||
"quicksight:UpdateDataSet", | ||
"quicksight:UpdateDataSetPermissions", | ||
"quicksight:CreateIngestion", | ||
"quicksight:CancelIngestion" | ||
], | ||
Principal = aws_quicksight_group.dataset_owner.arn | ||
} | ||
], | ||
|
||
|
||
LogicalTableMap = { | ||
|
||
sms-usage-notifications = { | ||
Alias = "sms-usage-notifications", | ||
Source = { | ||
JoinInstruction = { | ||
LeftOperand = "sms-usage", | ||
RightOperand = "notifications", | ||
Type = "LEFT", | ||
OnClause = "{MessageId} = {notification_reference}" | ||
} | ||
} | ||
}, | ||
|
||
notifications = { | ||
Alias = "notifications", | ||
Source = { | ||
DataSetArn = aws_quicksight_data_set.notifications.arn | ||
} | ||
}, | ||
|
||
sms-usage = { | ||
Alias = "sms-usage", | ||
Source = { | ||
DataSetArn = aws_quicksight_data_set.sms_usage.arn | ||
} | ||
}, | ||
}, | ||
DataSetUsageConfiguration = { | ||
DisableUseAsDirectQuerySource = false, | ||
DisableUseAsImportedSource = false | ||
}, | ||
ImportMode = "SPICE" | ||
} | ||
} | ||
} | ||
}) | ||
} | ||
|
||
|
||
resource "aws_quicksight_refresh_schedule" "sms-usage-notifications" { | ||
data_set_id = "sms-usage-notifications" | ||
schedule_id = "schedule-sms-usage-notifications" | ||
depends_on = [aws_cloudformation_stack.sms-usage-notifications] | ||
|
||
schedule { | ||
refresh_type = "FULL_REFRESH" | ||
|
||
schedule_frequency { | ||
interval = "DAILY" | ||
time_of_the_day = "07:45" | ||
} | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
aws/quicksight/s3-manifests/s3-manifest-sms-usage-dev.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"fileLocations": [ | ||
{ | ||
"URIPrefixes": [ | ||
"s3://notification-canada-ca-dev-sms-usage-logs/SMSUsageReports/ca-central-1/" | ||
] | ||
} | ||
], | ||
"globalUploadSettings": { | ||
"format": "CSV", | ||
"delimiter": ",", | ||
"textqualifier": "'", | ||
"containsHeader": "true" | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
aws/quicksight/s3-manifests/s3-manifest-sms-usage-production.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"fileLocations": [ | ||
{ | ||
"URIPrefixes": [ | ||
"s3://notification-canada-ca-production-sms-usage-logs/SMSUsageReports/ca-central-1/" | ||
] | ||
} | ||
], | ||
"globalUploadSettings": { | ||
"format": "CSV", | ||
"delimiter": ",", | ||
"textqualifier": "'", | ||
"containsHeader": "true" | ||
} | ||
} |
File renamed without changes.