Skip to content

Commit

Permalink
Merge pull request #140 from eemperor/add-timeout
Browse files Browse the repository at this point in the history
Updates templates to handle timeout variable
  • Loading branch information
eemperor authored Jul 10, 2019
2 parents 75798e8 + 734f8ab commit 61784c9
Show file tree
Hide file tree
Showing 13 changed files with 85 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 1.15.3
current_version = 1.15.4
commit = True
message = Bumps version to {new_version}
tag = False
Expand Down
11 changes: 9 additions & 2 deletions modules/lx-autoscale/main.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Terraform module to create a Watchmaker Linux Autoscaling Group using a CloudFormation cfn.json
# Assumes that watchmaker-lx-autoscale.cfn.json is stored in the same directory as main.tf of the module.
# Terraform module to create a Watchmaker Linux Autoscaling Group using a CloudFormation template.
# Assumes that the Watchmaker Cloudformation template is stored in the same directory as main.tf of the module.

resource "aws_cloudformation_stack" "watchmaker-lx-autoscale" {
template_body = "${file("${path.module}/watchmaker-lx-autoscale.template.cfn.yaml")}"
Expand Down Expand Up @@ -31,6 +31,7 @@ resource "aws_cloudformation_stack" "watchmaker-lx-autoscale" {
AsgSnsArn = "${var.AsgSnsArn}"
CfnBootstrapUtilsUrl = "${var.CfnBootstrapUtilsUrl}"
CfnEndpointUrl = "${var.CfnEndpointUrl}"
CfnStackSignalTimeout = "${var.TimeoutInMinutes}"
CloudWatchAgentUrl = "${var.CloudWatchAgentUrl}"
CloudWatchAppLogs = "${join(",", var.CloudWatchAppLogs)}"
DesiredCapacity = "${var.DesiredCapacity}"
Expand Down Expand Up @@ -64,4 +65,10 @@ resource "aws_cloudformation_stack" "watchmaker-lx-autoscale" {
WatchmakerStandaloneUrl = "${var.WatchmakerStandaloneUrl}"
WatchmakerVersion = "${var.WatchmakerVersion}"
}

timeouts {
create = "${var.TimeoutInMinutes}m"
delete = "${var.TimeoutInMinutes}m"
update = "${var.TimeoutInMinutes}m"
}
}
2 changes: 1 addition & 1 deletion modules/lx-autoscale/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ variable "StackTags" {
variable "TimeoutInMinutes" {
type = "string"
description = "The amount of time that can pass before the stack status becomes CREATE_FAILED"
default = "120"
default = "30"
}

variable "AmiId" {
Expand Down
13 changes: 11 additions & 2 deletions modules/lx-autoscale/watchmaker-lx-autoscale.template.cfn.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ Metadata:
Parameters:
- CfnEndpointUrl
- CfnBootstrapUtilsUrl
- CfnStackSignalTimeout
- CloudWatchAgentUrl
- CloudWatchAppLogs
- ToggleCfnInitUpdate
Expand All @@ -201,7 +202,7 @@ Metadata:
default: Force Cfn Init Update
ToggleNewInstances:
default: Force New Instances
Version: 1.15.3
Version: 1.15.4
Outputs:
ScaleDownScheduledAction:
Condition: UseScheduledAction
Expand Down Expand Up @@ -331,6 +332,14 @@ Parameters:
(Optional) URL to the CloudFormation Endpoint. e.g.
https://cloudformation.us-east-1.amazonaws.com
Type: String
CfnStackSignalTimeout:
ConstraintDescription: Set a value between 1 and 720.
Default: 30
Description: >-
The amount of time in minutes that can pass before the stack status becomes CREATE_FAILED
MaxValue: 720
MinValue: 1
Type: Number
CloudWatchAgentUrl:
AllowedPattern: '^$|^s3://.*\.rpm$'
Default: ''
Expand Down Expand Up @@ -556,7 +565,7 @@ Resources:
CreationPolicy:
ResourceSignal:
Count: !Ref DesiredCapacity
Timeout: PT30M
Timeout: !Sub PT${CfnStackSignalTimeout}M
Properties:
DesiredCapacity: !Ref DesiredCapacity
HealthCheckGracePeriod: !If
Expand Down
11 changes: 9 additions & 2 deletions modules/lx-instance/main.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Terraform module to create a Watchmaker Linux instance using a CloudFormation cfn.json
# Assumes that watchmaker-lx-instance.cfn.json is stored in the same directory as main.tf of the module.
# Terraform module to create a Watchmaker Linux instance using a CloudFormation template
# Assumes that the template is stored in the same directory as main.tf of the module.

resource "aws_cloudformation_stack" "watchmaker-lx-instance" {
template_body = "${file("${path.module}/watchmaker-lx-instance.template.cfn.yaml")}"
Expand Down Expand Up @@ -28,6 +28,7 @@ resource "aws_cloudformation_stack" "watchmaker-lx-instance" {
AppVolumeType = "${var.AppVolumeType}"
CfnBootstrapUtilsUrl = "${var.CfnBootstrapUtilsUrl}"
CfnEndpointUrl = "${var.CfnEndpointUrl}"
CfnStackSignalTimeout = "${var.TimeoutInMinutes}"
CloudWatchAgentUrl = "${var.CloudWatchAgentUrl}"
CloudWatchAppLogs = "${join(",", var.CloudWatchAppLogs)}"
DisableApiTermination = "${var.DisableApiTermination}"
Expand Down Expand Up @@ -55,4 +56,10 @@ resource "aws_cloudformation_stack" "watchmaker-lx-instance" {
WatchmakerStandaloneUrl = "${var.WatchmakerStandaloneUrl}"
WatchmakerVersion = "${var.WatchmakerVersion}"
}

timeouts {
create = "${var.TimeoutInMinutes}m"
delete = "${var.TimeoutInMinutes}m"
update = "${var.TimeoutInMinutes}m"
}
}
2 changes: 1 addition & 1 deletion modules/lx-instance/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ variable "StackTags" {
variable "TimeoutInMinutes" {
type = "string"
description = "The amount of time that can pass before the stack status becomes CREATE_FAILED"
default = "120"
default = "30"
}

variable "AmiId" {
Expand Down
13 changes: 11 additions & 2 deletions modules/lx-instance/watchmaker-lx-instance.template.cfn.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,14 @@ Metadata:
Parameters:
- CfnEndpointUrl
- CfnBootstrapUtilsUrl
- CfnStackSignalTimeout
- CloudWatchAgentUrl
- CloudWatchAppLogs
- ToggleCfnInitUpdate
ParameterLabels:
ToggleCfnInitUpdate:
default: Force Cfn Init Update
Version: 1.15.3
Version: 1.15.4
Outputs:
WatchmakerInstanceId:
Description: Instance ID
Expand Down Expand Up @@ -251,6 +252,14 @@ Parameters:
(Optional) URL to the CloudFormation Endpoint. e.g.
https://cloudformation.us-east-1.amazonaws.com
Type: String
CfnStackSignalTimeout:
ConstraintDescription: Set a value between 1 and 720.
Default: 30
Description: >-
The amount of time in minutes that can pass before the stack status becomes CREATE_FAILED
MaxValue: 720
MinValue: 1
Type: Number
CloudWatchAgentUrl:
AllowedPattern: '^$|^s3://.*\.rpm$'
Default: ''
Expand Down Expand Up @@ -425,7 +434,7 @@ Resources:
CreationPolicy:
ResourceSignal:
Count: '1'
Timeout: PT30M
Timeout: !Sub PT${CfnStackSignalTimeout}M
Metadata:
'AWS::CloudFormation::Init':
configSets:
Expand Down
11 changes: 9 additions & 2 deletions modules/win-autoscale/main.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Terraform module to create a Watchmaker Windows Autoscaling Group using a CloudFormation cfn.json
# Assumes that watchmaker-win-autoscale.cfn.json is stored in the same directory as main.tf of the module.
# Terraform module to create a Watchmaker Windows Autoscaling Group using a CloudFormation template
# Assumes that the template is stored in the same directory as main.tf of the module.

resource "aws_cloudformation_stack" "watchmaker-win-autoscale" {
template_body = "${file("${path.module}/watchmaker-win-autoscale.template.cfn.yaml")}"
Expand Down Expand Up @@ -27,6 +27,7 @@ resource "aws_cloudformation_stack" "watchmaker-win-autoscale" {
AsgNotificationTypes = "${join(",", var.AsgNotificationTypes)}"
AsgSnsArn = "${var.AsgSnsArn}"
CfnEndpointUrl = "${var.CfnEndpointUrl}"
CfnStackSignalTimeout = "${var.TimeoutInMinutes}"
CloudWatchAgentUrl = "${var.CloudWatchAgentUrl}"
CloudWatchAppLogs = "${join(",", var.CloudWatchAppLogs)}"
DesiredCapacity = "${var.DesiredCapacity}"
Expand Down Expand Up @@ -61,4 +62,10 @@ resource "aws_cloudformation_stack" "watchmaker-win-autoscale" {
WatchmakerStandaloneUrl = "${var.WatchmakerStandaloneUrl}"
WatchmakerVersion = "${var.WatchmakerVersion}"
}

timeouts {
create = "${var.TimeoutInMinutes}m"
delete = "${var.TimeoutInMinutes}m"
update = "${var.TimeoutInMinutes}m"
}
}
2 changes: 1 addition & 1 deletion modules/win-autoscale/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ variable "StackTags" {
variable "TimeoutInMinutes" {
type = "string"
description = "The amount of time that can pass before the stack status becomes CREATE_FAILED"
default = "120"
default = "30"
}

variable "AmiId" {
Expand Down
13 changes: 11 additions & 2 deletions modules/win-autoscale/watchmaker-win-autoscale.template.cfn.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ Metadata:
default: CloudFormation Configuration
Parameters:
- CfnEndpointUrl
- CfnStackSignalTimeout
- CloudWatchAgentUrl
- CloudWatchAppLogs
- ToggleCfnInitUpdate
Expand All @@ -191,7 +192,7 @@ Metadata:
default: Force Cfn Init Update
ToggleNewInstances:
default: Force New Instances
Version: 1.15.3
Version: 1.15.4
Outputs:
ScaleDownScheduledAction:
Condition: UseScheduledAction
Expand Down Expand Up @@ -296,6 +297,14 @@ Parameters:
(Optional) URL to the CloudFormation Endpoint. e.g.
https://cloudformation.us-east-1.amazonaws.com
Type: String
CfnStackSignalTimeout:
ConstraintDescription: Set a value between 1 and 720.
Default: 30
Description: >-
The amount of time in minutes that can pass before the stack status becomes CREATE_FAILED
MaxValue: 720
MinValue: 1
Type: Number
CloudWatchAgentUrl:
AllowedPattern: '^$|^s3://.*\.msi$'
Default: ''
Expand Down Expand Up @@ -524,7 +533,7 @@ Resources:
CreationPolicy:
ResourceSignal:
Count: !Ref DesiredCapacity
Timeout: PT60M
Timeout: !Sub PT${CfnStackSignalTimeout}M
Properties:
DesiredCapacity: !Ref DesiredCapacity
HealthCheckGracePeriod: !If
Expand Down
11 changes: 9 additions & 2 deletions modules/win-instance/main.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Terraform module to create a Watchmaker Windows instance using a CloudFormation cfn.json
# Assumes that watchmaker-win-instance.cfn.json is stored in the same directory as main.tf of the module.
# Terraform module to create a Watchmaker Windows instance using a CloudFormation template
# Assumes that the template is stored in the same directory as main.tf of the module.

resource "aws_cloudformation_stack" "watchmaker-win-instance" {
template_body = "${file("${path.module}/watchmaker-win-instance.template.cfn.yaml")}"
Expand All @@ -24,6 +24,7 @@ resource "aws_cloudformation_stack" "watchmaker-win-instance" {
AppVolumeSnapshotId = "${var.AppVolumeSnapshotId}"
AppVolumeType = "${var.AppVolumeType}"
CfnEndpointUrl = "${var.CfnEndpointUrl}"
CfnStackSignalTimeout = "${var.TimeoutInMinutes}"
CloudWatchAgentUrl = "${var.CloudWatchAgentUrl}"
CloudWatchAppLogs = "${join(",", var.CloudWatchAppLogs)}"
DisableApiTermination = "${var.DisableApiTermination}"
Expand Down Expand Up @@ -52,4 +53,10 @@ resource "aws_cloudformation_stack" "watchmaker-win-instance" {
WatchmakerStandaloneUrl = "${var.WatchmakerStandaloneUrl}"
WatchmakerVersion = "${var.WatchmakerVersion}"
}

timeouts {
create = "${var.TimeoutInMinutes}m"
delete = "${var.TimeoutInMinutes}m"
update = "${var.TimeoutInMinutes}m"
}
}
2 changes: 1 addition & 1 deletion modules/win-instance/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ variable "StackTags" {
variable "TimeoutInMinutes" {
type = "string"
description = "The amount of time that can pass before the stack status becomes CREATE_FAILED"
default = "120"
default = "30"
}

variable "AmiId" {
Expand Down
13 changes: 11 additions & 2 deletions modules/win-instance/watchmaker-win-instance.template.cfn.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,14 @@ Metadata:
default: CloudFormation Configuration
Parameters:
- CfnEndpointUrl
- CfnStackSignalTimeout
- CloudWatchAgentUrl
- CloudWatchAppLogs
- ToggleCfnInitUpdate
ParameterLabels:
ToggleCfnInitUpdate:
default: Force Cfn Init Update
Version: 1.15.3
Version: 1.15.4
Outputs:
WatchmakerInstanceId:
Description: Instance ID
Expand Down Expand Up @@ -214,6 +215,14 @@ Parameters:
(Optional) URL to the CloudFormation Endpoint. e.g.
https://cloudformation.us-east-1.amazonaws.com
Type: String
CfnStackSignalTimeout:
ConstraintDescription: Set a value between 1 and 720.
Default: 30
Description: >-
The amount of time in minutes that can pass before the stack status becomes CREATE_FAILED
MaxValue: 720
MinValue: 1
Type: Number
CloudWatchAgentUrl:
AllowedPattern: '^$|^s3://.*\.msi$'
Default: ''
Expand Down Expand Up @@ -389,7 +398,7 @@ Resources:
CreationPolicy:
ResourceSignal:
Count: 1
Timeout: PT60M
Timeout: !Sub PT${CfnStackSignalTimeout}M
Metadata:
'AWS::CloudFormation::Init':
configSets:
Expand Down

0 comments on commit 61784c9

Please sign in to comment.