Skip to content

Commit 55c907f

Browse files
authored
Merge pull request #230 from spavuluri/encryption-support
Adding EBS encryption options
2 parents dcbb64f + 3fc3c91 commit 55c907f

25 files changed

Lines changed: 265 additions & 6 deletions

.bumpversion.cfg

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 2.0.3
2+
current_version = 2.1.0
33
commit = True
44
message = Bumps version to {new_version}
55
tag = False
@@ -20,3 +20,4 @@ replace = Version: {new_version}
2020
[bumpversion:file:modules/win-instance/watchmaker-win-instance.template.cfn.yaml]
2121
search = Version: {current_version}
2222
replace = Version: {new_version}
23+

modules/lx-autoscale/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ with an AWS CloudFormation template to deploy a Watchmaker Linux AutoScaling Gro
1313
| AppScriptShell | \(Optional\) Shell with which to execute the application script. Ignored if AppScriptUrl is blank | string | `"bash"` | no |
1414
| AppScriptUrl | \(Optional\) S3 URL to the application script in an S3 bucket \(s3://\). Leave blank to launch without an application script. If specified, an appropriate InstanceRole is required | string | `"null"` | no |
1515
| AppVolumeDevice | \(Optional\) Decision whether to mount an extra EBS volume. Leave as default \("false"\) to launch without an extra application volume | bool | `"false"` | no |
16+
| AppVolumeEncrypted | (Optional) Controls whether the EBS volume will be encrypted. | `bool` | `false` | no |
1617
| AppVolumeMountPath | \(Optional\) Filesystem path to mount the extra app volume. Ignored if AppVolumeDevice is false | string | `"/opt/data"` | no |
1718
| AppVolumeSize | \(Optional\) Size in GB of the EBS volume to create. Ignored if AppVolumeDevice is false | string | `"1"` | no |
1819
| AppVolumeSnapshotId | \(Optional\) EBS Snapshot ID from which to create the AppVolume. "AppVolumeSize" must be equal or greater than the size of the snapshot. Ignored if "AppVolumeDevice" is false | string | `"null"` | no |
@@ -46,6 +47,7 @@ with an AWS CloudFormation template to deploy a Watchmaker Linux AutoScaling Gro
4647
| PolicyBody | \(Optional\) String containing the stack policy body. Conflicts with PolicyUrl | string | `"null"` | no |
4748
| PolicyUrl | \(Optional\) URL to a file containing the stack policy. Conflicts with PolicyBody | string | `"null"` | no |
4849
| PypiIndexUrl | \(Optional\) URL to the PyPi Index | string | `"https://pypi.org/simple"` | no |
50+
| RootVolumeEncrypted | (Optional) Controls whether the root volume will be encrypted. | `bool` | `false` | no |
4951
| RootVolumeSize | \(Optional\) Root Volume Size in GB \*\*NOTE\*\* This value can be set larger than the default \(20GB\) but NOT smaller. If set larger than default value partition will need to be expanded manually. | string | `"20"` | no |
5052
| ScaleDownSchedule | \(Optional\) Scheduled Action in cron-format \(UTC\) to scale down to MinCapacity; ignored if empty or ScaleUpSchedule is unset \(E.g. "0 0 \* \* \*"\) | string | `"null"` | no |
5153
| ScaleUpSchedule | \(Optional\) Scheduled Action in cron-format \(UTC\) to scale up to MaxCapacity; ignored if empty or ScaleDownSchedule is unset \(E.g. "0 10 \* \* Mon-Fri"\) | string | `"null"` | no |
@@ -70,4 +72,3 @@ with an AWS CloudFormation template to deploy a Watchmaker Linux AutoScaling Gro
7072
| Name | Description |
7173
|------|-------------|
7274
| watchmaker-lx-autoscale | CloudFormation stack object for watchmaker-lx-autoscale |
73-

modules/lx-autoscale/main.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ resource "aws_cloudformation_stack" "watchmaker-lx-autoscale" {
2323
AppScriptUrl = var.AppScriptUrl
2424
AppVolumeDevice = var.AppVolumeDevice
2525
AppVolumeMountPath = var.AppVolumeMountPath
26+
AppVolumeEncrypted = var.AppVolumeEncrypted
2627
AppVolumeSize = var.AppVolumeSize
2728
AppVolumeSnapshotId = var.AppVolumeSnapshotId
2829
AppVolumeType = var.AppVolumeType
@@ -48,6 +49,7 @@ resource "aws_cloudformation_stack" "watchmaker-lx-autoscale" {
4849
NoUpdates = var.NoUpdates
4950
PatchGroup = var.PatchGroup
5051
PypiIndexUrl = var.PypiIndexUrl
52+
RootVolumeEncrypted = var.RootVolumeEncrypted
5153
RootVolumeSize = var.RootVolumeSize
5254
ScaleDownSchedule = var.ScaleDownSchedule
5355
ScaleUpSchedule = var.ScaleUpSchedule

modules/lx-autoscale/variables.tf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ variable "PolicyUrl" {
5555
default = null
5656
}
5757

58+
variable "RootVolumeEncrypted" {
59+
type = bool
60+
description = "(Optional) Controls whether the root volume will be encrypted"
61+
default = false
62+
}
63+
5864
variable "RootVolumeSize" {
5965
type = string
6066
description = "(Optional) Root Volume Size in GB **NOTE** This value can be set larger than the default (20GB) but NOT smaller. If set larger than default value partition will need to be expanded manually."
@@ -107,6 +113,12 @@ variable "AppVolumeDevice" {
107113
default = false
108114
}
109115

116+
variable "AppVolumeEncrypted" {
117+
type = bool
118+
description = "(Optional) Controls whether the EBS volume will be encrypted"
119+
default = false
120+
}
121+
110122
variable "AppVolumeMountPath" {
111123
type = string
112124
description = "(Optional) Filesystem path to mount the extra app volume. Ignored if AppVolumeDevice is false"

modules/lx-autoscale/watchmaker-lx-autoscale.params.cfn.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
ParameterValue: __APPSCRIPTURL__
1111
- ParameterKey: AppVolumeDevice
1212
ParameterValue: __APPVOLUMEDEVICE__
13+
- ParameterKey: AppVolumeEncrypted
14+
ParameterValue: __APPVOLUMEENCRYPTED__
1315
- ParameterKey: AppVolumeMountPath
1416
ParameterValue: __APPVOLUMEMOUNTPATH__
1517
- ParameterKey: AppVolumeSize
@@ -58,6 +60,8 @@
5860
ParameterValue: __PATCHGROUP__
5961
- ParameterKey: PypiIndexUrl
6062
ParameterValue: __PYPIINDEXURL__
63+
- ParameterKey: RootVolumeEncrypted
64+
ParameterValue: __ROOTVOLUMEENCRYPTED__
6165
- ParameterKey: RootVolumeSize
6266
ParameterValue: __ROOTVOLUMESIZE__
6367
- ParameterKey: SecurityGroupIds

modules/lx-autoscale/watchmaker-lx-autoscale.template.cfn.yaml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ Metadata:
144144
- NoReboot
145145
- NoUpdates
146146
- PatchGroup
147+
- RootVolumeEncrypted
147148
- RootVolumeSize
148149
- SecurityGroupIds
149150
- Label:
@@ -168,6 +169,7 @@ Metadata:
168169
default: EC2 Application EBS Volume
169170
Parameters:
170171
- AppVolumeDevice
172+
- AppVolumeEncrypted
171173
- AppVolumeMountPath
172174
- AppVolumeSize
173175
- AppVolumeSnapshotId
@@ -205,7 +207,7 @@ Metadata:
205207
default: Force Cfn Init Update
206208
ToggleNewInstances:
207209
default: Force New Instances
208-
Version: 2.0.3
210+
Version: 2.1.0
209211
Outputs:
210212
ScaleDownScheduledAction:
211213
Condition: UseScheduledAction
@@ -268,6 +270,14 @@ Parameters:
268270
Decision whether to mount an extra EBS volume. Leave as default ("false")
269271
to launch without an extra application volume
270272
Type: String
273+
AppVolumeEncrypted:
274+
AllowedValues:
275+
- 'false'
276+
- 'true'
277+
Default: 'false'
278+
Description: >-
279+
Controls whether to encrypt the EBS volume.
280+
Type: String
271281
AppVolumeMountPath:
272282
AllowedPattern: /.*
273283
Default: /opt/data
@@ -441,6 +451,14 @@ Parameters:
441451
Default: 'https://pypi.org/simple'
442452
Description: URL to the PyPi Index
443453
Type: String
454+
RootVolumeEncrypted:
455+
AllowedValues:
456+
- 'false'
457+
- 'true'
458+
Default: 'false'
459+
Description: >-
460+
Controls whether to encrypt the root volume.
461+
Type: String
444462
RootVolumeSize:
445463
Default: "20"
446464
Description: >-
@@ -946,13 +964,15 @@ Resources:
946964
- local_Distro2RootDevice: !FindInMap [Distro2RootDevice, !Ref AmiDistro, DeviceName]
947965
Ebs:
948966
DeleteOnTermination: true
967+
Encrypted: !Ref RootVolumeEncrypted
949968
VolumeSize: !Ref RootVolumeSize
950969
VolumeType: gp2
951970
- !If
952971
- CreateAppVolume
953972
- DeviceName: /dev/xvdf
954973
Ebs:
955974
DeleteOnTermination: true
975+
Encrypted: !Ref AppVolumeEncrypted
956976
SnapshotId: !If
957977
- UseAppVolumeSnapshot
958978
- !Ref AppVolumeSnapshotId

modules/lx-instance/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ with an AWS CloudFormation template to deploy a Watchmaker Linux Instance.
3030
| AppScriptShell | (Optional) Shell with which to execute the application script. Ignored if AppScriptUrl is blank | `string` | `"bash"` | no |
3131
| AppScriptUrl | (Optional) S3 URL to the application script in an S3 bucket (s3://). Leave blank to launch without an application script. If specified, an appropriate InstanceRole is required | `string` | `null` | no |
3232
| AppVolumeDevice | (Optional) Decision whether to mount an extra EBS volume. Leave as default (false) to launch without an extra application volume | `bool` | `false` | no |
33+
| AppVolumeEncrypted | (Optional) Controls whether the EBS volume will be encrypted. When KmsKeyId is specified, EBS encryption will be done using that, otherwise encrypted using AWS managed CMK | `bool` | `false` | no |
3334
| AppVolumeMountPath | (Optional) Filesystem path to mount the extra app volume. Ignored if AppVolumeDevice is false | `string` | `"/opt/data"` | no |
3435
| AppVolumeSize | (Optional) Size in GB of the EBS volume to create. Ignored if AppVolumeDevice is false | `string` | `"1"` | no |
3536
| AppVolumeSnapshotId | (Optional) EBS Snapshot ID from which to create the AppVolume. "AppVolumeSize" must be equal or greater than the size of the snapshot. Ignored if "AppVolumeDevice" is false | `string` | `null` | no |
@@ -45,6 +46,7 @@ with an AWS CloudFormation template to deploy a Watchmaker Linux Instance.
4546
| IamRoleArn | (Optional) The ARN of an IAM role that AWS CloudFormation assumes to create the stack. If you don't specify a value, AWS CloudFormation uses the role that was previously associated with the stack. If no role is available, AWS CloudFormation uses a temporary session that is generated from your user credentials | `string` | `null` | no |
4647
| InstanceRole | (Optional) IAM instance role to apply to the instance | `string` | `null` | no |
4748
| InstanceType | (Optional) Amazon EC2 instance type | `string` | `"t2.micro"` | no |
49+
| KmsKeyId | (Optional) Identifier (key ID, key alias, ID ARN, or alias ARN) for a customer managed CMK under which the EBS volume is encrypted. If this is unspecified and encryption is requested, AWS managed CMK for EBS is used to encrypt the volume | `string` | `null` | no |
4850
| NoPublicIp | (Optional) Controls whether to assign the instance a public IP. Recommended to leave at true _unless_ launching in a public subnet | `bool` | `true` | no |
4951
| NoReboot | (Optional) Controls whether to reboot the instance as the last step of cfn-init execution | `bool` | `false` | no |
5052
| NoUpdates | (Optional) Controls whether to run yum update during a stack update (On the initial instance launch, Watchmaker _always_ installs updates) | `bool` | `false` | no |
@@ -55,6 +57,7 @@ with an AWS CloudFormation template to deploy a Watchmaker Linux Instance.
5557
| PolicyUrl | (Optional) URL to a file containing the stack policy. Conflicts with PolicyBody | `string` | `null` | no |
5658
| PrivateIp | (Optional) Set a static, primary private IP. Leave blank to auto-select a free IP | `string` | `null` | no |
5759
| PypiIndexUrl | (Optional) URL to the PyPi Index | `string` | `"https://pypi.org/simple"` | no |
60+
| RootVolumeEncrypted | (Optional) Controls whether the root volume will be encrypted. When KmsKeyId is specified, EBS encryption will be done using that, otherwise encrypted using AWS managed CMK | `bool` | `false` | no |
5861
| RootVolumeSize | (Optional) Root Volume Size in GB **NOTE** This value can be set larger than the default (20GB) but NOT smaller. If set larger than default value partition will need to be expanded manually. | `string` | `"20"` | no |
5962
| StackTags | (Optional) A map of tag keys/values to associate with this stack | `map(string)` | `{}` | no |
6063
| TimeoutInMinutes | (Optional) The amount of time that can pass before the stack status becomes CREATE\_FAILED | `string` | `"30"` | no |

modules/lx-instance/main.tf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ resource "aws_cloudformation_stack" "watchmaker-lx-instance" {
2222
AppScriptShell = var.AppScriptShell
2323
AppScriptUrl = var.AppScriptUrl
2424
AppVolumeDevice = var.AppVolumeDevice
25+
AppVolumeEncrypted = var.AppVolumeEncrypted
2526
AppVolumeMountPath = var.AppVolumeMountPath
2627
AppVolumeSize = var.AppVolumeSize
2728
AppVolumeSnapshotId = var.AppVolumeSnapshotId
@@ -36,12 +37,14 @@ resource "aws_cloudformation_stack" "watchmaker-lx-instance" {
3637
InstanceRole = var.InstanceRole
3738
InstanceType = var.InstanceType
3839
KeyPairName = var.KeyPairName
40+
KmsKeyId = var.KmsKeyId
3941
NoPublicIp = var.NoPublicIp
4042
NoReboot = var.NoReboot
4143
NoUpdates = var.NoUpdates
4244
PatchGroup = var.PatchGroup
4345
PrivateIp = var.PrivateIp
4446
PypiIndexUrl = var.PypiIndexUrl
47+
RootVolumeEncrypted = var.RootVolumeEncrypted
4548
RootVolumeSize = var.RootVolumeSize
4649
SecurityGroupIds = var.SecurityGroupIds
4750
SubnetId = var.SubnetId

modules/lx-instance/variables.tf

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ variable "PolicyUrl" {
5555
default = null
5656
}
5757

58+
variable "RootVolumeEncrypted" {
59+
type = bool
60+
description = "(Optional) Controls whether the root volume will be encrypted. When KmsKeyId is specified, EBS encryption will be done using that, otherwise encrypted using AWS managed CMK"
61+
default = false
62+
}
63+
5864
variable "RootVolumeSize" {
5965
type = string
6066
description = "(Optional) Root Volume Size in GB **NOTE** This value can be set larger than the default (20GB) but NOT smaller. If set larger than default value partition will need to be expanded manually."
@@ -107,6 +113,12 @@ variable "AppVolumeDevice" {
107113
default = false
108114
}
109115

116+
variable "AppVolumeEncrypted" {
117+
type = bool
118+
description = "(Optional) Controls whether the EBS volume will be encrypted. When KmsKeyId is specified, EBS encryption will be done using that, otherwise encrypted using AWS managed CMK"
119+
default = false
120+
}
121+
110122
variable "AppVolumeMountPath" {
111123
type = string
112124
description = "(Optional) Filesystem path to mount the extra app volume. Ignored if AppVolumeDevice is false"
@@ -148,6 +160,12 @@ variable "InstanceRole" {
148160
default = null
149161
}
150162

163+
variable "KmsKeyId" {
164+
type = string
165+
description = "(Optional) Identifier (key ID, key alias, ID ARN, or alias ARN) for a customer managed CMK under which the EBS volume is encrypted. If this is unspecified and encryption is requested, AWS managed CMK for EBS is used to encrypt the volume"
166+
default = null
167+
}
168+
151169
variable "PrivateIp" {
152170
type = string
153171
description = "(Optional) Set a static, primary private IP. Leave blank to auto-select a free IP"

modules/lx-instance/watchmaker-lx-instance.params.cfn.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
ParameterValue: __APPSCRIPTURL__
1111
- ParameterKey: AppVolumeDevice
1212
ParameterValue: __APPVOLUMEDEVICE__
13+
- ParameterKey: AppVolumeEncrypted
14+
ParameterValue: __APPVOLUMEENCRYPTED__
1315
- ParameterKey: AppVolumeMountPath
1416
ParameterValue: __APPVOLUMEMOUNTPATH__
1517
- ParameterKey: AppVolumeSize
@@ -34,6 +36,8 @@
3436
ParameterValue: __INSTANCETYPE__
3537
- ParameterKey: KeyPairName
3638
ParameterValue: __KEYPAIRNAME__
39+
- ParameterKey: KmsKeyId
40+
ParameterValue: __KMSKEYID__
3741
- ParameterKey: NoPublicIp
3842
ParameterValue: __NOPUBLICIP__
3943
- ParameterKey: NoReboot
@@ -46,6 +50,8 @@
4650
ParameterValue: __PRIVATEIP__
4751
- ParameterKey: PypiIndexUrl
4852
ParameterValue: __PYPIINDEXURL__
53+
- ParameterKey: RootVolumeEncrypted
54+
ParameterValue: __ROOTVOLUMEENCRYPTED__
4955
- ParameterKey: RootVolumeSize
5056
ParameterValue: __ROOTVOLUMESIZE__
5157
- ParameterKey: SecurityGroupIds

0 commit comments

Comments
 (0)