aws_ssm_maintenance_window_task

Provides an SSM Maintenance Window Task resource

Example Usage

resource "aws_ssm_maintenance_window" "window" {
  name = "maintenance-window-%s"
  schedule = "cron(0 16 ? * TUE *)"
  duration = 3
  cutoff = 1
}

resource "aws_ssm_maintenance_window_task" "task" {
  window_id = "${aws_ssm_maintenance_window.window.id}"
  task_type = "RUN_COMMAND"
  task_arn = "AWS-RunShellScript"
  priority = 1
  service_role_arn = "arn:aws:iam::187416307283:role/service-role/AWS_Events_Invoke_Run_Command_112316643"
  max_concurrency = "2"
  max_errors = "1"
  targets {
    key = "InstanceIds"
    values = ["${aws_instance.instance.id}"]
  }
  task_parameters {
    name = "commands"
    values = ["pwd"]
  }
}

resource "aws_instance" "instance" {
  ami = "ami-4fccb37f"

  instance_type = "m1.small"
}

Argument Reference

The following arguments are supported:

  • window_id - (Required) The Id of the maintenance window to register the task with.
  • max_concurrency - (Required) The maximum number of targets this task can be run for in parallel.
  • max_errors - (Required) The maximum number of errors allowed before this task stops being scheduled.
  • task_type - (Required) The type of task being registered. The only allowed value is RUN_COMMAND.
  • task_arn - (Required) The ARN of the task to execute.
  • service_role_arn - (Required) The role that should be assumed when executing the task.
  • targets - (Required) The targets (either instances or window target ids). Instances are specified using Key=InstanceIds,Values=instanceid1,instanceid2. Window target ids are specified using Key=WindowTargetIds,Values=window target id1, window target id2.
  • priority - (Optional) The priority of the task in the Maintenance Window, the lower the number the higher the priority. Tasks in a Maintenance Window are scheduled in priority order with tasks that have the same priority scheduled in parallel.
  • logging_info - (Optional) A structure containing information about an Amazon S3 bucket to write instance-level logs to. Documented below.
  • task_parameters - (Optional) A structure containing information about parameters required by the particular task_arn. Documented below.

logging_info supports the following:

task_parameters supports the following:

Attributes Reference

In addition to all arguments above, the following attributes are exported:

  • id - The ID of the maintenance window task.

© 2018 HashiCorp
Licensed under the MPL 2.0 License.
https://www.terraform.io/docs/providers/aws/r/ssm_maintenance_window_task.html