provider/aws: Add maintenance window to ElastiCache cluster
Implements #2612
This commit is contained in:
parent
b4c1c223ff
commit
49a01ee787
|
@ -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,
|
||||
|
@ -154,6 +159,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))
|
||||
}
|
||||
|
||||
_, err := conn.CreateCacheCluster(req)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error creating Elasticache: %s", err)
|
||||
|
@ -206,6 +215,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
|
||||
|
@ -264,6 +274,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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue