Skip to content

Commit

Permalink
[IT-3326] Update python version for PyPlate (#405)
Browse files Browse the repository at this point in the history
AWS no longer supports python 3.6 so we need to Update the python version for the pyplate lambda

* update linters
* fix linter error
  E3045 A bucket with AccessControl set should also have OwnershipControl configured
  • Loading branch information
zaro0508 authored Feb 29, 2024
1 parent 97d320a commit db28ab8
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 17 deletions.
2 changes: 2 additions & 0 deletions .cfnlintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@ ignore_checks:
- E1001
- E2531
- E3001
- W2001
- W3045
ignore_templates:
- templates/tags/*.json
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
rev: v4.5.0
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
- id: check-ast
- repo: https://github.com/adrienverge/yamllint
rev: v1.28.0
rev: v1.34.0
hooks:
- id: yamllint
- repo: https://github.com/awslabs/cfn-python-lint
rev: v0.68.0
rev: v0.85.1
hooks:
- id: cfn-python-lint
files: templates/.*\.(json|yml|yaml)$
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.3.1
rev: v1.5.4
hooks:
- id: remove-tabs
10 changes: 3 additions & 7 deletions templates/Config/config.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
# From https://github.com/org-formation/org-formation-reference/blob/master/src/templates/080-aws-config-inventory/config.yml
AWSTemplateFormatVersion: '2010-09-09'

# This is an org-formation file, not a cloudformation file therefore some cfn-lint rules do not apply
# rules reference: https://github.com/aws-cloudformation/cfn-python-lint/blob/master/docs/rules.md#rules-1
Metadata:
cfn-lint:
config:
ignore_checks: [W2001]

Parameters:
resourcePrefix:
Type: String
Expand All @@ -34,6 +27,9 @@ Resources:
BlockPublicPolicy: true
IgnorePublicAcls: true
RestrictPublicBuckets: true
OwnershipControls:
Rules:
- ObjectOwnership: BucketOwnerEnforced
BucketEncryption:
ServerSideEncryptionConfiguration:
- ServerSideEncryptionByDefault:
Expand Down
3 changes: 3 additions & 0 deletions templates/GuardDuty/guard-duty.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ Resources:
Properties:
BucketName: !Sub '${resourcePrefix}-guardduty-finding'
AccessControl: Private
OwnershipControls:
Rules:
- ObjectOwnership: BucketOwnerEnforced
PublicAccessBlockConfiguration:
BlockPublicAcls: true
BlockPublicPolicy: true
Expand Down
5 changes: 0 additions & 5 deletions templates/GuardDuty/trusted-ips-bucket.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
# From https://github.com/org-formation/org-formation-reference/tree/master/src/templates/070-guard-duty
AWSTemplateFormatVersion: '2010-09-09'

Metadata:
cfn-lint:
config:
ignore_checks: [W2001]

Parameters:
resourcePrefix:
Type: String
Expand Down
2 changes: 1 addition & 1 deletion templates/PyPlate/python.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Resources:
return macro_response
Handler: index.handler
Runtime: python3.6
Runtime: python3.9
Role: !GetAtt TransformExecutionRole.Arn
TransformFunctionPermissions:
Type: AWS::Lambda::Permission
Expand Down
3 changes: 3 additions & 0 deletions templates/S3/public-bucket.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ Resources:
DeletionPolicy: Delete
Properties:
AccessControl: PublicRead
OwnershipControls:
Rules:
- ObjectOwnership: BucketOwnerEnforced
BucketPolicy:
Type: "AWS::S3::BucketPolicy"
Properties:
Expand Down
6 changes: 6 additions & 0 deletions templates/managed-s3Web.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,19 @@ Resources:
Type: 'AWS::S3::Bucket'
Properties:
AccessControl: LogDeliveryWrite
OwnershipControls:
Rules:
- ObjectOwnership: BucketOwnerEnforced
BucketName: !Join
- '.'
- [!Ref SubDomainName, !Ref DomainName, 'logs']
WebsiteBucket:
Type: AWS::S3::Bucket
Properties:
AccessControl: PublicRead
OwnershipControls:
Rules:
- ObjectOwnership: BucketOwnerEnforced
BucketName: !Join
- '.'
- [!Ref SubDomainName, !Ref DomainName]
Expand Down
6 changes: 6 additions & 0 deletions templates/managed-s3WebCloudfront.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,19 @@ Resources:
Type: 'AWS::S3::Bucket'
Properties:
AccessControl: LogDeliveryWrite
OwnershipControls:
Rules:
- ObjectOwnership: BucketOwnerEnforced
BucketName: !Join
- '.'
- [!Ref SubDomainName, !Ref DomainName, 'logs']
WebsiteBucket:
Type: AWS::S3::Bucket
Properties:
AccessControl: PublicRead
OwnershipControls:
Rules:
- ObjectOwnership: BucketOwnerEnforced
BucketName: !Join
- '.'
- [!Ref SubDomainName, !Ref DomainName]
Expand Down
3 changes: 3 additions & 0 deletions templates/s3-redirector.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ Resources:
Type: AWS::S3::Bucket
Properties:
AccessControl: PublicRead
OwnershipControls:
Rules:
- ObjectOwnership: BucketOwnerEnforced
BucketName: !Ref SourceHostName
WebsiteConfiguration:
IndexDocument: index.html
Expand Down

0 comments on commit db28ab8

Please sign in to comment.