├── CHANGELOG.md
├── LICENSE
├── README.md
├── iam.tf
├── outputs.tf
├── s3.tf
├── ssm.tf
├── terraform.tf
└── variables.tf
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | ## 1.3.1 (September 22, 2017)
2 |
3 | IMPROVEMENTS:
4 | * Updated the examples in the README
5 | * Added descriptions to the variables
6 | * Added LICENSE and CHANGELOG
7 |
8 | ## 1.3.0 (July 21, 2017)
9 |
10 | FEATURES:
11 | * Added s3 logging
12 |
13 | IMPROVEMENTS:
14 | * Refactored module into seperate files
15 | * Updated patch group tags
16 |
17 | ## 1.2.0 (June 23, 2017)
18 |
19 | BUG FIXES:
20 |
21 | * Fixed `max_concurrency` and `max_errors` which were not passed through to resource.
22 |
23 | ## 1.1.0 (June 21, 2017)
24 |
25 | IMPROVEMENTS:
26 |
27 | * Added support for customizing `max_concurrency` and `max_errors` in the maintaince_window_task
28 | * Added `required_version` to terraform
29 |
30 | BUG FIXES:
31 |
32 | * Fixed `approved_patches` and `rejected_patches` variable defaults
33 | * Added missing `envtype` variable
34 |
35 | ## 1.0.0 (June 14, 2017)
36 |
37 | Initial version
38 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2017 Claranet
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | tf-aws-ssm-patch-mgmt
2 | -----
3 |
4 | This module should be used to patch Windows instances based on a schedule.
5 |
6 | The schedule must be in cron or rate format, for example by default the patch scan schedule occurs on a Wednesday 6PM, the patch install schedule occurs at 9PM. For further information on these formats please see the AWS user docs here.
7 |
8 | #### Instance tagging
9 | The instances that you wish to be covered by SSM patch management must be tagged with their corresponding "Patch Group". For example we have used the defaults here of "static" and "disposable" for patch scanning, and "automatic" if you want patches automatically installed.
10 |
11 | _By default:_
12 | * Instances that are tagged with Key: 'Patch Group', Value: 'automatic' will be scanned for Windows updates and then will have the updates installed.
13 |
14 | * Instances that are tagged with Key: 'Patch Group', Value: 'static' and or 'disposable' will just be scanned and not installed.
15 |
16 |
17 |
18 | Usage
19 | -----
20 |
21 | ```js
22 |
23 | module "ssm-patching" {
24 | source = "../modules/tf-aws-ssm-patch-mgmt"
25 |
26 | envtype = "${var.envtype}"
27 | scan_maintenance_window_schedule = "cron(0 0 17 ? * SUN *)"
28 | install_maintenance_window_schedule = "cron(0 0 20 ? * SUN *)"
29 | }
30 |
31 | ```
32 |
33 |
34 | Variables
35 | ---------
36 | _Variables marked with [*] are mandatory._
37 |
38 | ###### General variables
39 | - `source` - The source path to the terraform module, see here for further information on the `source` variable. [*]
40 |
41 | - `name` - This value will prefix all resources, and be added as the value for the `Name` tag where supported. [*]
42 |
43 | - `envname` - This label will be added after `name` on all resources, and be added as the value for the `Environment` tag where supported. [*]
44 |
45 | - `envtype` - This label will be added after `envname` on all resources, and be added as the value for the `Envtype` tag where supported. [*]
46 |
47 | ###### Patch baseline variables
48 | - `approved_patches` - An explicit list of approved patches for the SSM baseline. [Default: []]
49 |
50 | - `rejected_patches` - An explicit list of rejected patches for the SSM baseline. [Default: []]
51 |
52 | - `product_versions` - An explicit list of rejected patches for the SSM baseline. [Default: []]
53 |
54 | - `product_versions` - The list of product versions for the SSM baseline. [Default: ["WindowsServer2016", "WindowsServer2012R2"]]
55 |
56 | - `patch_classification` - The list of patch classifications for the SSM baseline. [Default: ["CriticalUpdates", "SecurityUpdates"]]
57 |
58 | - `patch_severity` - The list of patch severities for the SSM baseline. [Default: ["Critical", "Important"]]
59 |
60 | ###### Maintenance Window variables
61 | - `scan_maintenance_window_schedule` - The schedule of the _scan_ Maintenance Window in the form of a cron or rate expression. You can find further information on the cron format here. [Default: "cron(0 0 18 ? * SUN *)"]
62 |
63 | - `install_maintenance_window_schedule` - The schedule of the _install_ Maintenance Window in the form of a cron or rate expression. You can find further information on the cron format here. [Default: "cron(0 0 21 ? * SUN *)"]
64 |
65 | - `maintenance_window_duration` - The duration of the _all_ Maintenance Windows in hours. [Default: "3"]
66 |
67 | - `maintenance_window_cutoff` - The number of hours before the end of any Maintenance Window that Systems Manager stops scheduling new tasks for execution. [Default: "1"]
68 |
69 | - `install_patch_groups` - The list of _install_ patching groups, one target will be created per entry in this list. [Default: ["automatic"]]
70 |
71 | - `scan_patch_groups` - The list of _scan_ patching groups, one target will be created per entry in this list. [Default: ["static", "disposable"]]
72 |
73 |
74 |
75 |
76 | Outputs
77 | ---------
78 | _(None)_
79 |
--------------------------------------------------------------------------------
/iam.tf:
--------------------------------------------------------------------------------
1 | resource "aws_iam_role" "ssm_maintenance_window" {
2 | name = "${var.name}-${var.envname}-${var.envtype}-ssm-mw-role"
3 | path = "/system/"
4 |
5 | assume_role_policy = <