File tree 9 files changed +95
-7
lines changed
9 files changed +95
-7
lines changed Original file line number Diff line number Diff line change @@ -37,3 +37,11 @@ repos:
37
37
hooks :
38
38
- id : shellcheck
39
39
# - id: markdown-link-check
40
+ # - repo: https://github.com/igorshubovych/markdownlint-cli
41
+ # rev: v0.23.2
42
+ # hooks:
43
+ # - id: markdownlint
44
+ # args: [
45
+ # "--config=.mdlrc"
46
+ # ]
47
+ # default_stages: [commit, push]
Original file line number Diff line number Diff line change
1
+
2
+ # https://terraform-docs.io/user-guide/configuration/
3
+
1
4
formatter : markdown
2
5
# settings:
3
6
# anchor: false
4
7
# html: false
8
+
9
+ # sort:
10
+ # enabled: true
11
+ # by: required
Original file line number Diff line number Diff line change 1
1
2
+ # https://github.com/terraform-linters/tflint
3
+ # https://github.com/terraform-linters/tflint/tree/master/docs/user-guide
4
+
2
5
# Run: tflint --init
3
6
4
7
plugin "aws" {
@@ -7,15 +10,33 @@ plugin "aws" {
7
10
source = " github.com/terraform-linters/tflint-ruleset-aws"
8
11
}
9
12
13
+ rule "terraform_deprecated_index" {
14
+ enabled = true
15
+ }
16
+ rule "terraform_deprecated_interpolation" {
17
+ enabled = true
18
+ }
10
19
rule "terraform_documented_outputs" {
11
20
enabled = true
12
21
}
13
22
rule "terraform_documented_variables" {
14
23
enabled = true
15
24
}
25
+ rule "terraform_required_providers" {
26
+ enabled = true
27
+ }
28
+ rule "terraform_required_version" {
29
+ enabled = true
30
+ }
31
+ # rule "terraform_standard_module_structure" {
32
+ # enabled = true
33
+ # }
16
34
rule "terraform_typed_variables" {
17
35
enabled = true
18
36
}
19
37
rule "terraform_unused_declarations" {
20
38
enabled = true
21
39
}
40
+ rule "terraform_unused_required_providers" {
41
+ enabled = true
42
+ }
Original file line number Diff line number Diff line change 2
2
# Manage KMS keys
3
3
4
4
# CloudTrail
5
- # regional replicas ??
5
+ # key in region where S3 bucket is. Can be cross account
6
6
# EBS
7
7
# regional replicas
8
8
# S3
32
32
# }
33
33
34
34
# CloudTrail KMS policy
35
- # Allow access to all accounts and regions
35
+ # Allow access to all accounts and regions - Not needed for org controlled trail
36
36
# {
37
37
# "Sid": "Allow CloudTrail to encrypt logs",
38
38
# "Effect": "Allow",
Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ No modules.
33
33
| [ aws_organizations_policy.deny_ebs_default_encryption_disable] ( https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/organizations_policy ) | resource |
34
34
| [ aws_organizations_policy.deny_ecr_create_write] ( https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/organizations_policy ) | resource |
35
35
| [ aws_organizations_policy.deny_guardduty_modify] ( https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/organizations_policy ) | resource |
36
+ | [ aws_organizations_policy.deny_iam_user_create] ( https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/organizations_policy ) | resource |
36
37
| [ aws_organizations_policy.deny_member_leaving] ( https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/organizations_policy ) | resource |
37
38
| [ aws_organizations_policy.deny_s3_public] ( https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/organizations_policy ) | resource |
38
39
| [ aws_organizations_policy.deny_s3_unsecure_requests] ( https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/organizations_policy ) | resource |
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ https://asecure.cloud/l/scp/
5
5
https://summitroute.com/blog/2020/03/25/aws_scp_best_practices/
6
6
https://globaldatanet.com/tech-blog/scp-best-practices
7
7
https://d1.awsstatic.com/whitepapers/building_an_aws_perimeter.pdf
8
-
8
+ https://cloudsecdocs.com/aws/defensive/resources/scps/#sample-scps
9
9
10
10
Update all SCP to exclude role "arn:aws:iam::*:role/OrganizationAccountAccessRole" from deny policies
11
11
As a variable??
Original file line number Diff line number Diff line change
1
+ {
2
+ "Version" : " 2012-10-17" ,
3
+ "Statement" : [
4
+ {
5
+ "Sid" : " DenyECRCreateWrite" ,
6
+ "Effect" : " Deny" ,
7
+ "Action" : [
8
+ " ecr:BatchDeleteImage" ,
9
+ " ecr:CompleteLayerUpload" ,
10
+ " ecr:CreateRepository" ,
11
+ " ecr:DeleteRepository" ,
12
+ " ecr:DeleteRepositoryPolicy" ,
13
+ " ecr:GetRepositoryPolicy" ,
14
+ " ecr:InitiateLayerUpload" ,
15
+ " ecr:PutImage" ,
16
+ " ecr:SetRepositoryPolicy" ,
17
+ " ecr:UploadLayerPart"
18
+ ],
19
+ "Resource" : [
20
+ " *"
21
+ ],
22
+ "Condition" : {
23
+ "StringNotLike" : {
24
+ "aws:PrincipalARN" :" arn:aws:sts::*:assumed-role/OrganizationAccountAccessRole/*"
25
+ }
26
+ }
27
+ }
28
+ ]
29
+ }
Original file line number Diff line number Diff line change
1
+ {
2
+ "Version" : " 2012-10-17" ,
3
+ "Statement" : [
4
+ {
5
+ "Sid" : " DenyUserCreate" ,
6
+ "Effect" : " Deny" ,
7
+ "Action" : [
8
+ " iam:CreateUser"
9
+ ],
10
+ "Resource" : [
11
+ " *"
12
+ ]
13
+ }
14
+ ]
15
+ }
Original file line number Diff line number Diff line change @@ -86,13 +86,20 @@ resource "aws_organizations_policy" "deny_guardduty_modify" {
86
86
# resource "aws_organizations_policy" "deny_iam_password_policy_modify" {
87
87
# count = local.enable && var.enable_iam ? 1 : 0
88
88
# name = "deny_iam_password_policy_modify"
89
- # description = "Prevent ECR from being created or written too "
89
+ # description = "Prevent IAM password policy from being modified "
90
90
# tags = var.tags
91
91
# type = "SERVICE_CONTROL_POLICY"
92
- # content = file("${path.module}/files/deny-ecr-create-write .json")
92
+ # content = file("${path.module}/files/deny-iam-password-policy-modify .json")
93
93
# }
94
- # TODO:
95
- # deny user create
94
+ resource "aws_organizations_policy" "deny_iam_user_create" {
95
+ count = local. enable && var. enable_iam ? 1 : 0
96
+ name = " deny_iam_user_create"
97
+ description = " Prevent Users from being created"
98
+ tags = var. tags
99
+ type = " SERVICE_CONTROL_POLICY"
100
+ content = file (" ${ path . module } /files/deny-iam-user-create.json" )
101
+ }
102
+
96
103
# ## -----------------------
97
104
# ## Organization
98
105
# ## -----------------------
You can’t perform that action at this time.
0 commit comments