terraform-aws-ssmpatching

terraform-aws-ssmpatching

Verify and Bump Latest Release GitHub tag (latest SemVer) Terraform VersionInfrastructure Tests pre-commit checkov Infrastructure Tests

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.

Usage

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 n/a

Modules

No modules.

Resources

Name Type
aws_iam_role.patchaccess resource
aws_iam_role_policy.patchaccess resource
aws_ssm_maintenance_window.production resource
aws_ssm_maintenance_window_target.target resource
aws_ssm_maintenance_window_task.task resource
aws_ssm_patch_group.patchgroup resource

Inputs

Name Description Type Default Required
cron The Cron statement to control the patch schedule string n/a yes
patchbaseline_arn_id This is an AWS variable that describe the patch baseline string n/a yes
patchgroup A named group of servers to apply tasks to string n/a yes
task Contains the task details and command map
{
"name": "commands",
"values": [
"yum update -y; reboot"
]
}
no

Outputs

Name Description
maintenance_window n/a
patchgroup n/a
task n/a
window_target n/a

Policy

This is the policy required to build this project:

The Terraform resource required is:

resource "aws_iam_policy" "terraform_pike" {
  name_prefix = "terraform_pike"
  path        = "https://github.com/"
  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.

Help

Got a question?

File a GitHub issue.

Contributing

Bug Reports & Feature Requests

Please use the issue tracker to report any bugs or file feature requests.

Copyrights

Copyright © 2019-2022 James Woolfenden

License

License

See 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

https://www.apache.org/licenses/LICENSE-2.0

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
James Woolfenden

Visit original content creator repository https://github.com/JamesWoolfenden/terraform-aws-ssmpatching

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *