EventSubscription

class EventSubscription : KotlinCustomResource

Provides a DocumentDB event subscription resource.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.docdb.Cluster("example", {
clusterIdentifier: "example",
availabilityZones: [
available.names[0],
available.names[1],
available.names[2],
],
masterUsername: "foo",
masterPassword: "mustbeeightcharaters",
skipFinalSnapshot: true,
});
const exampleTopic = new aws.sns.Topic("example", {name: "example-events"});
const exampleEventSubscription = new aws.docdb.EventSubscription("example", {
name: "example",
enabled: true,
eventCategories: [
"creation",
"failure",
],
sourceType: "db-cluster",
sourceIds: [example.id],
snsTopicArn: exampleTopic.arn,
});
import pulumi
import pulumi_aws as aws
example = aws.docdb.Cluster("example",
cluster_identifier="example",
availability_zones=[
available["names"],
available["names"],
available["names"],
],
master_username="foo",
master_password="mustbeeightcharaters",
skip_final_snapshot=True)
example_topic = aws.sns.Topic("example", name="example-events")
example_event_subscription = aws.docdb.EventSubscription("example",
name="example",
enabled=True,
event_categories=[
"creation",
"failure",
],
source_type="db-cluster",
source_ids=[example.id],
sns_topic_arn=example_topic.arn)
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var example = new Aws.DocDB.Cluster("example", new()
{
ClusterIdentifier = "example",
AvailabilityZones = new[]
{
available.Names[0],
available.Names[1],
available.Names[2],
},
MasterUsername = "foo",
MasterPassword = "mustbeeightcharaters",
SkipFinalSnapshot = true,
});
var exampleTopic = new Aws.Sns.Topic("example", new()
{
Name = "example-events",
});
var exampleEventSubscription = new Aws.DocDB.EventSubscription("example", new()
{
Name = "example",
Enabled = true,
EventCategories = new[]
{
"creation",
"failure",
},
SourceType = "db-cluster",
SourceIds = new[]
{
example.Id,
},
SnsTopicArn = exampleTopic.Arn,
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/docdb"
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/sns"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := docdb.NewCluster(ctx, "example", &docdb.ClusterArgs{
ClusterIdentifier: pulumi.String("example"),
AvailabilityZones: pulumi.StringArray{
available.Names[0],
available.Names[1],
available.Names[2],
},
MasterUsername: pulumi.String("foo"),
MasterPassword: pulumi.String("mustbeeightcharaters"),
SkipFinalSnapshot: pulumi.Bool(true),
})
if err != nil {
return err
}
exampleTopic, err := sns.NewTopic(ctx, "example", &sns.TopicArgs{
Name: pulumi.String("example-events"),
})
if err != nil {
return err
}
_, err = docdb.NewEventSubscription(ctx, "example", &docdb.EventSubscriptionArgs{
Name: pulumi.String("example"),
Enabled: pulumi.Bool(true),
EventCategories: pulumi.StringArray{
pulumi.String("creation"),
pulumi.String("failure"),
},
SourceType: pulumi.String("db-cluster"),
SourceIds: pulumi.StringArray{
example.ID(),
},
SnsTopicArn: exampleTopic.Arn,
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.docdb.Cluster;
import com.pulumi.aws.docdb.ClusterArgs;
import com.pulumi.aws.sns.Topic;
import com.pulumi.aws.sns.TopicArgs;
import com.pulumi.aws.docdb.EventSubscription;
import com.pulumi.aws.docdb.EventSubscriptionArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var example = new Cluster("example", ClusterArgs.builder()
.clusterIdentifier("example")
.availabilityZones(
available.names()[0],
available.names()[1],
available.names()[2])
.masterUsername("foo")
.masterPassword("mustbeeightcharaters")
.skipFinalSnapshot(true)
.build());
var exampleTopic = new Topic("exampleTopic", TopicArgs.builder()
.name("example-events")
.build());
var exampleEventSubscription = new EventSubscription("exampleEventSubscription", EventSubscriptionArgs.builder()
.name("example")
.enabled(true)
.eventCategories(
"creation",
"failure")
.sourceType("db-cluster")
.sourceIds(example.id())
.snsTopicArn(exampleTopic.arn())
.build());
}
}
resources:
example:
type: aws:docdb:Cluster
properties:
clusterIdentifier: example
availabilityZones:
- ${available.names[0]}
- ${available.names[1]}
- ${available.names[2]}
masterUsername: foo
masterPassword: mustbeeightcharaters
skipFinalSnapshot: true
exampleTopic:
type: aws:sns:Topic
name: example
properties:
name: example-events
exampleEventSubscription:
type: aws:docdb:EventSubscription
name: example
properties:
name: example
enabled: true
eventCategories:
- creation
- failure
sourceType: db-cluster
sourceIds:
- ${example.id}
snsTopicArn: ${exampleTopic.arn}

Import

Using pulumi import, import DocumentDB Event Subscriptions using the name. For example:

$ pulumi import aws:docdb/eventSubscription:EventSubscription example event-sub

Properties

Link copied to clipboard
val arn: Output<String>

The Amazon Resource Name of the DocumentDB event notification subscription

Link copied to clipboard
val customerAwsId: Output<String>

The AWS customer account associated with the DocumentDB event notification subscription

Link copied to clipboard
val enabled: Output<Boolean>?

A boolean flag to enable/disable the subscription. Defaults to true.

Link copied to clipboard
val eventCategories: Output<List<String>>?

A list of event categories for a SourceType that you want to subscribe to. See https://docs.aws.amazon.com/documentdb/latest/developerguide/API_Event.html or run aws docdb describe-event-categories.

Link copied to clipboard
val id: Output<String>
Link copied to clipboard
val name: Output<String>

The name of the DocumentDB event subscription. By default generated by this provider.

Link copied to clipboard
val namePrefix: Output<String>

The name of the DocumentDB event subscription. Conflicts with name.

Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val snsTopicArn: Output<String>
Link copied to clipboard
val sourceIds: Output<List<String>>?

A list of identifiers of the event sources for which events will be returned. If not specified, then all sources are included in the response. If specified, a source_type must also be specified.

Link copied to clipboard
val sourceType: Output<String>?

The type of source that will be generating the events. Valid options are db-instance, db-cluster, db-parameter-group, db-security-group,db-cluster-snapshot. If not set, all sources will be subscribed to.

Link copied to clipboard
val tags: Output<Map<String, String>>?

A map of tags to assign to the resource. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

Link copied to clipboard
val tagsAll: Output<Map<String, String>>

A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Link copied to clipboard
val urn: Output<String>