Provides an RDS security group resource. This is only for DB instances in the EC2-Classic Platform. For instances inside a VPC, use the aws_db_instance.vpc_security_group_ids attribute instead.

Example Usage

resource "aws_db_security_group" "default" {
  name = "rds_sg"

  ingress {
    cidr = ""

Argument Reference

The following arguments are supported:

  • name - (Required) The name of the DB security group.
  • description - (Optional) The description of the DB security group. Defaults to "Managed by Terraform".
  • ingress - (Required) A list of ingress rules.
  • tags - (Optional) A mapping of tags to assign to the resource.

Ingress blocks support the following:

Attributes Reference

In addition to all arguments above, the following attributes are exported:

  • id - The db security group ID.
  • arn - The arn of the DB security group.


DB Security groups can be imported using the name, e.g.

$ terraform import aws_db_security_group.default aws_rds_sg-1

© 2018 HashiCorpLicensed under the MPL 2.0 License.