-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from bridgecrewio/cleanup
Add pre-commits and tfdocs support - cleanup old module
- Loading branch information
Showing
18 changed files
with
593 additions
and
309 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
.terraform | ||
*.tfstate* | ||
*.tfvars* | ||
.terraform.lock.hcl | ||
.terraform.lock.hcl | ||
.DS_Store |
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,12 @@ | ||
{ | ||
"MD002": false, | ||
"MD013": false, | ||
"MD033": { | ||
"allowed_elements": [ | ||
"br", | ||
"a" | ||
] | ||
}, | ||
"MD034": false, | ||
"MD041": false | ||
} |
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,58 @@ | ||
--- | ||
# yamllint disable rule:line-length | ||
default_language_version: | ||
python: python3.8 | ||
repos: | ||
- repo: git://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.0.1 | ||
hooks: | ||
- id: check-json | ||
- id: check-merge-conflict | ||
- id: trailing-whitespace | ||
- id: end-of-file-fixer | ||
- id: check-yaml | ||
- id: check-added-large-files | ||
- id: pretty-format-json | ||
args: | ||
- --autofix | ||
- id: detect-aws-credentials | ||
args: | ||
- --allow-missing-credentials | ||
- id: detect-private-key | ||
- repo: git://github.com/Lucas-C/pre-commit-hooks | ||
rev: v1.1.10 | ||
hooks: | ||
- id: forbid-tabs | ||
exclude_types: [python, javascript, dtd, markdown, makefile, xml] | ||
exclude: binary|\.bin$ | ||
- repo: git://github.com/jameswoolfenden/pre-commit-shell | ||
rev: 0.0.2 | ||
hooks: | ||
- id: shell-lint | ||
exclude: template|\.template$ | ||
- repo: git://github.com/igorshubovych/markdownlint-cli | ||
rev: v0.27.1 | ||
hooks: | ||
- id: markdownlint | ||
- repo: git://github.com/adrienverge/yamllint | ||
rev: v1.26.1 | ||
hooks: | ||
- id: yamllint | ||
name: yamllint | ||
description: This hook runs yamllint. | ||
entry: yamllint | ||
language: python | ||
types: [file, yaml] | ||
- repo: git://github.com/jameswoolfenden/pre-commit | ||
rev: v0.1.46 | ||
hooks: | ||
- id: terraform-fmt | ||
language_version: python3.8 | ||
- id: tf2docs | ||
language_version: python3.8 | ||
- repo: git://github.com/bridgecrewio/checkov | ||
rev: 2.0.181 | ||
hooks: | ||
- id: checkov | ||
verbose: true | ||
entry: checkov -d example/examplea |
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,42 @@ | ||
|
||
resource "aws_s3_bucket" "access_log_bucket" { | ||
# checkov:skip=CKV_AWS_144: Cross region replication is overkill | ||
# checkov:skip=CKV_AWS_18: | ||
# checkov:skip=CKV_AWS_52: | ||
bucket = var.access_log_bucket_name | ||
acl = "log-delivery-write" | ||
force_destroy = true | ||
|
||
tags = var.tags | ||
|
||
versioning { | ||
enabled = true | ||
} | ||
|
||
server_side_encryption_configuration { | ||
rule { | ||
apply_server_side_encryption_by_default { | ||
kms_master_key_id = aws_kms_key.ssmkey.arn | ||
sse_algorithm = "aws:kms" | ||
} | ||
} | ||
} | ||
|
||
lifecycle_rule { | ||
id = "delete_after_X_days" | ||
enabled = true | ||
|
||
expiration { | ||
days = var.access_log_expire_days | ||
} | ||
} | ||
} | ||
|
||
|
||
resource "aws_s3_bucket_public_access_block" "access_log_bucket" { | ||
bucket = aws_s3_bucket.access_log_bucket.id | ||
block_public_acls = true | ||
block_public_policy = true | ||
ignore_public_acls = true | ||
restrict_public_buckets = true | ||
} |
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,49 @@ | ||
resource "aws_s3_bucket" "session_logs_bucket" { | ||
# checkov:skip=CKV_AWS_144: Cross region replication overkill | ||
# checkov:skip=CKV_AWS_52: | ||
bucket = var.bucket_name | ||
acl = "private" | ||
force_destroy = true | ||
tags = var.tags | ||
|
||
versioning { | ||
enabled = true | ||
} | ||
|
||
server_side_encryption_configuration { | ||
rule { | ||
apply_server_side_encryption_by_default { | ||
kms_master_key_id = aws_kms_key.ssmkey.arn | ||
sse_algorithm = "aws:kms" | ||
} | ||
} | ||
} | ||
|
||
lifecycle_rule { | ||
id = "archive_after_X_days" | ||
enabled = true | ||
|
||
transition { | ||
days = var.log_archive_days | ||
storage_class = "GLACIER" | ||
} | ||
|
||
expiration { | ||
days = var.log_expire_days | ||
} | ||
} | ||
|
||
logging { | ||
target_bucket = aws_s3_bucket.access_log_bucket.id | ||
target_prefix = "log/" | ||
} | ||
|
||
} | ||
|
||
resource "aws_s3_bucket_public_access_block" "session_logs_bucket" { | ||
bucket = aws_s3_bucket.session_logs_bucket.id | ||
block_public_acls = true | ||
block_public_policy = true | ||
ignore_public_acls = true | ||
restrict_public_buckets = true | ||
} |
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,25 @@ | ||
|
||
# Create VPC Endpoints For Session Manager | ||
resource "aws_security_group" "ssm_sg" { | ||
count = var.vpc_endpoints_enabled ? 1 : 0 | ||
name = "ssm-sg" | ||
description = "Allow TLS inbound To AWS Systems Manager Session Manager" | ||
vpc_id = var.vpc_id | ||
|
||
ingress { | ||
description = "HTTPS from VPC" | ||
from_port = 443 | ||
to_port = 443 | ||
protocol = "tcp" | ||
cidr_blocks = [data.aws_vpc.selected[0].cidr_block] | ||
} | ||
|
||
egress { | ||
description = "Allow All Egress" | ||
from_port = 0 | ||
to_port = 0 | ||
protocol = "-1" | ||
cidr_blocks = ["0.0.0.0/0"] | ||
} | ||
tags = var.tags | ||
} |
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,4 @@ | ||
data "aws_vpc" "selected" { | ||
count = var.vpc_endpoints_enabled ? 1 : 0 | ||
id = var.vpc_id | ||
} |
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,7 @@ | ||
module "ssm" { | ||
source = "../../" | ||
bucket_name = "my-session-logs" | ||
access_log_bucket_name = "my-session-access-logs" | ||
enable_log_to_s3 = true | ||
enable_log_to_cloudwatch = true | ||
} |
Oops, something went wrong.