diff --git a/builtin/providers/aws/resource_aws_elasticache_cluster.go b/builtin/providers/aws/resource_aws_elasticache_cluster.go index df73e413f..fa0d6b746 100644 --- a/builtin/providers/aws/resource_aws_elasticache_cluster.go +++ b/builtin/providers/aws/resource_aws_elasticache_cluster.go @@ -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 diff --git a/website/source/docs/providers/aws/r/elasticache_cluster.html.markdown b/website/source/docs/providers/aws/r/elasticache_cluster.html.markdown index 1ede63fac..953b78a9c 100644 --- a/website/source/docs/providers/aws/r/elasticache_cluster.html.markdown +++ b/website/source/docs/providers/aws/r/elasticache_cluster.html.markdown @@ -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