Merge pull request #7895 from hashicorp/import-aws-dbsg
provider/aws: Support Import of `aws_db_security_group`
This commit is contained in:
commit
6bd3712f03
|
@ -0,0 +1,33 @@
|
||||||
|
package aws
|
||||||
|
|
||||||
|
import (
|
||||||
|
"os"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"github.com/hashicorp/terraform/helper/resource"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestAccAWSDBSecurityGroup_importBasic(t *testing.T) {
|
||||||
|
oldvar := os.Getenv("AWS_DEFAULT_REGION")
|
||||||
|
os.Setenv("AWS_DEFAULT_REGION", "us-east-1")
|
||||||
|
defer os.Setenv("AWS_DEFAULT_REGION", oldvar)
|
||||||
|
|
||||||
|
resourceName := "aws_db_security_group.bar"
|
||||||
|
|
||||||
|
resource.Test(t, resource.TestCase{
|
||||||
|
PreCheck: func() { testAccPreCheck(t) },
|
||||||
|
Providers: testAccProviders,
|
||||||
|
CheckDestroy: testAccCheckAWSDBSecurityGroupDestroy,
|
||||||
|
Steps: []resource.TestStep{
|
||||||
|
resource.TestStep{
|
||||||
|
Config: testAccAWSDBSecurityGroupConfig,
|
||||||
|
},
|
||||||
|
|
||||||
|
resource.TestStep{
|
||||||
|
ResourceName: resourceName,
|
||||||
|
ImportState: true,
|
||||||
|
ImportStateVerify: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
|
@ -23,6 +23,9 @@ func resourceAwsDbSecurityGroup() *schema.Resource {
|
||||||
Read: resourceAwsDbSecurityGroupRead,
|
Read: resourceAwsDbSecurityGroupRead,
|
||||||
Update: resourceAwsDbSecurityGroupUpdate,
|
Update: resourceAwsDbSecurityGroupUpdate,
|
||||||
Delete: resourceAwsDbSecurityGroupDelete,
|
Delete: resourceAwsDbSecurityGroupDelete,
|
||||||
|
Importer: &schema.ResourceImporter{
|
||||||
|
State: schema.ImportStatePassthrough,
|
||||||
|
},
|
||||||
|
|
||||||
Schema: map[string]*schema.Schema{
|
Schema: map[string]*schema.Schema{
|
||||||
"arn": &schema.Schema{
|
"arn": &schema.Schema{
|
||||||
|
|
|
@ -49,3 +49,11 @@ The following attributes are exported:
|
||||||
* `id` - The db security group ID.
|
* `id` - The db security group ID.
|
||||||
* `arn` - The arn of the DB security group.
|
* `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
|
||||||
|
```
|
||||||
|
|
|
@ -95,7 +95,7 @@ this instance is a read replica
|
||||||
|
|
||||||
## Import
|
## Import
|
||||||
|
|
||||||
Redshift Cluster Instances can be imported using the `identifier`, e.g.
|
RDS Cluster Instances can be imported using the `identifier`, e.g.
|
||||||
|
|
||||||
```
|
```
|
||||||
$ terraform import aws_rds_cluster_instance.prod_instance_1 aurora-cluster-instance-1
|
$ terraform import aws_rds_cluster_instance.prod_instance_1 aurora-cluster-instance-1
|
||||||
|
|
|
@ -56,7 +56,7 @@ The following attributes are exported:
|
||||||
|
|
||||||
## Import
|
## Import
|
||||||
|
|
||||||
Redshift Clusters can be imported using the `name`, e.g.
|
RDS Cluster Parameter Groups can be imported using the `name`, e.g.
|
||||||
|
|
||||||
```
|
```
|
||||||
$ terraform import aws_rds_cluster_parameter_group.cluster_pg production-pg-1
|
$ terraform import aws_rds_cluster_parameter_group.cluster_pg production-pg-1
|
||||||
|
|
Loading…
Reference in New Issue