Skip to content

Commit 9c789af

Browse files
committed
add cmd to format examples
Signed-off-by: Nikita Pivkin <[email protected]>
1 parent 3f0a2ab commit 9c789af

File tree

220 files changed

+4166
-3975
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

220 files changed

+4166
-3975
lines changed

Makefile

+6-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ fmt-rego:
1313

1414
.PHONY: test-rego
1515
test-rego:
16-
go run ./cmd/opa test --explain=fails lib/ checks/
16+
go run ./cmd/opa test --explain=fails lib/ checks/ --ignore '*.yaml'
1717

1818
.PHONY: bundle
1919
bundle: create-bundle verify-bundle
@@ -49,4 +49,8 @@ verify-bundle:
4949
rm scripts/bundle.tar.gz
5050

5151
build-opa:
52-
go build ./cmd/opa
52+
go build ./cmd/opa
53+
54+
.PHONY: fmt-examples
55+
fmt-examples:
56+
go run ./cmd/fmt-examples

avd_docs/aws/apigateway/AVD-AWS-0001/CloudFormation.md

+12-11
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,20 @@
22
Enable logging for API Gateway stages
33

44
```yaml
5-
AWSTemplateFormatVersion: 2010-09-09T00:00:00Z
5+
AWSTemplateFormatVersion: "2010-09-09T00:00:00Z"
66
Description: Good Example of ApiGateway
77
Resources:
8-
GoodApi:
9-
Type: AWS::ApiGatewayV2::Api
10-
GoodApiStage:
11-
Properties:
12-
AccessLogSettings:
13-
DestinationArn: gateway-logging
14-
Format: json
15-
ApiId: GoodApi
16-
StageName: GoodApiStage
17-
Type: AWS::ApiGatewayV2::Stage
8+
GoodApi:
9+
Type: AWS::ApiGatewayV2::Api
10+
GoodApiStage:
11+
Properties:
12+
AccessLogSettings:
13+
DestinationArn: gateway-logging
14+
Format: json
15+
ApiId: GoodApi
16+
StageName: GoodApiStage
17+
Type: AWS::ApiGatewayV2::Stage
18+
1819
```
1920

2021

avd_docs/aws/athena/AVD-AWS-0006/CloudFormation.md

+9-8
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@ Enable encryption at rest for Athena databases and workgroup configurations
33

44
```yaml
55
Resources:
6-
GoodExample:
7-
Properties:
8-
Name: goodExample
9-
WorkGroupConfiguration:
10-
ResultConfiguration:
11-
EncryptionConfiguration:
12-
EncryptionOption: SSE_KMS
13-
Type: AWS::Athena::WorkGroup
6+
GoodExample:
7+
Properties:
8+
Name: goodExample
9+
WorkGroupConfiguration:
10+
ResultConfiguration:
11+
EncryptionConfiguration:
12+
EncryptionOption: SSE_KMS
13+
Type: AWS::Athena::WorkGroup
14+
1415
```
1516

1617

avd_docs/aws/athena/AVD-AWS-0007/CloudFormation.md

+10-9
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,16 @@ Enforce the configuration to prevent client overrides
33

44
```yaml
55
Resources:
6-
GoodExample:
7-
Properties:
8-
Name: goodExample
9-
WorkGroupConfiguration:
10-
EnforceWorkGroupConfiguration: true
11-
ResultConfiguration:
12-
EncryptionConfiguration:
13-
EncryptionOption: SSE_KMS
14-
Type: AWS::Athena::WorkGroup
6+
GoodExample:
7+
Properties:
8+
Name: goodExample
9+
WorkGroupConfiguration:
10+
EnforceWorkGroupConfiguration: true
11+
ResultConfiguration:
12+
EncryptionConfiguration:
13+
EncryptionOption: SSE_KMS
14+
Type: AWS::Athena::WorkGroup
15+
1516
```
1617

1718

avd_docs/aws/cloudfront/AVD-AWS-0010/CloudFormation.md

+14-13
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,20 @@ Enable logging for CloudFront distributions
33

