Merge pull request #2642 from hashicorp/f-aws-elasticache-maintenance-window

provider/aws: Add maintenance window to ElastiCache cluster
This commit is contained in:
Clint 2015-07-08 13:10:32 -06:00
commit b169a53786
2 changed files with 19 additions and 0 deletions

View File

@ -58,6 +58,11 @@ func resourceAwsElasticacheCluster() *schema.Resource {
Optional: true,
Computed: true,
},
"maintenance_window": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Computed: true,
},
"subnet_group_name": &schema.Schema{
Type: schema.TypeString,
Optional: true,
@ -170,6 +175,10 @@ func resourceAwsElasticacheClusterCreate(d *schema.ResourceData, meta interface{
req.CacheParameterGroupName = aws.String(v.(string))
}
if v, ok := d.GetOk("maintenance_window"); ok {
req.PreferredMaintenanceWindow = aws.String(v.(string))
}
snaps := d.Get("snapshot_arns").(*schema.Set).List()
if len(snaps) > 0 {
s := expandStringList(snaps)
@ -229,6 +238,7 @@ func resourceAwsElasticacheClusterRead(d *schema.ResourceData, meta interface{})
d.Set("security_group_names", c.CacheSecurityGroups)
d.Set("security_group_ids", c.SecurityGroups)
d.Set("parameter_group_name", c.CacheParameterGroup)
d.Set("maintenance_window", c.PreferredMaintenanceWindow)
if err := setCacheNodeData(d, c); err != nil {
return err
@ -287,6 +297,11 @@ func resourceAwsElasticacheClusterUpdate(d *schema.ResourceData, meta interface{
requestUpdate = true
}
if d.HasChange("maintenance_window") {
req.PreferredMaintenanceWindow = aws.String(d.Get("maintenance_window").(string))
requestUpdate = true
}
if d.HasChange("engine_version") {
req.EngineVersion = aws.String(d.Get("engine_version").(string))
requestUpdate = true

View File

@ -37,6 +37,10 @@ lowercase string
See [Selecting a Cache Engine and Version](http://docs.aws.amazon.com/AmazonElastiCache/latest/UserGuide/SelectEngine.html)
in the AWS Documentation center for supported versions
* `maintenance_window`  (Optional) Specifies the weekly time range which maintenance
on the cache cluster is performed. The format is `ddd:hh24:mi-ddd:hh24:mi` (24H Clock UTC).
The minimum maintenance window is a 60 minute period. Example: `sun:05:00-sun:09:00`
* `node_type` (Required) The compute and memory capacity of the nodes. See
[Available Cache Node Types](http://aws.amazon.com/elasticache/details#Available_Cache_Node_Types) for
supported node types