Skip to content

Commit

Permalink
docs: doing some clever stuff with docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Owen Rumney committed Sep 7, 2022
1 parent 0adff86 commit 378209f
Show file tree
Hide file tree
Showing 386 changed files with 5,567 additions and 3,438 deletions.
10 changes: 6 additions & 4 deletions avd_docs/aws/apigateway/AVD-AWS-0001/CloudFormation.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@

Enable logging for API Gateway stages

```yaml
---
AWSTemplateFormatVersion: "2010-09-09"
Description: A sample template
```yaml---
AWSTemplateFormatVersion: 2010-09-09
Description: Good Example of ApiGateway
Resources:
GoodApi:
Type: AWS::ApiGatewayV2::Api
Expand All @@ -16,4 +15,7 @@ Resources:
Format: json
ApiId: !Ref GoodApi
StageName: GoodApiStage
```


43 changes: 22 additions & 21 deletions avd_docs/aws/apigateway/AVD-AWS-0001/Terraform.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,29 @@
Enable logging for API Gateway stages

```hcl
resource "aws_apigatewayv2_stage" "good_example" {
api_id = aws_apigatewayv2_api.example.id
name = "example-stage"
access_log_settings {
destination_arn = ""
format = ""
}
}
resource "aws_api_gateway_stage" "good_example" {
deployment_id = aws_api_gateway_deployment.example.id
rest_api_id = aws_api_gateway_rest_api.example.id
stage_name = "example"
access_log_settings {
destination_arn = ""
format = ""
}
}
resource "aws_apigatewayv2_stage" "good_example" {
api_id = aws_apigatewayv2_api.example.id
name = "example-stage"
access_log_settings {
destination_arn = "arn:aws:logs:region:0123456789:log-group:access_logging"
format = "json"
}
}
resource "aws_api_gateway_stage" "good_example" {
deployment_id = aws_api_gateway_deployment.example.id
rest_api_id = aws_api_gateway_rest_api.example.id
stage_name = "example"
access_log_settings {
destination_arn = "arn:aws:logs:region:0123456789:log-group:access_logging"
format = "json"
}
}
```

#### Remediation Links
- https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/apigatewayv2_stage#access_log_settings

38 changes: 20 additions & 18 deletions avd_docs/aws/apigateway/AVD-AWS-0002/Terraform.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,29 @@
Enable cache encryption

```hcl
resource "aws_api_gateway_rest_api" "example" {
}
resource "aws_api_gateway_rest_api" "example" {
}
resource "aws_api_gateway_stage" "example" {
}
resource "aws_api_gateway_stage" "example" {
resource "aws_api_gateway_method_settings" "good_example" {
rest_api_id = aws_api_gateway_rest_api.example.id
stage_name = aws_api_gateway_stage.example.stage_name
method_path = "path1/GET"
settings {
metrics_enabled = true
logging_level = "INFO"
cache_data_encrypted = true
}
}
}
resource "aws_api_gateway_method_settings" "good_example" {
rest_api_id = aws_api_gateway_rest_api.example.id
stage_name = aws_api_gateway_stage.example.stage_name
method_path = "path1/GET"
settings {
metrics_enabled = true
logging_level = "INFO"
caching_enabled = true
cache_data_encrypted = true
}
}
```

#### Remediation Links
- https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/api_gateway_method_settings#cache_data_encrypted

21 changes: 11 additions & 10 deletions avd_docs/aws/apigateway/AVD-AWS-0003/Terraform.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,19 @@
Enable tracing

```hcl
resource "aws_api_gateway_rest_api" "test" {
}
resource "aws_api_gateway_rest_api" "test" {
}
resource "aws_api_gateway_stage" "good_example" {
stage_name = "prod"
rest_api_id = aws_api_gateway_rest_api.test.id
deployment_id = aws_api_gateway_deployment.test.id
xray_tracing_enabled = true
}
resource "aws_api_gateway_stage" "good_example" {
stage_name = "prod"
rest_api_id = aws_api_gateway_rest_api.test.id
deployment_id = aws_api_gateway_deployment.test.id
xray_tracing_enabled = true
}
```

#### Remediation Links
- https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/api_gateway_stage#xray_tracing_enabled

62 changes: 51 additions & 11 deletions avd_docs/aws/apigateway/AVD-AWS-0004/Terraform.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,58 @@
Use and authorization method or require API Key

```hcl
resource "aws_api_gateway_rest_api" "MyDemoAPI" {
}
resource "aws_api_gateway_method" "good_example" {
rest_api_id = aws_api_gateway_rest_api.MyDemoAPI.id
resource_id = aws_api_gateway_resource.MyDemoResource.id
http_method = "GET"
authorization = "AWS_IAM"
}
resource "aws_api_gateway_rest_api" "MyDemoAPI" {
}
resource "aws_api_gateway_resource" "MyDemoResource" {
rest_api_id = aws_api_gateway_rest_api.MyDemoAPI.id
}
resource "aws_api_gateway_method" "good_example" {
rest_api_id = aws_api_gateway_rest_api.MyDemoAPI.id
resource_id = aws_api_gateway_resource.MyDemoResource.id
http_method = "GET"
authorization = "AWS_IAM"
}
```
```hcl
resource "aws_api_gateway_rest_api" "MyDemoAPI" {
}
resource "aws_api_gateway_resource" "MyDemoResource" {
rest_api_id = aws_api_gateway_rest_api.MyDemoAPI.id
}
resource "aws_api_gateway_method" "good_example" {
rest_api_id = aws_api_gateway_rest_api.MyDemoAPI.id
resource_id = aws_api_gateway_resource.MyDemoResource.id
http_method = "GET"
authorization = "NONE"
api_key_required = true
}
```
```hcl
resource "aws_api_gateway_rest_api" "MyDemoAPI" {
}
resource "aws_api_gateway_resource" "MyDemoResource" {
rest_api_id = aws_api_gateway_rest_api.MyDemoAPI.id
}
resource "aws_api_gateway_method" "good_example" {
rest_api_id = aws_api_gateway_rest_api.MyDemoAPI.id
resource_id = aws_api_gateway_resource.MyDemoResource.id
http_method = "OPTION"
authorization = "NONE"
}
```

#### Remediation Links
- https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/api_gateway_method#authorization

9 changes: 5 additions & 4 deletions avd_docs/aws/apigateway/AVD-AWS-0005/Terraform.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
Use the most modern TLS/SSL policies available

```hcl
resource "aws_api_gateway_domain_name" "good_example" {
security_policy = "TLS_1_2"
}
resource "aws_api_gateway_domain_name" "good_example" {
security_policy = "TLS_1_2"
}
```

#### Remediation Links
- https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/api_gateway_domain_name#security_policy

8 changes: 4 additions & 4 deletions avd_docs/aws/athena/AVD-AWS-0006/CloudFormation.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@

Enable encryption at rest for Athena databases and workgroup configurations

```yaml
---
AWSTemplateFormatVersion: "2010-09-09"
Description: A sample template
```yaml---
Resources:
GoodExample:
Properties:
Expand All @@ -14,4 +11,7 @@ Resources:
EncryptionConfiguration:
EncryptionOption: SSE_KMS
Type: AWS::Athena::WorkGroup
```


