provider/aws: ElastiCache enhancements

- request cache node info
- read after create, to populate nodes
This commit is contained in:
Clint Shryock 2015-05-14 11:10:21 -05:00
parent 6f3ce6bf3c
commit a552db0c8c
1 changed files with 6 additions and 5 deletions

View File

@ -161,13 +161,14 @@ func resourceAwsElasticacheClusterCreate(d *schema.ResourceData, meta interface{
d.SetId(clusterId)
return nil
return resourceAwsElasticacheClusterRead(d, meta)
}
func resourceAwsElasticacheClusterRead(d *schema.ResourceData, meta interface{}) error {
conn := meta.(*AWSClient).elasticacheconn
req := &elasticache.DescribeCacheClustersInput{
CacheClusterID: aws.String(d.Id()),
CacheClusterID: aws.String(d.Id()),
ShowCacheNodeInfo: aws.Boolean(true),
}
res, err := conn.DescribeCacheClusters(req)
@ -210,9 +211,9 @@ func setCacheNodeData(d *schema.ResourceData, c *elasticache.CacheCluster) error
return fmt.Errorf("Unexpected nil pointer in: %#v", node)
}
cacheNodeData = append(cacheNodeData, map[string]interface{}{
"id": node.CacheNodeID,
"address": node.Endpoint.Address,
"port": node.Endpoint.Port,
"id": *node.CacheNodeID,
"address": *node.Endpoint.Address,
"port": int(*node.Endpoint.Port),
})
}