44
```yaml
55
Resources:
6-
GoodExample:
7-
Properties:
8-
DistributionConfig:
9-
DefaultCacheBehavior:
10-
TargetOriginId: target
11-
ViewerProtocolPolicy: https-only
12-
Enabled: true
13-
Logging:
14-
Bucket: logging-bucket
15-
Origins:
16-
- DomainName: https://some.domain
17-
Id: somedomain1
18-
Type: AWS::CloudFront::Distribution
6+
GoodExample:
7+
Properties:
8+
DistributionConfig:
9+
DefaultCacheBehavior:
10+
TargetOriginId: target
11+
ViewerProtocolPolicy: https-only
12+
Enabled: true
13+
Logging:
14+
Bucket: logging-bucket
15+
Origins:
16+
- DomainName: https://some.domain
17+
Id: somedomain1
18+
Type: AWS::CloudFront::Distribution
19+
1920
```
2021

2122

avd_docs/aws/cloudfront/AVD-AWS-0011/CloudFormation.md

+15-14
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,21 @@ Enable WAF for the CloudFront distribution
33

44
```yaml
55
Resources:
6-
GoodExample:
7-
Properties:
8-
DistributionConfig:
9-
DefaultCacheBehavior:
10-
TargetOriginId: target
11-
ViewerProtocolPolicy: https-only
12-
Enabled: true
13-
Logging:
14-
Bucket: logging-bucket
15-
Origins:
16-
- DomainName: https://some.domain
17-
Id: somedomain1
18-
WebACLId: waf_id
19-
Type: AWS::CloudFront::Distribution
6+
GoodExample:
7+
Properties:
8+
DistributionConfig:
9+
DefaultCacheBehavior:
10+
TargetOriginId: target
11+
ViewerProtocolPolicy: https-only
12+
Enabled: true
13+
Logging:
14+
Bucket: logging-bucket
15+
Origins:
16+
- DomainName: https://some.domain
17+
Id: somedomain1
18+
WebACLId: waf_id
19+
Type: AWS::CloudFront::Distribution
20+
2021
```
2122

2223

avd_docs/aws/cloudfront/AVD-AWS-0012/CloudFormation.md

+15-14
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,21 @@ Only allow HTTPS for CloudFront distribution communication
33

44
```yaml
55
Resources:
6-
GoodExample:
7-
Properties:
8-
DistributionConfig:
9-
DefaultCacheBehavior:
10-
TargetOriginId: target
11-
ViewerProtocolPolicy: https-only
12-
Enabled: true
13-
Logging:
14-
Bucket: logging-bucket
15-
Origins:
16-
- DomainName: https://some.domain
17-
Id: somedomain1
18-
WebACLId: waf_id
19-
Type: AWS::CloudFront::Distribution
6+
GoodExample:
7+
Properties:
8+
DistributionConfig:
9+
DefaultCacheBehavior:
10+
TargetOriginId: target
11+
ViewerProtocolPolicy: https-only
12+
Enabled: true
13+
Logging:
14+
Bucket: logging-bucket
15+
Origins:
16+
- DomainName: https://some.domain
17+
Id: somedomain1
18+
WebACLId: waf_id
19+
Type: AWS::CloudFront::Distribution
20+
2021
```
2122

2223

avd_docs/aws/cloudfront/AVD-AWS-0013/CloudFormation.md

+16-15
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,22 @@ Use the most modern TLS/SSL policies available
33

44
```yaml
55
Resources:
6-
GoodExample:
7-
Properties:
8-
DistributionConfig:
9-
DefaultCacheBehavior:
10-
TargetOriginId: target
11-
ViewerProtocolPolicy: https-only
12-
Enabled: true
13-
Logging:
14-
Bucket: logging-bucket
15-
Origins:
16-
- DomainName: https://some.domain
17-
Id: somedomain1
18-
ViewerCertificate:
19-
MinimumProtocolVersion: TLSv1.2_2021
20-
Type: AWS::CloudFront::Distribution
6+
GoodExample:
7+
Properties:
8+
DistributionConfig:
9+
DefaultCacheBehavior:
10+
TargetOriginId: target
11+
ViewerProtocolPolicy: https-only
12+
Enabled: true
13+
Logging:
14+
Bucket: logging-bucket
15+
Origins:
16+
- DomainName: https://some.domain
17+
Id: somedomain1
18+
ViewerCertificate:
19+
MinimumProtocolVersion: TLSv1.2_2021
20+
Type: AWS::CloudFront::Distribution
21+
2122
```
2223

2324

avd_docs/aws/cloudtrail/AVD-AWS-0014/CloudFormation.md

+9-8
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@ Enable Cloudtrail in all regions
33

