You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: support enforcing SSL and encrypted uploads for logs (#57)
Support enforcing SSL and encrypted uploads for the log bucket.
Even though they are not sensitive or critical, there are cases when
there are requirements or rules for the sake of rules, for example, SOC2
compliance.
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* New Features
* Added options to enforce SSL-only access and encrypted uploads for the
session logging bucket.
* Support referencing VPC and subnets by name; subnet_ids and vpc_id are
now optional.
* Documentation
* Updated Providers table and Resources to reflect new data sources.
* Documented new and modified inputs.
* Chores
* Upgraded logs bucket module to version 4.10.0.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
|[aws_ami.amazon_linux_2023](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/ami)| data source |
124
126
|[aws_ami.instance](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/ami)| data source |
125
127
|[aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity)| data source |
126
128
|[aws_iam_policy_document.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document)| data source |
127
129
|[aws_iam_policy_document.session_logging](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document)| data source |
128
130
|[aws_region.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/region)| data source |
129
-
|[aws_s3_bucket.logs_bucket](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/s3_bucket)| data source |
131
+
|[aws_subnet.selected](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/subnet)| data source |
132
+
|[aws_vpc.selected](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/vpc)| data source |
130
133
131
134
## Inputs
132
135
@@ -135,6 +138,8 @@ Use [the awesome `gossm` project](https://github.com/gjbae1212/gossm).
135
138
| <aname="input_additional_security_group_ids"></a> [additional\_security\_group\_ids](#input\_additional\_security\_group\_ids)| Security groups that will be attached to the app instances |`list(string)`|`[]`| no |
136
139
| <aname="input_additional_security_group_rules"></a> [additional\_security\_group\_rules](#input\_additional\_security\_group\_rules)| Additional security group rules that will be attached to the primary security group | <pre>map(object({<br/> type = string<br/> from_port = number<br/> to_port = number<br/> protocol = string<br/><br/> description = optional(string)<br/> cidr_blocks = optional(list(string))<br/> ipv6_cidr_blocks = optional(list(string))<br/> prefix_list_ids = optional(list(string))<br/> self = optional(bool)<br/> }))</pre> |`{}`| no |
137
140
| <aname="input_additional_tag_map"></a> [additional\_tag\_map](#input\_additional\_tag\_map)| Additional key-value pairs to add to each map in `tags_as_list_of_maps`. Not added to `tags` or `id`.<br/>This is for some rare cases where resources want additional configuration of tags<br/>and therefore take a list of maps with tag key, value, and additional configuration. |`map(string)`|`{}`| no |
141
+
| <aname="input_allow_encrypted_uploads_only"></a> [allow\_encrypted\_uploads\_only](#input\_allow\_encrypted\_uploads\_only)| Whether or not to allow encrypted uploads only. If set to `true` this will create a bucket policy that `Deny` if encryption header is missing in the requests. |`bool`|`false`| no |
142
+
| <aname="input_allow_ssl_requests_only"></a> [allow\_ssl\_requests\_only](#input\_allow\_ssl\_requests\_only)| Whether or not to allow SSL requests only. If set to `true` this will create a bucket policy that `Deny` if SSL is not used in the requests using the `aws:SecureTransport` condition. |`bool`|`false`| no |
138
143
| <aname="input_ami"></a> [ami](#input\_ami)| The AMI to use for the SSM Agent EC2 Instance. If not provided, the latest Amazon Linux 2023 AMI will be used. Note: This will update periodically as AWS releases updates to their AL2023 AMI. Pin to a specific AMI if you would like to avoid these updates. |`string`|`""`| no |
139
144
| <aname="input_architecture"></a> [architecture](#input\_architecture)| The architecture of the AMI (e.g., x86\_64, arm64) |`string`|`"arm64"`| no |
140
145
| <aname="input_associate_public_ip_address"></a> [associate\_public\_ip\_address](#input\_associate\_public\_ip\_address)| Associate public IP address |`bool`|`null`| no |
@@ -176,12 +181,14 @@ Use [the awesome `gossm` project](https://github.com/gjbae1212/gossm).
176
181
| <aname="input_session_logging_kms_key_arn"></a> [session\_logging\_kms\_key\_arn](#input\_session\_logging\_kms\_key\_arn)| BYO KMS Key instead of using the created KMS Key. The session\_logging\_encryption\_enabled variable must still be `true` for this to be applied. |`string`|`""`| no |
177
182
| <aname="input_session_logging_ssm_document_name"></a> [session\_logging\_ssm\_document\_name](#input\_session\_logging\_ssm\_document\_name)| Name for `session_logging` SSM document. This is only applied if 2 conditions are met: (1) `session_logging_enabled` = true, (2) `create_run_shell_document` = true. |`string`|`"SSM-SessionManagerRunShell"`| no |
178
183
| <aname="input_stage"></a> [stage](#input\_stage)| ID element. Usually used to indicate role, e.g. 'prod', 'staging', 'source', 'build', 'test', 'deploy', 'release' |`string`|`null`| no |
179
-
| <aname="input_subnet_ids"></a> [subnet\_ids](#input\_subnet\_ids)| The Subnet IDs which the SSM Agent will run in. These *should* be private subnets. |`list(string)`| n/a | yes |
184
+
| <aname="input_subnet_ids"></a> [subnet\_ids](#input\_subnet\_ids)| The Subnet IDs which the SSM Agent will run in. These *should* be private subnets. |`list(string)`|`[]`| no |
185
+
| <aname="input_subnet_names"></a> [subnet\_names](#input\_subnet\_names)| The Subnet names which the SSM Agent will run in. If provided, subnet\_ids will be ignored. These *should* be private subnets. |`list(string)`|`[]`| no |
180
186
| <aname="input_tags"></a> [tags](#input\_tags)| Additional tags (e.g. `{'BusinessUnit': 'XYZ'}`).<br/>Neither the tag keys nor the tag values will be modified by this module. |`map(string)`|`{}`| no |
181
187
| <aname="input_tenant"></a> [tenant](#input\_tenant)| ID element \_(Rarely used, not included by default)\_. A customer identifier, indicating who this instance of a resource is for |`string`|`null`| no |
182
188
| <aname="input_user_data"></a> [user\_data](#input\_user\_data)| The user\_data to use for the SSM Agent EC2 instance. You can use this to automate installation of psql or other required command line tools. |`string`|`"#!/bin/bash\n# NOTE: Since we're using a latest Amazon Linux AMI, we shouldn't need this,\n# but we'll update it to be sure.\ncd /tmp\nsudo yum install -y https://s3.amazonaws.com/ec2-downloads-windows/SSMAgent/latest/linux_amd64/amazon-ssm-agent.rpmnsudo systemctl enable amazon-ssm-agent\nsudo systemctl start amazon-ssm-agent\n"`| no |
183
189
| <aname="input_volume_size"></a> [volume\_size](#input\_volume\_size)| The size of the volume in gigabytes. |`number`|`null`| no |
184
-
| <aname="input_vpc_id"></a> [vpc\_id](#input\_vpc\_id)| The ID of the VPC which the EC2 Instance will run in. |`string`| n/a | yes |
190
+
| <aname="input_vpc_id"></a> [vpc\_id](#input\_vpc\_id)| The ID of the VPC which the EC2 Instance will run in. |`string`|`null`| no |
191
+
| <aname="input_vpc_name"></a> [vpc\_name](#input\_vpc\_name)| The name of the VPC which the EC2 Instance will run in. If provided, vpc\_id will be ignored. |`string`|`null`| no |
description="Alias name for `session_logging` KMS Key. This is only applied if 2 conditions are met: (1) `session_logging_kms_key_arn` is unset, (2) `session_logging_encryption_enabled` = true."
description="Whether or not to allow SSL requests only. If set to `true` this will create a bucket policy that `Deny` if SSL is not used in the requests using the `aws:SecureTransport` condition."
187
+
type=bool
188
+
default=false
189
+
}
190
+
191
+
variable"allow_encrypted_uploads_only" {
192
+
description="Whether or not to allow encrypted uploads only. If set to `true` this will create a bucket policy that `Deny` if encryption header is missing in the requests."
0 commit comments