@@ -7,13 +7,16 @@ terraform {
77data "aws_iam_policy_document" "demo_bucket_policy" {
88 statement {
99 sid = "ListBucket"
10+ principals {
11+ type = "AWS"
12+ identifiers = ["*"]
13+ }
1014 effect = "Allow"
1115 actions = [
1216 "s3:ListBuckets"
1317 ]
1418 resources = ["*"]
1519 }
16-
1720}
1821
1922resource "aws_s3_bucket_policy" "demo_bucket_policy" {
@@ -25,12 +28,12 @@ resource "aws_s3_bucket_policy" "demo_bucket_policy" {
2528*** commands***
2629``` bash
2730$ terraform init
28- $ terraform plan -out tf.plan
31+ $ terraform plan -out tf.plan
2932$ terraform show -json -no-color tf.plan > tf.json
3033
3134$ python3 -m pip install pipenv
32- $ pipenv install
33- $ pipenv run python iam_check/iam_check.py --config iam_check/config/default.yaml --template-path tf.json --region us-east-1
35+ $ pipenv install
36+ $ pipenv run python iam_check/iam_check.py --config iam_check/config/default.yaml --template-path tf.json --region us-east-1
3437```
3538
3639*** report***
@@ -59,15 +62,52 @@ $ pipenv run python iam_check/iam_check.py --config iam_check/config/default.yam
5962 }
6063 ],
6164 "span" : {
65+ "start" : {
66+ "line" : 9 ,
67+ "column" : 18 ,
68+ "offset" : 181
69+ },
6270 "end" : {
71+ "line" : 9 ,
6372 "column" : 34 ,
64- "line" : 6 ,
65- "offset" : 140
73+ "offset" : 197
74+ }
75+ }
76+ }
77+ ]
78+ }
79+ },
80+ {
81+ "findingType" : " ERROR" ,
82+ "code" : " UNSUPPORTED_RESOURCE_ARN_IN_POLICY" ,
83+ "message" : " The resource ARN is not supported for the resource-based policy attached to resource type S3 Bucket." ,
84+ "resourceName" : " demo-bucket" ,
85+ "policyName" : " aws_s3_bucket_policy.demo_bucket_policy" ,
86+ "details" : {
87+ "findingDetails" : " The resource ARN is not supported for the resource-based policy attached to resource type S3 Bucket." ,
88+ "findingType" : " ERROR" ,
89+ "issueCode" : " UNSUPPORTED_RESOURCE_ARN_IN_POLICY" ,
90+ "learnMoreLink" : " https://docs.aws.amazon.com/IAM/latest/UserGuide/access-analyzer-reference-policy-checks.html#access-analyzer-reference-policy-checks-error-unsupported-resource-arn-in-policy" ,
91+ "locations" : [
92+ {
93+ "path" : [
94+ {
95+ "value" : " Statement"
6696 },
97+ {
98+ "value" : " Resource"
99+ }
100+ ],
101+ "span" : {
67102 "start" : {
68- "column" : 18 ,
69- "line" : 6 ,
70- "offset" : 124
103+ "line" : 10 ,
104+ "column" : 20 ,
105+ "offset" : 219
106+ },
107+ "end" : {
108+ "line" : 10 ,
109+ "column" : 23 ,
110+ "offset" : 222
71111 }
72112 }
73113 }
@@ -77,4 +117,4 @@ $ pipenv run python iam_check/iam_check.py --config iam_check/config/default.yam
77117 ],
78118 "NonBlockingFindings" : []
79119}
80- ```
120+ ```
0 commit comments