aws_cloudfront_origin_access_identity Resource
Use the aws_cloudfront_origin_access_identity
InSpec audit resource to test properties of a single specific AWS CloudFront origin access identity.
An origin access identity is a special CloudFront user that you can associate with Amazon S3 origins, so that you can secure all or just some of your Amazon S3 content.
For additional information, including details on parameters and properties, see the AWS documentation on AWS CloudFront CloudFrontOriginAccessIdentity..
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 identity exists.
describe aws_cloudfront_origin_access_identity(id: 'ID') do
it { should exist }
end
Parameters
id
(required)The ID for the origin access identity.
Properties
id
- The ID for the origin access identity.
s3_canonical_user_id
- The Amazon S3 canonical user ID for the origin access identity, used when giving the origin access identity read permission to an object in Amazon S3.
cloud_front_origin_access_identity_config.caller_reference
- A unique value (for example, a date-time stamp) that ensures that the request can’t be replayed.
cloud_front_origin_access_identity_config.comment
- A comment to describe the origin access identity.
Examples
Test that an ID is available.
describe aws_cloudfront_origin_access_identity(id: 'ID') do
its('id') { should eq 'ID' }
end
Test that an s3 canonical user ID is available.
describe aws_cloudfront_origin_access_identity(id: 'ID') do
its('s3_canonical_user_id') { should eq 'S3_CANONICAL_USER_ID' }
end
Matchers
For a full list of available matchers, see our Universal Matchers page.This resource has the following special matchers.
exist
Use should
to test that the entity exists.
describe aws_cloudfront_origin_access_identity(id: 'ID') do
it { should exist }
end
Use should_not
to test the entity does not exist.
describe aws_cloudfront_origin_access_identity(id: 'ID') do
it { should_not exist }
end
be_available
Use should
to check if the entity is available.
describe aws_cloudfront_origin_access_identity(id: 'ID') do
it { should be_available }
end
AWS Permissions
Your Principal will need the CloudFront:Client:GetCloudFrontOriginAccessIdentityResult
action with Effect
set to Allow
.