Skip to main content

aws_ssm_maintenance_window_target Resource

Use the aws_ssm_maintenance_window_target Chef InSpec audit resource to test properties of a single AWS Systems Manager (SSM) maintenance window target.

For additional information, including details on parameters and properties, see the AWS documentation on AWS SSM MaintenanceWindowTarget.

Install

This resource is available in the Chef InSpec AWS resource pack.

For information on configuring your AWS environment for Chef InSpec and creating an InSpec profile that uses the InSpec AWS resource pack, see the Chef InSpec documentation on the AWS cloud platform.

Syntax

Ensure that the maintenance window target exists.

describe aws_ssm_maintenance_window_target(window_id: 'WINDOW_ID', window_target_id: 'WINDOW_TARGET_ID') do
  it { should exist }
end

Parameters

window_id (required)

The ID of the maintenance window to register the target with.

window_task_id (required)

The ID of the target.

Properties

window_id
The ID of the maintenance window to register the target with.
window_target_id
The ID of the target.
resource_type
The type of target that is being registered with the maintenance window.
targets
The targets, either instances or tags.
target_keys
User-defined criteria for sending commands that target instances that meet the criteria.
target_values
User-defined criteria that maps to Key.
owner_information
A user-provided value that will be included in any Amazon CloudWatch Events events that are raised while running tasks for these targets in this maintenance window.
name
The name for the maintenance window target.
description
A description for the target.

Examples

Verify the description of a maintenance window target.

describe aws_ssm_maintenance_window_target(window_id: 'WINDOW_ID', window_target_id: 'WINDOW_TARGET_ID') do
  its('description') { should eq 'MAINTENANCE_TARGET_DESCRIPTION' }
end

Ensure a maintenance window target id is available.

describe aws_ssm_maintenance_window_target(window_id: 'WINDOW_ID', window_target_id: 'WINDOW_TARGET_ID') do
  its('window_target_id') { should eq 'WINDOW_TARGET_ID' }
end

Verify a maintenance resource type is INSTANCE.

describe aws_ssm_maintenance_window_target(window_id: 'WINDOW_ID', window_target_id: 'WINDOW_TARGET_ID') do
  its('resource_type') { should eq 'INSTANCE' }
end

Matchers

For a full list of available matchers, see our Universal Matchers page.

The controls will pass if the describe method returns at least one result.

exist

Use should to test that the entity exists.

describe aws_ssm_maintenance_window_target(window_id: 'WINDOW_ID', window_target_id: 'WINDOW_TARGET_ID') do
  it { should exist }
end

Use should_not to test the entity does not exist.

describe aws_ssm_maintenance_window_target(window_id: 'WINDOW_ID', window_target_id: 'WINDOW_TARGET_ID') do
  it { should_not exist }
end

be_available

Use should to check if the entity is available.

describe aws_ssm_maintenance_window_target(window_id: 'WINDOW_ID', window_target_id: 'WINDOW_TARGET_ID') do
  it { should be_available }
end

AWS Permissions

Your Principal will need the SSM:Client:DescribeMaintenanceWindowTargetsResult action with Effect set to Allow.

Edit this page on GitHub

Thank you for your feedback!

×









Search Results