Skip to content

Commit 04fb627

Browse files
authored
Merge pull request #87 from userhas404d/ssm-tag
Adds conditional creation of the Patch Group tag
2 parents 1b3482a + 189c231 commit 04fb627

17 files changed

Lines changed: 113 additions & 8 deletions

.bumpversion.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 1.7.0
2+
current_version = 1.8.0
33
commit = True
44
message = Bumps version to {new_version}
55
tag = False

modules/lx-autoscale/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ resource "aws_cloudformation_stack" "watchmaker-lx-autoscale" {
3838
NoPublicIp = "${var.NoPublicIp}"
3939
NoReboot = "${var.NoReboot}"
4040
NoUpdates = "${var.NoUpdates}"
41+
PatchGroup = "${var.PatchGroup}"
4142
SecurityGroupIds = "${var.SecurityGroupIds}"
4243
SubnetIds = "${var.SubnetIds}"
4344
TargetGroupArns = "${var.TargetGroupArns}"

modules/lx-autoscale/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ variable "OnFailureAction" {
3737
default = "DO_NOTHING"
3838
}
3939

40+
variable "PatchGroup" {
41+
type = "string"
42+
description = "Key value of the Patch Group tag. Controls whether to create a PatchGroup tag that can be leveraged via SSM to auto-update instances."
43+
default = ""
44+
}
45+
4046
variable "PolicyBody" {
4147
type = "string"
4248
description = "String containing the stack policy body. Conflicts with PolicyUrl"

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
ParameterValue: __NOREBOOT__
3535
- ParameterKey: NoUpdates
3636
ParameterValue: __NOUPDATES__
37+
- ParameterKey: PatchGroup
38+
ParameterValue: __PATCHGROUP__
3739
- ParameterKey: SecurityGroupIds
3840
ParameterValue: __SECURITYGROUPIDS__
3941
- ParameterKey: SubnetIds

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

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ Conditions:
1111
CreateAppVolume: !Equals
1212
- !Ref AppVolumeDevice
1313
- 'true'
14+
CreatePatchGroupTag: !Not
15+
- !Equals
16+
- !Ref PatchGroup
17+
- ''
1418
ExecuteAppScript: !Not
1519
- !Equals
1620
- !Ref AppScriptUrl
@@ -133,6 +137,7 @@ Metadata:
133137
- NoPublicIp
134138
- NoReboot
135139
- NoUpdates
140+
- PatchGroup
136141
- SecurityGroupIds
137142
- Label:
138143
default: EC2 Watchmaker Configuration
@@ -185,7 +190,7 @@ Metadata:
185190
default: Force Cfn Init Update
186191
ToggleNewInstances:
187192
default: Force New Instances
188-
Version: 1.7.0
193+
Version: 1.8.0
189194
Outputs:
190195
ScaleDownScheduledAction:
191196
Condition: UseScheduledAction
@@ -376,6 +381,12 @@ Parameters:
376381
Controls whether to run yum update during a stack update (on the initial
377382
instance launch, Watchmaker _always_ installs updates)
378383
Type: String
384+
PatchGroup:
385+
Default: ''
386+
Description: >-
387+
(Optional) Key value of the Patch Group tag. Controls whether to create a PatchGroup
388+
tag that can be leveraged via SSM to auto-update instances.
389+
Type: String
379390
PypiIndexUrl:
380391
AllowedPattern: '^http[s]?://.*$'
381392
Default: 'https://pypi.org/simple'
@@ -499,9 +510,15 @@ Resources:
499510
MinSize: !Ref MinCapacity
500511
Tags:
501512
- Key: Name
513+
Value: !Sub '${AWS::StackName}'
502514
PropagateAtLaunch: true
503-
Value:
504-
!Sub '${AWS::StackName}'
515+
- !If
516+
- CreatePatchGroupTag
517+
-
518+
Key: Patch Group
519+
Value: !Ref PatchGroup
520+
PropagateAtLaunch: true
521+
- !Ref 'AWS::NoValue'
505522
TargetGroupARNs: !If
506523
- UseTargetGroupArns
507524
- !Ref TargetGroupArns

modules/lx-instance/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ resource "aws_cloudformation_stack" "watchmaker-lx-instance" {
3636
NoUpdates = "${var.NoUpdates}"
3737
SecurityGroupIds = "${var.SecurityGroupIds}"
3838
SubnetId = "${var.SubnetId}"
39+
PatchGroup = "${var.PatchGroup}"
3940
PypiIndexUrl = "${var.PypiIndexUrl}"
4041
WatchmakerConfig = "${var.WatchmakerConfig}"
4142
WatchmakerEnvironment = "${var.WatchmakerEnvironment}"

modules/lx-instance/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ variable "OnFailureAction" {
3737
default = "DO_NOTHING"
3838
}
3939

40+
variable "PatchGroup" {
41+
type = "string"
42+
description = "Key value of the Patch Group tag. Controls whether to create a PatchGroup tag that can be leveraged via SSM to auto-update instances."
43+
default = ""
44+
}
45+
4046
variable "PolicyBody" {
4147
type = "string"
4248
description = "String containing the stack policy body. Conflicts with PolicyUrl"

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
ParameterValue: __NOREBOOT__
2929
- ParameterKey: NoUpdates
3030
ParameterValue: __NOUPDATES__
31+
- ParameterKey: PatchGroup
32+
ParameterValue: __PATCHGROUP__
3133
- ParameterKey: PrivateIp
3234
ParameterValue: __PRIVATEIP__
3335
- ParameterKey: SecurityGroupIds

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

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ Conditions:
1515
CreateAppVolume: !Equals
1616
- !Ref AppVolumeDevice
1717
- 'true'
18+
CreatePatchGroupTag: !Not
19+
- !Equals
20+
- !Ref PatchGroup
21+
- ''
1822
ExecuteAppScript: !Not
1923
- !Equals
2024
- !Ref AppScriptUrl
@@ -117,6 +121,7 @@ Metadata:
117121
- NoPublicIp
118122
- NoReboot
119123
- NoUpdates
124+
- PatchGroup
120125
- SecurityGroupIds
121126
- Label:
122127
default: EC2 Watchmaker Configuration
@@ -158,7 +163,7 @@ Metadata:
158163
ParameterLabels:
159164
ToggleCfnInitUpdate:
160165
default: Force Cfn Init Update
161-
Version: 1.7.0
166+
Version: 1.8.0
162167
Outputs:
163168
WatchmakerInstanceId:
164169
Description: Instance ID
@@ -320,6 +325,12 @@ Parameters:
320325
Controls whether to run yum update during a stack update (on the initial
321326
instance launch, Watchmaker _always_ installs updates)
322327
Type: String
328+
PatchGroup:
329+
Default: ''
330+
Description: >-
331+
(Optional) Key value of the Patch Group tag. Controls whether to create a PatchGroup
332+
tag that can be leveraged via SSM to auto-update instances.
333+
Type: String
323334
PrivateIp:
324335
Default: ''
325336
Description: >-
@@ -709,6 +720,12 @@ Resources:
709720
Tags:
710721
- Key: Name
711722
Value: !Sub '${AWS::StackName}'
723+
- !If
724+
- CreatePatchGroupTag
725+
-
726+
Key: Patch Group
727+
Value: !Ref PatchGroup
728+
- !Ref 'AWS::NoValue'
712729
UserData:
713730
!Base64
714731
Fn::Sub:

modules/win-autoscale/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ resource "aws_cloudformation_stack" "watchmaker-win-autoscale" {
3434
ScaleUpSchedule = "${var.ScaleUpSchedule}"
3535
NoPublicIp = "${var.NoPublicIp}"
3636
NoReboot = "${var.NoReboot}"
37+
PatchGroup = "${var.PatchGroup}"
3738
SecurityGroupIds = "${var.SecurityGroupIds}"
3839
SubnetIds = "${var.SubnetIds}"
3940
TargetGroupArns = "${var.TargetGroupArns}"

0 commit comments

Comments
 (0)