Skip to main content

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..

Installation

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

See the Chef InSpec documentation on cloud platforms for information on configuring your AWS environment for InSpec and creating an InSpec profile that uses the InSpec AWS resource pack.

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_name

states
The state of the placement group.

Field: state

strategies
The placement strategy.

Field: strategy

partition_counts
The number of partitions.

Field: partition_count

group_ids
The ID of the placement group.

Field: group_id

tags
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

This InSpec audit resource has the following special matchers. For a full list of available matchers, please visit 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 Principal will need the EC2:Client:DescribePlacementGroupsResult action with Effect set to Allow.

Edit this page on GitHub.

Thank you for your feedback!

×









Search Results