provider/aws: Support Import aws_elasticache_cluster

This commit is contained in:
AMeng 2016-08-19 11:10:57 -06:00
parent 3af67964dc
commit eff11efff3
4 changed files with 41 additions and 1 deletions

View File

@ -0,0 +1,28 @@
package aws
import (
"testing"
"github.com/hashicorp/terraform/helper/resource"
)
func TestAccAWSElasticacheCluster_importBasic(t *testing.T) {
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,
},
},
})
}

View File

@ -200,6 +200,9 @@ func resourceAwsElasticacheCluster() *schema.Resource {
Read: resourceAwsElasticacheClusterRead,
Update: resourceAwsElasticacheClusterUpdate,
Delete: resourceAwsElasticacheClusterDelete,
Importer: &schema.ResourceImporter{
State: schema.ImportStatePassthrough,
},
Schema: resourceSchema,
}

View File

@ -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
@ -149,4 +150,3 @@ To make a resource importable, please see the
* triton_key
* triton_machine
* triton_vlan

View File

@ -119,3 +119,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
```