Skip to content

Resource: awsDocdbEventSubscription

Provides a DB event subscription 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";
const awsDocdbClusterExample = new aws.docdbCluster.DocdbCluster(
  this,
  "example",
  {
    availabilityZones: [
      "${data.aws_availability_zones.available.names[0]}",
      "${data.aws_availability_zones.available.names[1]}",
      "${data.aws_availability_zones.available.names[2]}",
    ],
    clusterIdentifier: "example",
    masterPassword: "mustbeeightcharaters",
    masterUsername: "foo",
    skipFinalSnapshot: true,
  }
);
const awsSnsTopicExample = new aws.snsTopic.SnsTopic(this, "example_1", {
  name: "example-events",
});
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
awsSnsTopicExample.overrideLogicalId("example");
const awsDocdbEventSubscriptionExample =
  new aws.docdbEventSubscription.DocdbEventSubscription(this, "example_2", {
    enabled: true,
    eventCategories: ["creation", "failure"],
    name: "example",
    snsTopicArn: awsSnsTopicExample.arn,
    sourceIds: [awsDocdbClusterExample.id],
    sourceType: "db-cluster",
  });
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
awsDocdbEventSubscriptionExample.overrideLogicalId("example");

Argument Reference

The following arguments are supported:

  • name - (Optional) The name of the DocDB event subscription. By default generated by Terraform.
  • namePrefix - (Optional) The name of the DocDB event subscription. Conflicts with name.
  • snsTopic - (Required) The SNS topic to send events to.
  • sourceIds - (Optional) 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.
  • sourceType - (Optional) The type of source that will be generating the events. Valid options are dbInstance, dbCluster, dbParameterGroup, dbSecurityGroup,dbClusterSnapshot. If not set, all sources will be subscribed to.
  • eventCategories - (Optional) 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 awsDocdbDescribeEventCategories.
  • enabled - (Optional) A boolean flag to enable/disable the subscription. Defaults to true.
  • tags - (Optional) A map of tags to assign to the resource. If configured with a provider defaultTags 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 name of the DocDB event notification subscription
  • arn - The Amazon Resource Name of the DocDB event notification subscription
  • customerAwsId - The AWS customer account associated with the DocDB event notification subscription
  • tagsAll - A map of tags assigned to the resource, including those inherited from the provider defaultTags configuration block.

Timeouts

Configuration options:

  • create - (Default 40M)
  • delete - (Default 40M)
  • update - (Default 40M)

Import

DocDB Event Subscriptions can be imported using the name, e.g.,

$ terraform import aws_docdb_event_subscription.example event-sub