Merge pull request #7896 from hashicorp/import-aws-redshiftsg
provider/aws: Support Import of `aws_redshift_security_group`
This commit is contained in:
commit
acb6fb5422
|
@ -0,0 +1,33 @@
|
||||||
|
package aws
|
||||||
|
|
||||||
|
import (
|
||||||
|
"os"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"github.com/hashicorp/terraform/helper/resource"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestAccAWSRedshiftSecurityGroup_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_redshift_security_group.bar"
|
||||||
|
|
||||||
|
resource.Test(t, resource.TestCase{
|
||||||
|
PreCheck: func() { testAccPreCheck(t) },
|
||||||
|
Providers: testAccProviders,
|
||||||
|
CheckDestroy: testAccCheckAWSRedshiftSecurityGroupDestroy,
|
||||||
|
Steps: []resource.TestStep{
|
||||||
|
resource.TestStep{
|
||||||
|
Config: testAccAWSRedshiftSecurityGroupConfig_ingressCidr,
|
||||||
|
},
|
||||||
|
|
||||||
|
resource.TestStep{
|
||||||
|
ResourceName: resourceName,
|
||||||
|
ImportState: true,
|
||||||
|
ImportStateVerify: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
|
@ -22,6 +22,9 @@ func resourceAwsRedshiftSecurityGroup() *schema.Resource {
|
||||||
Read: resourceAwsRedshiftSecurityGroupRead,
|
Read: resourceAwsRedshiftSecurityGroupRead,
|
||||||
Update: resourceAwsRedshiftSecurityGroupUpdate,
|
Update: resourceAwsRedshiftSecurityGroupUpdate,
|
||||||
Delete: resourceAwsRedshiftSecurityGroupDelete,
|
Delete: resourceAwsRedshiftSecurityGroupDelete,
|
||||||
|
Importer: &schema.ResourceImporter{
|
||||||
|
State: resourceAwsRedshiftClusterImport,
|
||||||
|
},
|
||||||
|
|
||||||
Schema: map[string]*schema.Schema{
|
Schema: map[string]*schema.Schema{
|
||||||
"name": &schema.Schema{
|
"name": &schema.Schema{
|
||||||
|
|
|
@ -43,3 +43,10 @@ The following attributes are exported:
|
||||||
|
|
||||||
* `id` - The Redshift security group ID.
|
* `id` - The Redshift security group ID.
|
||||||
|
|
||||||
|
## Import
|
||||||
|
|
||||||
|
Redshift security groups can be imported using the `name`, e.g.
|
||||||
|
|
||||||
|
```
|
||||||
|
$ terraform import aws_redshift_security_group.testgroup1 redshift_test_group
|
||||||
|
```
|
||||||
|
|
Loading…
Reference in New Issue