Provides a DB event subscription resource.
resource "aws_db_instance" "default" {
allocated_storage = 10
engine = "mysql"
engine_version = "5.6.17"
instance_class = "db.t2.micro"
db_name = "mydb"
username = "foo"
password = "bar"
db_subnet_group_name = "my_database_subnet_group"
parameter_group_name = "default.mysql5.6"
}
resource "aws_sns_topic" "default" {
name = "rds-events"
}
resource "aws_db_event_subscription" "default" {
name = "rds-event-sub"
sns_topic = aws_sns_topic.default.arn
source_type = "db-instance"
source_ids = [aws_db_instance.default.identifier]
event_categories = [
"availability",
"deletion",
"failover",
"failure",
"low storage",
"maintenance",
"notification",
"read replica",
"recovery",
"restoration",
]
}
This resource supports the following arguments:
name
- (Optional) The name of the DB event subscription. By default generated by Terraform.name_prefix
- (Optional) The name of the DB event subscription. Conflicts with name
.sns_topic
- (Required) 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
, db-cluster-snapshot
, or db-proxy
. If not set, all sources will be subscribed to.event_categories
- (Optional) A list of event categories for a SourceType that you want to subscribe to. See http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_Events.html or run aws rds describe-event-categories
.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 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 RDS event notification subscriptionarn
- The Amazon Resource Name of the RDS event notification subscriptioncustomer_aws_id
- The AWS customer account associated with the RDS event notification subscriptiontags_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 DB Event Subscriptions using the name
. For example:
import {
to = aws_db_event_subscription.default
id = "rds-event-sub"
}
Using terraform import
, import DB Event Subscriptions using the name
. For example:
% terraform import aws_db_event_subscription.default rds-event-sub