Skip to content

Commit

Permalink
Merge branch 'elasticache-cluster-import' of https://github.com/AMeng…
Browse files Browse the repository at this point in the history
…/terraform into AMeng-elasticache-cluster-import
  • Loading branch information
stack72 committed Sep 23, 2016
2 parents a8a1f6d + 01cfeb8 commit cea6850
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 1 deletion.
33 changes: 33 additions & 0 deletions builtin/providers/aws/import_aws_elasticache_cluster_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package aws

import (
"os"
"testing"

"github.com/hashicorp/terraform/helper/resource"
)

func TestAccAWSElasticacheCluster_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_elasticache_cluster.bar"

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckAWSElasticacheClusterDestroy,
Steps: []resource.TestStep{
resource.TestStep{
Config: testAccAWSElasticacheClusterConfig,
},

resource.TestStep{
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
},
},
})
}
3 changes: 3 additions & 0 deletions builtin/providers/aws/resource_aws_elasticache_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,9 @@ func resourceAwsElasticacheCluster() *schema.Resource {
Read: resourceAwsElasticacheClusterRead,
Update: resourceAwsElasticacheClusterUpdate,
Delete: resourceAwsElasticacheClusterDelete,
Importer: &schema.ResourceImporter{
State: schema.ImportStatePassthrough,
},

Schema: resourceSchema,
}
Expand Down
2 changes: 1 addition & 1 deletion website/source/docs/import/importability.html.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ To make a resource importable, please see the
* aws_eip
* aws_elastic_beanstalk_application
* aws_elastic_beanstalk_environment
* aws_elasticache_cluster
* aws_elasticache_parameter_group
* aws_elasticache_subnet_group
* aws_elb
Expand Down Expand Up @@ -149,4 +150,3 @@ To make a resource importable, please see the
* triton_key
* triton_machine
* triton_vlan

Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,12 @@ The following attributes are exported:

[1]: https://docs.aws.amazon.com/AmazonElastiCache/latest/APIReference/API_ModifyCacheCluster.html
[2]: https://docs.aws.amazon.com/fr_fr/AmazonElastiCache/latest/UserGuide/Clusters.Modify.html


## Import

ElastiCache Clusters can be imported using the `cluster_id`, e.g.

```
$ terraform import aws_elasticache_cluster.my_cluster my_cluster
```

0 comments on commit cea6850

Please sign in to comment.