resource "aws_neptune_cluster" "default" {
cluster_identifier = "neptune-cluster-demo"
engine = "neptune"
backup_retention_period = 5
preferred_backup_window = "07:00-09:00"
skip_final_snapshot = true
iam_database_authentication_enabled = "true"
apply_immediately = "true"
}
resource "aws_neptune_cluster_instance" "example" {
cluster_identifier = aws_neptune_cluster.default.id
engine = "neptune"
instance_class = "db.r4.large"
apply_immediately = "true"
}
resource "aws_sns_topic" "default" {
name = "neptune-events"
}
resource "aws_neptune_event_subscription" "default" {
name = "neptune-event-sub"
sns_topic_arn = aws_sns_topic.default.arn
source_type = "db-instance"
source_ids = [aws_neptune_cluster_instance.example.id]
event_categories = [
"maintenance",
"availability",
"creation",
"backup",
"restoration",
"recovery",
"deletion",
"failover",
"failure",
"notification",
"configuration change",
"read replica",
]
tags = {
env = "test"
}
}
This resource supports the following arguments:
enabled
- (Optional) A boolean flag to enable/disable the subscription. Defaults to true.event_categories
- (Optional) A list of event categories for a source_type
that you want to subscribe to. Run aws neptune describe-event-categories
to find all the event categories.name
- (Optional) The name of the Neptune event subscription. By default generated by Terraform.name_prefix
- (Optional) The name of the Neptune event subscription. Conflicts with name
.sns_topic_arn
- (Required) The ARN of the SNS topic to send events to.source_ids
- (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.source_type
- (Optional) The type of source that will be generating the events. Valid options are db-instance
, db-security-group
, db-parameter-group
, db-snapshot
, db-cluster
or db-cluster-snapshot
. If not set, all sources will be subscribed to.tags
- (Optional) 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.This resource exports the following attributes in addition to the arguments above:
id
- The name of the Neptune event notification subscription.arn
- The Amazon Resource Name of the Neptune event notification subscription.customer_aws_id
- The AWS customer account associated with the Neptune event notification subscription.tags_all
- A map of tags assigned to the resource, including those inherited from the provider default_tags
configuration block.create
- (Default 40m
)delete
- (Default 40m
)update
- (Default 40m
)In Terraform v1.5.0 and later, use an import
block to import aws_neptune_event_subscription
using the event subscription name. For example:
import {
to = aws_neptune_event_subscription.example
id = "my-event-subscription"
}
Using terraform import
, import aws_neptune_event_subscription
using the event subscription name. For example:
% terraform import aws_neptune_event_subscription.example my-event-subscription