56 changes: 29 additions & 27 deletions avd_docs/aws/athena/AVD-AWS-0006/Terraform.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,38 @@
Enable encryption at rest for Athena databases and workgroup configurations

```hcl
resource "aws_athena_database" "good_example" {
name = "database_name"
bucket = aws_s3_bucket.hoge.bucket
encryption_configuration {
encryption_option = "SSE_KMS"
kms_key_arn = aws_kms_key.example.arn
resource "aws_athena_database" "good_example" {
name = "database_name"
bucket = aws_s3_bucket.hoge.bucket
encryption_configuration {
encryption_option = "SSE_KMS"
kms_key_arn = aws_kms_key.example.arn
}
}
resource "aws_athena_workgroup" "good_example" {
name = "example"
configuration {
enforce_workgroup_configuration = true
publish_cloudwatch_metrics_enabled = true
result_configuration {
output_location = "s3://${aws_s3_bucket.example.bucket}/output/"
encryption_configuration {
encryption_option = "SSE_KMS"
kms_key_arn = aws_kms_key.example.arn
}
}
}
}
}
resource "aws_athena_workgroup" "good_example" {
name = "example"
configuration {
enforce_workgroup_configuration = true
publish_cloudwatch_metrics_enabled = true
result_configuration {
output_location = "s3://${aws_s3_bucket.example.bucket}/output/"
encryption_configuration {
encryption_option = "SSE_KMS"
kms_key_arn = aws_kms_key.example.arn
}
}
}
}
```

#### Remediation Links
- https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/athena_workgroup#encryption_configuration

- https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/athena_database#encryption_configuration

8 changes: 4 additions & 4 deletions avd_docs/aws/athena/AVD-AWS-0007/CloudFormation.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@

Enforce the configuration to prevent client overrides

```yaml
---
AWSTemplateFormatVersion: "2010-09-09"
Description: A sample template
```yaml---
Resources:
GoodExample:
Properties:
Expand All @@ -15,4 +12,7 @@ Resources:
EncryptionConfiguration:
EncryptionOption: SSE_KMS
Type: AWS::Athena::WorkGroup
```


37 changes: 19 additions & 18 deletions avd_docs/aws/athena/AVD-AWS-0007/Terraform.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,26 @@
Enforce the configuration to prevent client overrides

```hcl
resource "aws_athena_workgroup" "good_example" {
name = "example"
configuration {
enforce_workgroup_configuration = true
publish_cloudwatch_metrics_enabled = true
result_configuration {
output_location = "s3://${aws_s3_bucket.example.bucket}/output/"
encryption_configuration {
encryption_option = "SSE_KMS"
kms_key_arn = aws_kms_key.example.arn
}
}
}
}
resource "aws_athena_workgroup" "good_example" {
name = "example"
configuration {
enforce_workgroup_configuration = true
publish_cloudwatch_metrics_enabled = true
result_configuration {
output_location = "s3://${aws_s3_bucket.example.bucket}/output/"
encryption_configuration {
encryption_option = "SSE_KMS"
kms_key_arn = aws_kms_key.example.arn
}
}
}
}
```

#### Remediation Links
- https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/athena_workgroup#configuration

Loading

0 comments on commit 378209f

Please sign in to comment.