File tree Expand file tree Collapse file tree 2 files changed +49
-0
lines changed
terraform/modules/department Expand file tree Collapse file tree 2 files changed +49
-0
lines changed Original file line number Diff line number Diff line change @@ -809,6 +809,41 @@ resource "aws_iam_policy" "parameter_store_read_only" {
809809 policy = data. aws_iam_policy_document . parameter_store_read_only . json
810810}
811811
812+ // CloudWatch and ECS logs access policy for departmental SSO users
813+ data "aws_iam_policy_document" "departmental_cloudwatch_and_ecs_logs_access" {
814+ statement {
815+ sid = " ECSLogsAccess"
816+ effect = " Allow"
817+ actions = [
818+ " logs:DescribeLogStreams" ,
819+ " logs:GetLogEvents" ,
820+ " logs:DescribeLogGroups"
821+ ]
822+ resources = [
823+ " arn:aws:logs:*:*:/ecs/*${ local . department_identifier } *"
824+ ]
825+ }
826+
827+ statement {
828+ sid = " CloudWatchMetricsAccess"
829+ effect = " Allow"
830+ actions = [
831+ " cloudwatch:GetMetricData" ,
832+ " cloudwatch:GetMetricStatistics" ,
833+ " cloudwatch:ListMetrics"
834+ ]
835+ resources = [" *" ]
836+ }
837+ }
838+
839+ resource "aws_iam_policy" "departmental_cloudwatch_and_ecs_logs_access" {
840+ tags = var. tags
841+
842+ name = lower (" ${ var . identifier_prefix } -${ local . department_identifier } -cloudwatch-ecs-logs-access" )
843+ description = " Allows departmental access to CloudWatch metrics and department-specific ECS log groups"
844+ policy = data. aws_iam_policy_document . departmental_cloudwatch_and_ecs_logs_access . json
845+ }
846+
812847// Glue Agent Read only policy for glue scripts and mwaa bucket and run athena
813848data "aws_iam_policy_document" "read_glue_scripts_and_mwaa_and_athena" {
814849 statement {
Original file line number Diff line number Diff line change @@ -25,6 +25,20 @@ resource "aws_ssoadmin_permission_set_inline_policy" "department" {
2525 permission_set_arn = aws_ssoadmin_permission_set. department [0 ]. arn
2626}
2727
28+ resource "aws_ssoadmin_customer_managed_policy_attachment" "departmental_cloudwatch_ecs_logs" {
29+ count = local. deploy_sso ? 1 : 0
30+
31+ provider = aws. aws_hackit_account
32+
33+ instance_arn = var. sso_instance_arn
34+ permission_set_arn = aws_ssoadmin_permission_set. department [0 ]. arn
35+
36+ customer_managed_policy_reference {
37+ name = aws_iam_policy. departmental_cloudwatch_and_ecs_logs_access . name
38+ path = " /"
39+ }
40+ }
41+
2842data "aws_identitystore_group" "department" {
2943 count = local. deploy_sso ? 1 : 0
3044
You can’t perform that action at this time.
0 commit comments