Skip to content

Commit

Permalink
[Improvement] ec2/* - Optional MaintenanceWindow (#591)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelwittig authored Oct 26, 2021
1 parent 4749ff1 commit 5213c3d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion ec2/al2-mutable-private.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ Parameters:
MinValue: 8
MaxValue: 1024
MaintenanceWindowSchedule:
Description: 'SSM cron expressions to trigger the maintenace window for patch installation.'
Description: 'SSM cron expressions to trigger the maintenace window for patch installation (leave empty to disable).'
Type: String
Default: 'cron(0 5 ? * SUN *)'
MaintenanceWindowScheduleTimezone:
Expand Down Expand Up @@ -692,6 +692,7 @@ Conditions:
HasManagedPolicyArns: !Not [!Equals [!Ref ManagedPolicyArns, '']]
HasBackupRetentionPeriod: !Not [!Equals [!Ref BackupRetentionPeriod, 0]]
HasRestoreImageId: !Not [!Equals [!Ref RestoreImageId, '']]
HasMaintenanceWindowSchedule: !Not [!Equals [!Ref MaintenanceWindowSchedule, '']]
Resources:
RecordSet:
Condition: HasZone
Expand Down Expand Up @@ -1215,6 +1216,7 @@ Resources:
- Name: path
Value: '/'
MaintenanceWindow:
Condition: HasMaintenanceWindowSchedule
Type: 'AWS::SSM::MaintenanceWindow'
Properties:
AllowUnassociatedTargets: false
Expand All @@ -1224,6 +1226,7 @@ Resources:
Schedule: !Ref MaintenanceWindowSchedule
ScheduleTimezone: !Ref MaintenanceWindowScheduleTimezone
MaintenanceWindowTarget:
Condition: HasMaintenanceWindowSchedule
Type: 'AWS::SSM::MaintenanceWindowTarget'
Properties:
ResourceType: INSTANCE
Expand All @@ -1232,6 +1235,7 @@ Resources:
Values: [!Ref VirtualMachine]
WindowId: !Ref MaintenanceWindow
MaintenanceWindowTask:
Condition: HasMaintenanceWindowSchedule
Type: 'AWS::SSM::MaintenanceWindowTask'
Properties:
MaxConcurrency: '1'
Expand Down
6 changes: 5 additions & 1 deletion ec2/al2-mutable-public.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ Parameters:
MinValue: 8
MaxValue: 1024
MaintenanceWindowSchedule:
Description: 'SSM cron expressions to trigger the maintenace window for patch installation.'
Description: 'SSM cron expressions to trigger the maintenace window for patch installation (leave empty to disable).'
Type: String
Default: 'cron(0 5 ? * SUN *)'
MaintenanceWindowScheduleTimezone:
Expand Down Expand Up @@ -692,6 +692,7 @@ Conditions:
HasManagedPolicyArns: !Not [!Equals [!Ref ManagedPolicyArns, '']]
HasBackupRetentionPeriod: !Not [!Equals [!Ref BackupRetentionPeriod, 0]]
HasRestoreImageId: !Not [!Equals [!Ref RestoreImageId, '']]
HasMaintenanceWindowSchedule: !Not [!Equals [!Ref MaintenanceWindowSchedule, '']]
Resources:
RecordSet:
Condition: HasZone
Expand Down Expand Up @@ -1225,6 +1226,7 @@ Resources:
- Name: path
Value: '/'
MaintenanceWindow:
Condition: HasMaintenanceWindowSchedule
Type: 'AWS::SSM::MaintenanceWindow'
Properties:
AllowUnassociatedTargets: false
Expand All @@ -1234,6 +1236,7 @@ Resources:
Schedule: !Ref MaintenanceWindowSchedule
ScheduleTimezone: !Ref MaintenanceWindowScheduleTimezone
MaintenanceWindowTarget:
Condition: HasMaintenanceWindowSchedule
Type: 'AWS::SSM::MaintenanceWindowTarget'
Properties:
ResourceType: INSTANCE
Expand All @@ -1242,6 +1245,7 @@ Resources:
Values: [!Ref VirtualMachine]
WindowId: !Ref MaintenanceWindow
MaintenanceWindowTask:
Condition: HasMaintenanceWindowSchedule
Type: 'AWS::SSM::MaintenanceWindowTask'
Properties:
MaxConcurrency: '1'
Expand Down

0 comments on commit 5213c3d

Please sign in to comment.