Skip to content

Commit

Permalink
Update bucket_access_logging.sql
Browse files Browse the repository at this point in the history
  • Loading branch information
candiduslynx authored Dec 21, 2023
1 parent 88d0ad5 commit d5bfa30
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions transformations/aws/macros/cloudtrail/bucket_access_logging.sql
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,14 @@ select
t.account_id,
t.arn as resource_id,
case
when b.logging_target_bucket is null or b.logging_target_prefix is null then 'fail'
when l.logging_enabled is null then 'fail'
when l.logging_enabled -> 'TargetBucket' is null then 'fail'
when l.logging_enabled -> 'TargetPrefix' is null then 'fail'
else 'pass'
end as status
from aws_cloudtrail_trails t
inner join aws_s3_buckets b on t.s3_bucket_name = b.name
inner join aws_s3_bucket_loggings l on b.arn = l.bucket_arn
{% endmacro %}

{% macro bigquery__bucket_access_logging(framework, check_id) %}
Expand All @@ -27,11 +30,14 @@ select
t.account_id,
t.arn as resource_id,
case
when b.logging_target_bucket is null or b.logging_target_prefix is null then 'fail'
when l.logging_enabled is null then 'fail'
when l.logging_enabled -> 'TargetBucket' is null then 'fail'
when l.logging_enabled -> 'TargetPrefix' is null then 'fail'
else 'pass'
end as status
from {{ full_table_name("aws_cloudtrail_trails") }} t
inner join {{ full_table_name("aws_s3_buckets") }} b on t.s3_bucket_name = b.name
inner join {{ full_table_name("aws_s3_bucket_loggings") }} l on b.arn = l.bucket_arn
{% endmacro %}

{% macro snowflake__bucket_access_logging(framework, check_id) %}
Expand All @@ -42,9 +48,12 @@ select
t.account_id,
t.arn as resource_id,
case
when b.logging_target_bucket is null or b.logging_target_prefix is null then 'fail'
when l.logging_enabled is null then 'fail'
when l.logging_enabled -> 'TargetBucket' is null then 'fail'
when l.logging_enabled -> 'TargetPrefix' is null then 'fail'
else 'pass'
end as status
from aws_cloudtrail_trails t
inner join aws_s3_buckets b on t.s3_bucket_name = b.name
{% endmacro %}
inner join aws_s3_bucket_loggings l on b.arn = l.bucket_arn
{% endmacro %}

0 comments on commit d5bfa30

Please sign in to comment.