Skip to main content

aws_cloudfront_cache_policies Resource

[edit on GitHub]

Use the aws_cloudfront_cache_policies InSpec audit resource to test properties of multiple AWS CloudFront cache policies.

The AWS::CloudFront::CachePolicy resource describes the CloudFront cache policy.

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 custom resource exists.

describe aws_cloudfront_cache_policies do
  it { should exist }
end

Parameters

This resource does not require any parameters.

Properties

types
The type for the cache policy.

Field: type

ids
The unique identifier for the cache policy.

Field: id

last_modified_times
The date and time when the cache policy was last modified.

Field: last_modified_time

comments
A comment to describe the cache policy.

Field: comment

names
A unique name to identify the cache policy.

Field: name

default_ttls
The default amount of time, in seconds, that you want objects to stay in the CloudFront cache before CloudFront sends another request to the origin to see if the object has been updated.

Field: default_ttl

max_ttls
The maximum amount of time, in seconds, that objects stay in the CloudFront cache before CloudFront sends another request to the origin to see if the object has been updated.

Field: max_ttl

min_ttls
The minimum amount of time, in seconds, that you want objects to stay in the CloudFront cache before CloudFront sends another request to the origin to see if the object has been updated.

Field: min_ttl

Examples

Test that an ID is available.

describe aws_cloudfront_cache_policies do
  its('ids') { should include 'ID' }
end

Verify the maximum TTL of the policy.

describe aws_cloudfront_cache_policies do
    its('max_ttls') { should include 1 }
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 list method returns at least one result.

exist

Use should to test that the entity exists.

describe aws_cloudfront_cache_policies do
  it { should exist }
end

Use should_not to test the entity does not exist.

describe aws_cloudfront_cache_policies do
  it { should_not exist }
end

AWS Permissions

Your Principal will need the CloudFront:Client:ListCachePoliciesResult action with Effect set to Allow.

Was this page helpful?

×









Search Results