44
```yaml
55
Resources:
6-
GoodExample:
7-
Properties:
8-
IsLogging: true
9-
IsMultiRegionTrail: true
10-
S3BucketName: CloudtrailBucket
11-
S3KeyPrefix: /trailing
12-
TrailName: Cloudtrail
13-
Type: AWS::CloudTrail::Trail
6+
GoodExample:
7+
Properties:
8+
IsLogging: true
9+
IsMultiRegionTrail: true
10+
S3BucketName: CloudtrailBucket
11+
S3KeyPrefix: /trailing
12+
TrailName: Cloudtrail
13+
Type: AWS::CloudTrail::Trail
14+
1415
```
1516

1617

avd_docs/aws/cloudtrail/AVD-AWS-0015/CloudFormation.md

+10-9
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,16 @@ Use Customer managed key
33

44
```yaml
55
Resources:
6-
GoodExample:
7-
Properties:
8-
IsLogging: true
9-
IsMultiRegionTrail: true
10-
KmsKeyId: alias/CloudtrailKey
11-
S3BucketName: CloudtrailBucket
12-
S3KeyPrefix: /trailing
13-
TrailName: Cloudtrail
14-
Type: AWS::CloudTrail::Trail
6+
GoodExample:
7+
Properties:
8+
IsLogging: true
9+
IsMultiRegionTrail: true
10+
KmsKeyId: alias/CloudtrailKey
11+
S3BucketName: CloudtrailBucket
12+
S3KeyPrefix: /trailing
13+
TrailName: Cloudtrail
14+
Type: AWS::CloudTrail::Trail
15+
1516
```
1617

1718
#### Remediation Links

avd_docs/aws/cloudtrail/AVD-AWS-0016/CloudFormation.md

+10-9
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,16 @@ Turn on log validation for Cloudtrail
33

44
```yaml
55
Resources:
6-
GoodExample:
7-
Properties:
8-
EnableLogFileValidation: true
9-
IsLogging: true
10-
IsMultiRegionTrail: true
11-
S3BucketName: CloudtrailBucket
12-
S3KeyPrefix: /trailing
13-
TrailName: Cloudtrail
14-
Type: AWS::CloudTrail::Trail
6+
GoodExample:
7+
Properties:
8+
EnableLogFileValidation: true
9+
IsLogging: true
10+
IsMultiRegionTrail: true
11+
S3BucketName: CloudtrailBucket
12+
S3KeyPrefix: /trailing
13+
TrailName: Cloudtrail
14+
Type: AWS::CloudTrail::Trail
15+
1516
```
1617

1718

avd_docs/aws/cloudtrail/AVD-AWS-0161/CloudFormation.md

+12-11
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,18 @@ Restrict public access to the S3 bucket
33

44
```yaml
55
Resources:
6-
GoodExampleBucket:
7-
Properties:
8-
AccessControl: Private
9-
BucketName: my-bucket
10-
Type: AWS::S3::Bucket
11-
GoodExampleTrail:
12-
Properties:
13-
IsLogging: true
14-
S3BucketName: my-bucket
15-
TrailName: Cloudtrail
16-
Type: AWS::CloudTrail::Trail
6+
GoodExampleBucket:
7+
Properties:
8+
AccessControl: Private
9+
BucketName: my-bucket
10+
Type: AWS::S3::Bucket
11+
GoodExampleTrail:
12+
Properties:
13+
IsLogging: true
14+
S3BucketName: my-bucket
15+
TrailName: Cloudtrail
16+
Type: AWS::CloudTrail::Trail
17+
1718
```
1819

1920

avd_docs/aws/cloudtrail/AVD-AWS-0162/CloudFormation.md

+6-5
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@ Enable logging to CloudWatch
33

44
```yaml
55
Resources:
6-
GoodExampleTrail:
7-
Properties:
8-
CloudWatchLogsLogGroupArn: arn:aws:logs:us-east-1:123456789012:log-group:CloudTrail/DefaultLogGroup:*
9-
TrailName: Cloudtrail
10-
Type: AWS::CloudTrail::Trail
6+
GoodExampleTrail:
7+
Properties:
8+
CloudWatchLogsLogGroupArn: arn:aws:logs:us-east-1:123456789012:log-group:CloudTrail/DefaultLogGroup:*
9+
TrailName: Cloudtrail
10+
Type: AWS::CloudTrail::Trail
11+
1112
```
1213

1314

0 commit comments

Comments
 (0)