aws_db_event_subscription

Provides a DB event subscription resource.

Example Usage

resource "aws_db_instance" "default" {
  allocated_storage    = 10
  engine               = "mysql"
  engine_version       = "5.6.17"
  instance_class       = "db.t2.micro"
  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.id}"]

  event_categories = [
    "availability",
    "deletion",
    "failover",
    "failure",
    "low storage",
    "maintenance",
    "notification",
    "read replica",
    "recovery",
    "restoration",
  ]
}

Argument Reference

The following arguments are supported:

  • 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 or db-cluster-snapshot. 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 mapping of tags to assign to the resource.

Attributes

The following additional atttributes are provided:

  • id - The name of the RDS event notification subscription
  • arn - The Amazon Resource Name of the RDS event notification subscription
  • customer_aws_id - The AWS customer account associated with the RDS event notification subscription

Timeouts

aws_db_event_subscription provides the following Timeouts configuration options:

  • create - (Default 40m) How long to wait for a RDS event notification subscription to be ready.
  • delete - (Default 40m) How long to wait for a RDS event notification subscription to be deleted.
  • update - (Default 40m) How long to wait for a RDS event notification subscription to be updated.

Import

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

$ terraform import aws_db_event_subscription.default rds-event-sub

© 2018 HashiCorp
Licensed under the MPL 2.0 License.
https://www.terraform.io/docs/providers/aws/r/db_event_subscription.html