Skip to content

Commit f968498

Browse files
authored
Merge pull request #38 from DNXLabs/feature/ebs-efs-kms-key
Add efs and ebs kms key variables
2 parents 528ded0 + caceef4 commit f968498

File tree

5 files changed

+16
-5
lines changed

5 files changed

+16
-5
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,9 @@ module "ecs_apps" {
9494
| certificate\_internal\_arn | certificate arn for internal ALB. | `string` | `""` | no |
9595
| create\_efs | Enables creation of EFS volume for cluster | `bool` | `true` | no |
9696
| create\_iam\_service\_linked\_role | Create iam\_service\_linked\_role for ECS or not. | `bool` | `false` | no |
97+
| ebs\_key\_arn | ARN of a KMS Key to use on EBS volumes | `string` | `""` | no |
9798
| ec2\_key\_enabled | Generate a SSH private key and include in launch template of ECS nodes | `bool` | `false` | no |
99+
| efs\_key\_arn | ARN of a KMS Key to use on EFS volumes | `string` | `""` | no |
98100
| efs\_lifecycle\_transition\_to\_ia | Option to enable EFS Lifecycle Transaction to IA | `string` | `""` | no |
99101
| efs\_lifecycle\_transition\_to\_primary\_storage\_class | Option to enable EFS Lifecycle Transaction to Primary Storage Class | `bool` | `false` | no |
100102
| enable\_schedule | Enables schedule to shut down and start up instances outside business hours. | `bool` | `false` | no |
@@ -103,7 +105,6 @@ module "ecs_apps" {
103105
| instance\_types | Instance type for ECS workers | `list(any)` | `[]` | no |
104106
| instance\_volume\_size | Volume size for docker volume (in GB). | `number` | `30` | no |
105107
| instance\_volume\_size\_root | Volume size for root volume (in GB). | `number` | `16` | no |
106-
| kms\_key\_arn | ARN of a KMS Key to use on EFS and EBS volumes | `string` | `""` | no |
107108
| lb\_access\_logs\_bucket | Bucket to store logs from lb access. | `string` | `""` | no |
108109
| lb\_access\_logs\_prefix | Bucket prefix to store lb access logs. | `string` | `""` | no |
109110
| name | Name of this ECS cluster. | `any` | n/a | yes |

_data.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ data "aws_kms_key" "ebs" {
3232
key_id = "alias/aws/ebs"
3333
}
3434

35+
data "aws_kms_key" "efs" {
36+
key_id = "alias/aws/elasticfilesystem"
37+
}
38+
3539
data "aws_ec2_managed_prefix_list" "s3" {
3640
name = "com.amazonaws.${data.aws_region.current.name}.s3"
3741
}

_variables.tf

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,9 +267,15 @@ variable "alarm_prefix" {
267267
default = "alarm"
268268
}
269269

270-
variable "kms_key_arn" {
270+
variable "ebs_key_arn" {
271271
type = string
272-
description = "ARN of a KMS Key to use on EFS and EBS volumes"
272+
description = "ARN of a KMS Key to use on EBS volumes"
273+
default = ""
274+
}
275+
276+
variable "efs_key_arn" {
277+
type = string
278+
description = "ARN of a KMS Key to use on EFS volumes"
273279
default = ""
274280
}
275281

ec2-launch-template.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ resource "aws_launch_template" "ecs" {
2525
ebs {
2626
volume_size = var.instance_volume_size
2727
encrypted = true
28-
kms_key_id = var.kms_key_arn != "" ? var.kms_key_arn : null
28+
kms_key_id = var.ebs_key_arn != "" ? var.ebs_key_arn : null
2929
}
3030
}
3131

efs.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ resource "aws_efs_file_system" "ecs" {
22
count = var.create_efs ? 1 : 0
33
creation_token = "ecs-${var.name}"
44
encrypted = true
5-
kms_key_id = var.kms_key_arn != "" ? var.kms_key_arn : null
5+
kms_key_id = var.efs_key_arn != "" ? var.efs_key_arn : null
66

77
throughput_mode = var.throughput_mode
88
provisioned_throughput_in_mibps = var.provisioned_throughput_in_mibps

0 commit comments

Comments
 (0)