https://github.com/jameswoolfenden/terraform-aws-ssmpatching
A project to set-up SSM patch schedules
https://github.com/jameswoolfenden/terraform-aws-ssmpatching
aws module patching ssm terraform
Last synced: about 1 month ago
JSON representation
A project to set-up SSM patch schedules
- Host: GitHub
- URL: https://github.com/jameswoolfenden/terraform-aws-ssmpatching
- Owner: JamesWoolfenden
- License: apache-2.0
- Created: 2019-01-23T22:19:44.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2022-09-22T14:23:57.000Z (over 3 years ago)
- Last Synced: 2025-10-07T11:46:02.649Z (6 months ago)
- Topics: aws, module, patching, ssm, terraform
- Language: HCL
- Homepage:
- Size: 82 KB
- Stars: 2
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# terraform-aws-ssmpatching

[](https://github.com/JamesWoolfenden/terraform-aws-ssmpatching/releases/latest)
[](https://github.com/JamesWoolfenden/terraform-aws-ssmpatching/releases/latest)

[](https://www.bridgecrew.cloud/link/badge?vcs=github&fullRepo=JamesWoolfenden%2Fterraform-aws-ssmpatching&benchmark=CIS+AWS+V1.2)
[](https://github.com/pre-commit/pre-commit)
[](https://www.checkov.io/)
[](https://www.bridgecrew.cloud/link/badge?vcs=github&fullRepo=JamesWoolfenden%2Fterraform-aws-ssmpatching&benchmark=INFRASTRUCTURE+SECURITY)
Terraform module to provision SSM scheme.
Sets up task and patch window to apply to instances tagged with PatchGroup Key and a set value.
---
It's 100% Open Source and licensed under the [APACHE2](LICENSE).
## Usage
```hcl
module "ssmpatching" {
source = "JamesWoolfenden/ssmpatching/aws"
version = "0.1.7"
common_tags = var.common_tags
patchbaseline_arn_id = var.patchbaseline_arn_id
patchgroup = var.patchgroup
cron = var.cron
task = var.task
}
```
## Requirements
No requirements.
## Providers
| Name | Version |
|------|---------|
| [aws](#provider\_aws) | n/a |
## Modules
No modules.
## Resources
| Name | Type |
|------|------|
| [aws_iam_role.patchaccess](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role) | resource |
| [aws_iam_role_policy.patchaccess](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy) | resource |
| [aws_ssm_maintenance_window.production](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ssm_maintenance_window) | resource |
| [aws_ssm_maintenance_window_target.target](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ssm_maintenance_window_target) | resource |
| [aws_ssm_maintenance_window_task.task](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ssm_maintenance_window_task) | resource |
| [aws_ssm_patch_group.patchgroup](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ssm_patch_group) | resource |
## Inputs
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| [cron](#input\_cron) | The Cron statement to control the patch schedule | `string` | n/a | yes |
| [patchbaseline\_arn\_id](#input\_patchbaseline\_arn\_id) | This is an AWS variable that describe the patch baseline | `string` | n/a | yes |
| [patchgroup](#input\_patchgroup) | A named group of servers to apply tasks to | `string` | n/a | yes |
| [task](#input\_task) | Contains the task details and command | `map` |
{
"name": "commands",
"values": [
"yum update -y; reboot"
]
} | no |
## Outputs
| Name | Description |
|------|-------------|
| [maintenance\_window](#output\_maintenance\_window) | n/a |
| [patchgroup](#output\_patchgroup) | n/a |
| [task](#output\_task) | n/a |
| [window\_target](#output\_window\_target) | n/a |
## Policy
This is the policy required to build this project:
The Terraform resource required is:
```golang
resource "aws_iam_policy" "terraform_pike" {
name_prefix = "terraform_pike"
path = "/"
description = "Pike Autogenerated policy from IAC"
policy = jsonencode({
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"iam:CreateRole",
"iam:DeleteRole",
"iam:DeleteRolePolicy",
"iam:GetRole",
"iam:GetRolePolicy",
"iam:ListAttachedRolePolicies",
"iam:ListInstanceProfilesForRole",
"iam:ListRolePolicies",
"iam:PutRolePolicy"
],
"Resource": "*"
},
{
"Sid": "VisualEditor1",
"Effect": "Allow",
"Action": [
"ssm:CreateMaintenanceWindow",
"ssm:DeleteMaintenanceWindow",
"ssm:DeregisterPatchBaselineForPatchGroup",
"ssm:DeregisterTargetFromMaintenanceWindow",
"ssm:DeregisterTaskFromMaintenanceWindow",
"ssm:DescribeMaintenanceWindowTargets",
"ssm:DescribeMaintenanceWindowTasks",
"ssm:DescribePatchGroups",
"ssm:GetMaintenanceWindow",
"ssm:ListTagsForResource",
"ssm:RegisterPatchBaselineForPatchGroup",
"ssm:RegisterTargetWithMaintenanceWindow",
"ssm:RegisterTaskWithMaintenanceWindow",
"ssm:UpdateMaintenanceWindow"
],
"Resource": "*"
}
]
})
}
```
## Related Projects
Check out these related projects.
- [terraform-aws-s3](https://github.com/jameswoolfenden/terraform-aws-s3) - S3 buckets
## Help
**Got a question?**
File a GitHub [issue](https://github.com/JamesWoolfenden/terraform-aws-ssmpatching/issues).
## Contributing
### Bug Reports & Feature Requests
Please use the [issue tracker](https://github.com/JamesWoolfenden/terraform-aws-ssmpatching/issues) to report any bugs or file feature requests.
## Copyrights
Copyright © 2019-2022 James Woolfenden
## License
[](https://opensource.org/licenses/Apache-2.0)
See [LICENSE](LICENSE) for full details.
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
### Contributors
[![James Woolfenden][jameswoolfenden_avatar]][jameswoolfenden_homepage]
[James Woolfenden][jameswoolfenden_homepage]
[jameswoolfenden_homepage]: https://github.com/jameswoolfenden
[jameswoolfenden_avatar]: https://github.com/jameswoolfenden.png?size=150