aws_ssm_maintenance_window_targets resource
Use the aws_ssm_maintenance_window_targets InSpec audit resource to test properties of multiple AWS Systems Manager (SSM) maintenance window targets.
For additional information, including details on parameters and properties, see the AWS documentation on AWS SSM MaintenanceWindowTarget.
Syntax
Ensure that a maintenance window target exists.
describe aws_ssm_maintenance_window_targets(window_id: 'WINDOW_ID') do
it { should exist }
end
Parameters
window_id(required)The ID of the maintenance window to register the target with.
Properties
window_ids- The ID of the maintenance window to register the target with.
Field:
window_idwindow_target_ids- The ID of the target.
Field:
window_target_idresource_types- The type of target that is being registered with the maintenance window.
Field:
resource_typetargets- The targets, either instances or tags.
Field:
targetsowner_informations- 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.
Field:
owner_informationnames- The name for the maintenance window target.
Field:
namedescriptions- A description for the target.
Field:
description
Examples
Verify that the maintenance window target description exists:
describe aws_ssm_maintenance_window_targets(window_id: 'WINDOW_ID') do
its('descriptions') { should include 'MAINTENANCE_TARGET_DESCRIPTION' }
end
Ensure a maintenance window target ID is available:
describe aws_ssm_maintenance_window_targets(window_id: 'WINDOW_ID') do
its('window_target_ids') { should include 'WINDOW_TARGET_ID' }
end
Verify a maintenance resource type is INSTANCE:
describe aws_ssm_maintenance_window_targets(window_id: 'WINDOW_ID') do
its('resource_types') { should include '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_targets(window_id: 'WINDOW_ID') do
it { should exist }
end
Use should_not to test the entity does not exist.
describe aws_ssm_maintenance_window_targets(window_id: 'WINDOW_ID') do
it { should_not exist }
end
be_available
Use should to check if the entity is available.
describe aws_ssm_maintenance_window_targets(window_id: 'WINDOW_ID') do
it { should be_available }
end
AWS Permissions
Your AWS principal will need the SSM:Client:DescribeMaintenanceWindowTargetsResult action with Effect set to Allow.