mirror of
https://github.com/inspec/inspec
synced 2024-12-18 00:53:22 +00:00
ab2170f717
* Docs first draft, integration tests, and constructor unit tests for SNS topic Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Skeleton of SNS topic Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Constructor arg validation works Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Passing unit tests for recall Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Subscription Count property, works Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Subscription, not subscriber Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Integration tests pass; also wildard ARNs are not allowed Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Rubocop changes Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Doc updates per kagarmoe Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
58 lines
1.8 KiB
Markdown
58 lines
1.8 KiB
Markdown
---
|
|
title: About the aws_sns_topic Resource
|
|
---
|
|
|
|
# aws_sns_topic
|
|
|
|
Use the `aws_sns_topic` InSpec audit resource to test properties of a single AWS Simple Notification Service Topic. SNS topics are channels for related events. AWS resources will place events in the SNS topic, while other AWS resources will _subscribe_ to receive notifications when new events have appeared.
|
|
|
|
<br>
|
|
|
|
## Syntax
|
|
|
|
# Ensure that a topic exists and has at least one subscription
|
|
describe aws_sns_topic('arn:aws:sns:*::my-topic-name') do
|
|
it { should exist }
|
|
its('confirmed_subscription_count') { should_not be_zero }
|
|
end
|
|
|
|
# You may also use has syntax to pass the ARN
|
|
describe aws_sns_topic(arn: 'arn:aws:sns:*::my-topic-name') do
|
|
it { should exist }
|
|
end
|
|
|
|
|
|
## Resource Parameters
|
|
|
|
### ARN
|
|
|
|
This resource expects a single parameter that uniquely identifes the SNS Topic, an ARN. Amazon Resource Names for SNS topics have the format `arn:aws:sns:region:account-id:topicname`. AWS requires a fully-specified ARN for looking up an SNS topic. The account ID and region are required. Wildcards are not permitted.
|
|
|
|
See also the (AWS documentation on ARNs)[http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html].
|
|
|
|
## Matchers
|
|
|
|
### exist
|
|
|
|
Indicates that the ARN provided was found. Use should_not to test for SNS topics that should not exist.
|
|
|
|
# Expect good news
|
|
describe aws_sns_topic('arn:aws:sns:*::good-news') do
|
|
it { should exist }
|
|
end
|
|
|
|
# No bad news allowed
|
|
describe aws_sns_topic('arn:aws:sns:*::bad-news') do
|
|
it { should_not exist }
|
|
end
|
|
|
|
## Properties
|
|
|
|
### confirmed_subscription_count
|
|
|
|
An integer indicating the number of currently active subscriptions.
|
|
|
|
# Make sure someone is listening
|
|
describe aws_sns_topic('arn:aws:sns:*::my-topic-name') do
|
|
its('confirmed_subscription_count') { should_not be_zero}
|
|
end
|