Resource: awsSnsTopic
Provides an SNS topic resource
Example Usage
/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
new aws.snsTopic.SnsTopic(this, "user_updates", {
name: "user-updates-topic",
});
Example with Delivery Policy
/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
new aws.snsTopic.SnsTopic(this, "user_updates", {
deliveryPolicy:
'{\n "http": {\n "defaultHealthyRetryPolicy": {\n "minDelayTarget": 20,\n "maxDelayTarget": 20,\n "numRetries": 3,\n "numMaxDelayRetries": 0,\n "numNoDelayRetries": 0,\n "numMinDelayRetries": 0,\n "backoffFunction": "linear"\n },\n "disableSubscriptionOverrides": false,\n "defaultThrottlePolicy": {\n "maxReceivesPerSecond": 1\n }\n }\n}\n',
name: "user-updates-topic",
});
Example with Server-side encryption (SSE)
/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
new aws.snsTopic.SnsTopic(this, "user_updates", {
kmsMasterKeyId: "alias/aws/sns",
name: "user-updates-topic",
});
Example with First-In-First-Out (FIFO)
/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
new aws.snsTopic.SnsTopic(this, "user_updates", {
contentBasedDeduplication: true,
fifoTopic: true,
name: "user-updates-topic.fifo",
});
Message Delivery Status Arguments
The <endpoint>SuccessFeedbackRoleArn
and <endpoint>FailureFeedbackRoleArn
arguments are used to give Amazon SNS write access to use CloudWatch Logs on your behalf. The <endpoint>SuccessFeedbackSampleRate
argument is for specifying the sample rate percentage (0-100) of successfully delivered messages. After you configure the <endpoint>FailureFeedbackRoleArn
argument, then all failed message deliveries generate CloudWatch Logs.
Argument Reference
The following arguments are supported:
name
- (Optional) The name of the topic. Topic names must be made up of only uppercase and lowercase ASCII letters, numbers, underscores, and hyphens, and must be between 1 and 256 characters long. For a FIFO (first-in-first-out) topic, the name must end with thefifo
suffix. If omitted, Terraform will assign a random, unique name. Conflicts withnamePrefix
namePrefix
- (Optional) Creates a unique name beginning with the specified prefix. Conflicts withname
displayName
- (Optional) The display name for the topicpolicy
- (Optional) The fully-formed AWS policy as JSON. For more information about building AWS IAM policy documents with Terraform, see the AWS IAM Policy Document Guide.deliveryPolicy
- (Optional) The SNS delivery policy. More on AWS documentationapplicationSuccessFeedbackRoleArn
- (Optional) The IAM role permitted to receive success feedback for this topicapplicationSuccessFeedbackSampleRate
- (Optional) Percentage of success to sampleapplicationFailureFeedbackRoleArn
- (Optional) IAM role for failure feedbackhttpSuccessFeedbackRoleArn
- (Optional) The IAM role permitted to receive success feedback for this topichttpSuccessFeedbackSampleRate
- (Optional) Percentage of success to samplehttpFailureFeedbackRoleArn
- (Optional) IAM role for failure feedbackkmsMasterKeyId
- (Optional) The ID of an AWS-managed customer master key (CMK) for Amazon SNS or a custom CMK. For more information, see Key TermssignatureVersion
- (Optional) IfsignatureVersion
should be 1 (SHA1) or 2 (SHA256). The signature version corresponds to the hashing algorithm used while creating the signature of the notifications, subscription confirmations, or unsubscribe confirmation messages sent by Amazon SNS.tracingConfig
- (Optional) Tracing mode of an Amazon SNS topic. Valid values:"passThrough"
,"active"
.fifoTopic
- (Optional) Boolean indicating whether or not to create a FIFO (first-in-first-out) topic (default isfalse
).contentBasedDeduplication
- (Optional) Enables content-based deduplication for FIFO topics. For more information, see the related documentationlambdaSuccessFeedbackRoleArn
- (Optional) The IAM role permitted to receive success feedback for this topiclambdaSuccessFeedbackSampleRate
- (Optional) Percentage of success to samplelambdaFailureFeedbackRoleArn
- (Optional) IAM role for failure feedbacksqsSuccessFeedbackRoleArn
- (Optional) The IAM role permitted to receive success feedback for this topicsqsSuccessFeedbackSampleRate
- (Optional) Percentage of success to samplesqsFailureFeedbackRoleArn
- (Optional) IAM role for failure feedbackfirehoseSuccessFeedbackRoleArn
- (Optional) The IAM role permitted to receive success feedback for this topicfirehoseSuccessFeedbackSampleRate
- (Optional) Percentage of success to samplefirehoseFailureFeedbackRoleArn
- (Optional) IAM role for failure feedbacktags
- (Optional) Key-value map of resource tags. If configured with a providerdefaultTags
configuration block present, tags with matching keys will overwrite those defined at the provider-level.
Attributes Reference
In addition to all arguments above, the following attributes are exported:
id
- The ARN of the SNS topicarn
- The ARN of the SNS topic, as a more obvious property (clone of id)owner
- The AWS Account ID of the SNS topic ownertagsAll
- A map of tags assigned to the resource, including those inherited from the providerdefaultTags
configuration block.
Import
SNS Topics can be imported using the topicArn
, e.g.,