Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Supports creating the AppVolume from an EBS Snapshot #109

Merged
merged 2 commits into from
Mar 7, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions modules/lx-autoscale/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ resource "aws_cloudformation_stack" "watchmaker-lx-autoscale" {
AppVolumeDevice = "${var.AppVolumeDevice}"
AppVolumeMountPath = "${var.AppVolumeMountPath}"
AppVolumeSize = "${var.AppVolumeSize}"
AppVolumeSnapshotId = "${var.AppVolumeSnapshotId}"
AppVolumeType = "${var.AppVolumeType}"
AsgMetrics = "${join(",", var.AsgMetrics)}"
AsgNotificationTypes = "${join(",", var.AsgNotificationTypes)}"
Expand Down
6 changes: 6 additions & 0 deletions modules/lx-autoscale/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,12 @@ variable "AppVolumeSize" {
default = "1"
}

variable "AppVolumeSnapshotId" {
type = "string"
description = "(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"
default = ""
}

variable "KeyPairName" {
type = "string"
description = "Public/private key pairs allow you to securely connect to your instance after it launches"
Expand Down
23 changes: 20 additions & 3 deletions modules/lx-autoscale/watchmaker-lx-autoscale.template.cfn.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ Conditions:
- !Equals
- !Ref WatchmakerAdminUsers
- ''
UseAppVolumeSnapshot: !Not
- !Equals
- !Ref AppVolumeSnapshotId
- ''
UseAsgMetricsCollection: !Not
- !Equals
- !Join [ "," , !Ref AsgMetrics]
Expand Down Expand Up @@ -203,6 +207,7 @@ Metadata:
- AppVolumeDevice
- AppVolumeMountPath
- AppVolumeSize
- AppVolumeSnapshotId
- AppVolumeType
- Label:
default: AutoScale Configuration
Expand Down Expand Up @@ -306,17 +311,25 @@ Parameters:
Default: /opt/data
Description: >-
Filesystem path to mount the extra app volume. Ignored if
"AppVolumeDevice" is blank
"AppVolumeDevice" is false
Type: String
AppVolumeSize:
ConstraintDescription: Must be between 1GB and 16384GB.
Default: 1
Description: >-
Size in GB of the EBS volume to create. Ignored if "AppVolumeDevice" is
blank
false
MaxValue: 16384
MinValue: 1
Type: Number
AppVolumeSnapshotId:
AllowedPattern: '^$|snap-[a-z0-9]+'
Default: ''
Description: >-
(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
Type: String
AppVolumeType:
AllowedValues:
- gp2
Expand All @@ -325,7 +338,7 @@ Parameters:
- st1
- standard
Default: gp2
Description: Type of EBS volume to create. Ignored if "AppVolumeDevice" is blank
Description: Type of EBS volume to create. Ignored if "AppVolumeDevice" is false
Type: String
AsgMetrics:
Default: ''
Expand Down Expand Up @@ -948,6 +961,10 @@ Resources:
- DeviceName: /dev/xvdf
Ebs:
DeleteOnTermination: true
SnapshotId: !If
- UseAppVolumeSnapshot
- !Ref AppVolumeSnapshotId
- !Ref 'AWS::NoValue'
VolumeSize: !Ref AppVolumeSize
VolumeType: !Ref AppVolumeType
- !Ref 'AWS::NoValue'
Expand Down
1 change: 1 addition & 0 deletions modules/lx-instance/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ resource "aws_cloudformation_stack" "watchmaker-lx-instance" {
AppVolumeDevice = "${var.AppVolumeDevice}"
AppVolumeMountPath = "${var.AppVolumeMountPath}"
AppVolumeSize = "${var.AppVolumeSize}"
AppVolumeSnapshotId = "${var.AppVolumeSnapshotId}"
AppVolumeType = "${var.AppVolumeType}"
CfnBootstrapUtilsUrl = "${var.CfnBootstrapUtilsUrl}"
CfnEndpointUrl = "${var.CfnEndpointUrl}"
Expand Down
6 changes: 6 additions & 0 deletions modules/lx-instance/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,12 @@ variable "AppVolumeSize" {
default = "1"
}

variable "AppVolumeSnapshotId" {
type = "string"
description = "(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"
default = ""
}

variable "KeyPairName" {
type = "string"
description = "Public/private key pairs allow you to securely connect to your instance after it launches"
Expand Down
17 changes: 17 additions & 0 deletions modules/lx-instance/watchmaker-lx-instance.template.cfn.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ Conditions:
- !Equals
- !Ref WatchmakerAdminUsers
- ''
UseAppVolumeSnapshot: !Not
- !Equals
- !Ref AppVolumeSnapshotId
- ''
UseCfnUrl: !Not
- !Equals
- !Ref CfnEndpointUrl
Expand Down Expand Up @@ -171,6 +175,7 @@ Metadata:
- AppVolumeDevice
- AppVolumeMountPath
- AppVolumeSize
- AppVolumeSnapshotId
- AppVolumeType
- Label:
default: Network Configuration
Expand Down Expand Up @@ -257,6 +262,14 @@ Parameters:
MaxValue: 16384
MinValue: 1
Type: Number
AppVolumeSnapshotId:
AllowedPattern: '^$|snap-[a-z0-9]+'
Default: ''
Description: >-
(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
Type: String
AppVolumeType:
AllowedValues:
- gp2
Expand Down Expand Up @@ -761,6 +774,10 @@ Resources:
- DeviceName: /dev/xvdf
Ebs:
DeleteOnTermination: true
SnapshotId: !If
- UseAppVolumeSnapshot
- !Ref AppVolumeSnapshotId
- !Ref 'AWS::NoValue'
VolumeSize: !Ref AppVolumeSize
VolumeType: !Ref AppVolumeType
- !Ref 'AWS::NoValue'
Expand Down
1 change: 1 addition & 0 deletions modules/win-autoscale/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ resource "aws_cloudformation_stack" "watchmaker-win-autoscale" {
AppScriptUrl = "${var.AppScriptUrl}"
AppVolumeDevice = "${var.AppVolumeDevice}"
AppVolumeSize = "${var.AppVolumeSize}"
AppVolumeSnapshotId = "${var.AppVolumeSnapshotId}"
AppVolumeType = "${var.AppVolumeType}"
AsgMetrics = "${join(",", var.AsgMetrics)}"
AsgNotificationTypes = "${join(",", var.AsgNotificationTypes)}"
Expand Down
6 changes: 6 additions & 0 deletions modules/win-autoscale/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@ variable "AppVolumeSize" {
default = "1"
}

variable "AppVolumeSnapshotId" {
type = "string"
description = "(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 blank"
default = ""
}

variable "KeyPairName" {
type = "string"
description = "Public/private key pairs allow you to securely connect to your instance after it launches"
Expand Down
17 changes: 17 additions & 0 deletions modules/win-autoscale/watchmaker-win-autoscale.template.cfn.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ Conditions:
- !Equals
- !Ref WatchmakerAdminGroups
- ''
UseAppVolumeSnapshot: !Not
- !Equals
- !Ref AppVolumeSnapshotId
- ''
UseCfnUrl: !Not
- !Equals
- !Ref CfnEndpointUrl
Expand Down Expand Up @@ -138,6 +142,7 @@ Metadata:
Parameters:
- AppVolumeDevice
- AppVolumeSize
- AppVolumeSnapshotId
- AppVolumeType
- Label:
default: AutoScale Configuration
Expand Down Expand Up @@ -231,6 +236,14 @@ Parameters:
MaxValue: 16384
MinValue: 1
Type: Number
AppVolumeSnapshotId:
AllowedPattern: '^$|snap-[a-z0-9]+'
Default: ''
Description: >-
(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 blank
Type: String
AppVolumeType:
AllowedValues:
- gp2
Expand Down Expand Up @@ -902,6 +915,10 @@ Resources:
- DeviceName: !Ref AppVolumeDevice
Ebs:
DeleteOnTermination: true
SnapshotId: !If
- UseAppVolumeSnapshot
- !Ref AppVolumeSnapshotId
- !Ref 'AWS::NoValue'
VolumeSize: !Ref AppVolumeSize
VolumeType: !Ref AppVolumeType
- !Ref 'AWS::NoValue'
Expand Down
1 change: 1 addition & 0 deletions modules/win-instance/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ resource "aws_cloudformation_stack" "watchmaker-win-instance" {
AppScriptUrl = "${var.AppScriptUrl}"
AppVolumeDevice = "${var.AppVolumeDevice}"
AppVolumeSize = "${var.AppVolumeSize}"
AppVolumeSnapshotId = "${var.AppVolumeSnapshotId}"
AppVolumeType = "${var.AppVolumeType}"
CfnEndpointUrl = "${var.CfnEndpointUrl}"
CloudWatchAgentUrl = "${var.CloudWatchAgentUrl}"
Expand Down
6 changes: 6 additions & 0 deletions modules/win-instance/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,12 @@ variable "AppVolumeSize" {
default = "1"
}

variable "AppVolumeSnapshotId" {
type = "string"
description = "(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 blank"
default = ""
}

variable "KeyPairName" {
type = "string"
description = "Public/private key pairs allow you to securely connect to your instance after it launches"
Expand Down
17 changes: 17 additions & 0 deletions modules/win-instance/watchmaker-win-instance.template.cfn.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ Conditions:
- !Equals
- !Ref WatchmakerAdminUsers
- ''
UseAppVolumeSnapshot: !Not
- !Equals
- !Ref AppVolumeSnapshotId
- ''
UseCfnUrl: !Not
- !Equals
- !Ref CfnEndpointUrl
Expand Down Expand Up @@ -109,6 +113,7 @@ Metadata:
Parameters:
- AppVolumeDevice
- AppVolumeSize
- AppVolumeSnapshotId
- AppVolumeType
- Label:
default: Network Configuration
Expand Down Expand Up @@ -174,6 +179,14 @@ Parameters:
MaxValue: 16384
MinValue: 1
Type: Number
AppVolumeSnapshotId:
AllowedPattern: '^$|snap-[a-z0-9]+'
Default: ''
Description: >-
(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 blank
Type: String
AppVolumeType:
AllowedValues:
- gp2
Expand Down Expand Up @@ -726,6 +739,10 @@ Resources:
- DeviceName: !Ref AppVolumeDevice
Ebs:
DeleteOnTermination: true
SnapshotId: !If
- UseAppVolumeSnapshot
- !Ref AppVolumeSnapshotId
- !Ref 'AWS::NoValue'
VolumeSize: !Ref AppVolumeSize
VolumeType: !Ref AppVolumeType
- !Ref 'AWS::NoValue'
Expand Down