opentofu/website/source/docs/providers/aws/r/db_security_group.html.markdown
stack72 91596b4a71
provider/aws: Support Import of aws_db_security_group
This test overrides the AWS_DEFAULT_REGION parameter as the security
groups are created in us-east-1 (due to classic VPC requirements)

```
% make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSDBSecurityGroup_importBasic'
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /terraform/vendor/)
TF_ACC=1 go test ./builtin/providers/aws -v
-run=TestAccAWSDBSecurityGroup_importBasic -timeout 120m
=== RUN   TestAccAWSDBSecurityGroup_importBasic
--- PASS: TestAccAWSDBSecurityGroup_importBasic (49.46s)
PASS
ok      github.com/hashicorp/terraform/builtin/providers/aws    49.487s
```
2016-08-02 01:42:54 +10:00

1.5 KiB

layout page_title sidebar_current description
aws AWS: aws_db_security_group docs-aws-resource-db-security-group Provides an RDS security group resource.

aws_db_security_group

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 = "10.0.0.0/24"
    }
}

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:

  • cidr - The CIDR block to accept
  • security_group_name - The name of the security group to authorize
  • security_group_id - The ID of the security group to authorize
  • security_group_owner_id - The owner Id of the security group provided by security_group_name.

Attributes Reference

The following attributes are exported:

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

Import

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

$ terraform import aws_db_security_group.default aws_rds_sg-1