Skip to main content

aws_sns_topics Resource

Use the aws_sns_topics InSpec audit resource to test all or a group of the SNS Topic ARNs in an account.

User the ‘aws_sns_topic’ InSpec audit resource to test a single SNS Topic in an account.

For additional information, including details on parameters and properties, see the AWS documentation on SNS.

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

# Get all SNS Topic arns
describe aws_sns_topics do
  its('topic_arns') { should include 'arn:aws:sns:us-east-1:333344445555:MyTopic' }
end

Parameters

This resource does not require any parameters.

Properties

topic_arns
The ARNs of the SNS Topics.
entries
Provides access to the raw results of the query, which can be treated as an array of hashes.

Examples

The following examples show how to use this InSpec audit resource.

Ensure a Topic exists.

describe aws_sns_topics do
  its('topic_arns') { should include 'arn:aws:sns:us-east-1:333344445555:MyTopic' }
end

Matchers

exist

The control will pass if the describe returns at least one result.

Use should_not to test the entity should not exist.

describe aws_sns_topics do
  it { should exist }
end
describe aws_sns_topics do
  it { should_not exist }
end

AWS Permissions

Your Principal will need the SNS:Client:ListTopicsResponse action with Effect set to Allow.

You can find detailed documentation at Actions, Resources, and Condition Keys for Amazon SNS.

Edit this page on GitHub

Thank you for your feedback!

×









Search Results