Skip to content

Commit 6a27fff

Browse files
authored
feat: Allow CloudWatch Log Encryption and Default Security Group Management (#246)
1 parent ffc7965 commit 6a27fff

File tree

3 files changed

+33
-0
lines changed

3 files changed

+33
-0
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,7 @@ allow_github_webhooks = true
322322
| <a name="input_certificate_arn"></a> [certificate\_arn](#input\_certificate\_arn) | ARN of certificate issued by AWS ACM. If empty, a new ACM certificate will be created and validated using Route53 DNS | `string` | `""` | no |
323323
| <a name="input_cidr"></a> [cidr](#input\_cidr) | The CIDR block for the VPC which will be created if `vpc_id` is not specified | `string` | `""` | no |
324324
| <a name="input_cloudwatch_log_retention_in_days"></a> [cloudwatch\_log\_retention\_in\_days](#input\_cloudwatch\_log\_retention\_in\_days) | Retention period of Atlantis CloudWatch logs | `number` | `7` | no |
325+
| <a name="input_cloudwatch_logs_kms_key_id"></a> [cloudwatch\_logs\_kms\_key\_id](#input\_cloudwatch\_logs\_kms\_key\_id) | The ARN of the KMS Key to use when encrypting log data. | `string` | `null` | no |
325326
| <a name="input_command"></a> [command](#input\_command) | The command that is passed to the container | `list(string)` | `null` | no |
326327
| <a name="input_container_cpu"></a> [container\_cpu](#input\_container\_cpu) | The number of cpu units used by the atlantis container. If not specified ecs\_task\_cpu will be used | `number` | `null` | no |
327328
| <a name="input_container_depends_on"></a> [container\_depends\_on](#input\_container\_depends\_on) | The dependencies defined for container startup and shutdown. A container can contain multiple dependencies. When a dependency is defined for container startup, for container shutdown it is reversed. The condition can be one of START, COMPLETE, SUCCESS or HEALTHY | <pre>list(object({<br> containerName = string<br> condition = string<br> }))</pre> | `null` | no |
@@ -331,6 +332,8 @@ allow_github_webhooks = true
331332
| <a name="input_custom_container_definitions"></a> [custom\_container\_definitions](#input\_custom\_container\_definitions) | A list of valid container definitions provided as a single valid JSON document. By default, the standard container definition is used. | `string` | `""` | no |
332333
| <a name="input_custom_environment_secrets"></a> [custom\_environment\_secrets](#input\_custom\_environment\_secrets) | List of additional secrets the container will use (list should contain maps with `name` and `valueFrom`) | <pre>list(object(<br> {<br> name = string<br> valueFrom = string<br> }<br> ))</pre> | `[]` | no |
333334
| <a name="input_custom_environment_variables"></a> [custom\_environment\_variables](#input\_custom\_environment\_variables) | List of additional environment variables the container will use (list should contain maps with `name` and `value`) | <pre>list(object(<br> {<br> name = string<br> value = string<br> }<br> ))</pre> | `[]` | no |
335+
| <a name="input_default_security_group_egress"></a> [default\_security\_group\_egress](#input\_default\_security\_group\_egress) | List of maps of egress rules to set on the default security group | `list(map(string))` | `[]` | no |
336+
| <a name="input_default_security_group_ingress"></a> [default\_security\_group\_ingress](#input\_default\_security\_group\_ingress) | List of maps of ingress rules to set on the default security group | `list(map(string))` | `[]` | no |
334337
| <a name="input_docker_labels"></a> [docker\_labels](#input\_docker\_labels) | The configuration options to send to the `docker_labels` | `map(string)` | `null` | no |
335338
| <a name="input_ecs_container_insights"></a> [ecs\_container\_insights](#input\_ecs\_container\_insights) | Controls if ECS Cluster has container insights enabled | `bool` | `false` | no |
336339
| <a name="input_ecs_fargate_spot"></a> [ecs\_fargate\_spot](#input\_ecs\_fargate\_spot) | Whether to run ECS Fargate Spot or not | `bool` | `false` | no |
@@ -354,6 +357,7 @@ allow_github_webhooks = true
354357
| <a name="input_firelens_configuration"></a> [firelens\_configuration](#input\_firelens\_configuration) | The FireLens configuration for the container. This is used to specify and configure a log router for container logs. For more details, see https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_FirelensConfiguration.html | <pre>object({<br> type = string<br> options = map(string)<br> })</pre> | `null` | no |
355358
| <a name="input_github_webhooks_cidr_blocks"></a> [github\_webhooks\_cidr\_blocks](#input\_github\_webhooks\_cidr\_blocks) | List of CIDR blocks used by GitHub webhooks | `list(string)` | <pre>[<br> "140.82.112.0/20",<br> "185.199.108.0/22",<br> "192.30.252.0/22",<br> "143.55.64.0/20"<br>]</pre> | no |
356359
| <a name="input_internal"></a> [internal](#input\_internal) | Whether the load balancer is internal or external | `bool` | `false` | no |
360+
| <a name="input_manage_default_security_group"></a> [manage\_default\_security\_group](#input\_manage\_default\_security\_group) | Should be true to adopt and manage default security group | `bool` | `false` | no |
357361
| <a name="input_mount_points"></a> [mount\_points](#input\_mount\_points) | Container mount points. This is a list of maps, where each map should contain a `containerPath` and `sourceVolume`. The `readOnly` key is optional. | `list(any)` | `[]` | no |
358362
| <a name="input_name"></a> [name](#input\_name) | Name to use on all resources created (VPC, ALB, etc) | `string` | `"atlantis"` | no |
359363
| <a name="input_permissions_boundary"></a> [permissions\_boundary](#input\_permissions\_boundary) | If provided, all IAM roles will be created with this permissions boundary attached. | `string` | `null` | no |

main.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,10 @@ module "vpc" {
192192
enable_nat_gateway = true
193193
single_nat_gateway = true
194194

195+
manage_default_security_group = var.manage_default_security_group
196+
default_security_group_ingress = var.default_security_group_ingress
197+
default_security_group_egress = var.default_security_group_egress
198+
195199
tags = local.tags
196200
}
197201

@@ -690,6 +694,7 @@ resource "aws_ecs_service" "atlantis" {
690694
resource "aws_cloudwatch_log_group" "atlantis" {
691695
name = var.name
692696
retention_in_days = var.cloudwatch_log_retention_in_days
697+
kms_key_id = var.cloudwatch_logs_kms_key_id
693698

694699
tags = local.tags
695700
}

variables.tf

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,24 @@ variable "azs" {
7171
default = []
7272
}
7373

74+
variable "manage_default_security_group" {
75+
description = "Should be true to adopt and manage default security group"
76+
type = bool
77+
default = false
78+
}
79+
80+
variable "default_security_group_ingress" {
81+
description = "List of maps of ingress rules to set on the default security group"
82+
type = list(map(string))
83+
default = []
84+
}
85+
86+
variable "default_security_group_egress" {
87+
description = "List of maps of egress rules to set on the default security group"
88+
type = list(map(string))
89+
default = []
90+
}
91+
7492
variable "public_subnets" {
7593
description = "A list of public subnets inside the VPC"
7694
type = list(string)
@@ -219,6 +237,12 @@ variable "cloudwatch_log_retention_in_days" {
219237
default = 7
220238
}
221239

240+
variable "cloudwatch_logs_kms_key_id" {
241+
description = "The ARN of the KMS Key to use when encrypting log data."
242+
type = string
243+
default = null
244+
}
245+
222246
# SSM parameters for secrets
223247
variable "webhook_ssm_parameter_name" {
224248
description = "Name of SSM parameter to keep webhook secret"

0 commit comments

Comments
 (0)