aws_ec2_placement_groups resource
Use the aws_ec2_placement_groups InSpec audit resource to test properties of multiple AWS EC2 placement groups.
The AWS::EC2::PlacementGroup resource type specifies a placement group in which to launch instances.
For additional information, including details on parameters and properties, see the AWS documentation on AWS EC2 placement group..
Syntax
Ensure that the placement group exists.
describe aws_ec2_placement_groups do
it { should exist }
end
Parameters
This resource does not require any parameters.
Properties
group_names- The name of the placement group.
Field:
group_namestates- The state of the placement group.
Field:
statestrategies- The placement strategy.
Field:
strategypartition_counts- The number of partitions.
Field:
partition_countgroup_ids- The ID of the placement group.
Field:
group_id- Any tags applied to the placement group.
Field:
tags
Examples
Ensure a placement group name is available:
describe aws_ec2_placement_groups do
its('group_names') { should include 'PLACEMENT_GROUP_NAME' }
end
Ensure that the state is available:
describe aws_ec2_placement_groups do
its('states') { should include 'available' }
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_ec2_placement_groups do
it { should exist }
end
Use should_not to test that an entity does not exist.
describe aws_ec2_placement_groups do
it { should_not exist }
end
be_available
Use should to check if the entity is available.
describe aws_ec2_placement_groups do
it { should be_available }
end
AWS Permissions
Your AWS principal will need the EC2:Client:DescribePlacementGroupsResult action with Effect set to Allow.