Skip to content

Commit

Permalink
feature(elastigroup/aws): add support for max scale down percentage i…
Browse files Browse the repository at this point in the history
…n docker swarm integration
  • Loading branch information
Lironrad authored and liranp committed Nov 12, 2020
1 parent 285c4bd commit 7a38214
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ func SetupDockerSwarm(fieldsMap map[commons.FieldName]*commons.GenericField) {
Type: schema.TypeInt,
Optional: true,
},

string(MaxScaleDownPercentage): {
Type: schema.TypeFloat,
Optional: true,
},
},
},
},
Expand Down
6 changes: 5 additions & 1 deletion spotinst/resource_spotinst_elastigroup_aws_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3653,6 +3653,7 @@ func TestAccSpotinstElastigroupAWS_IntegrationDockerSwarm(t *testing.T) {
resource.TestCheckResourceAttr(resourceName, "integration_docker_swarm.0.autoscale_headroom.0.memory_per_unit", "512"),
resource.TestCheckResourceAttr(resourceName, "integration_docker_swarm.0.autoscale_headroom.0.num_of_units", "2"),
resource.TestCheckResourceAttr(resourceName, "integration_docker_swarm.0.autoscale_down.0.evaluation_periods", "300"),
resource.TestCheckResourceAttr(resourceName, "integration_docker_swarm.0.autoscale_down.0.max_scale_down_percentage", "70"),
),
},
{
Expand All @@ -3674,6 +3675,7 @@ func TestAccSpotinstElastigroupAWS_IntegrationDockerSwarm(t *testing.T) {
resource.TestCheckResourceAttr(resourceName, "integration_docker_swarm.0.autoscale_headroom.0.memory_per_unit", "1024"),
resource.TestCheckResourceAttr(resourceName, "integration_docker_swarm.0.autoscale_headroom.0.num_of_units", "1"),
resource.TestCheckResourceAttr(resourceName, "integration_docker_swarm.0.autoscale_down.0.evaluation_periods", "150"),
resource.TestCheckResourceAttr(resourceName, "integration_docker_swarm.0.autoscale_down.0.max_scale_down_percentage", "20"),
),
},
{
Expand Down Expand Up @@ -3708,7 +3710,8 @@ const testIntegrationDockerSwarmGroupConfig_Create = `
}
autoscale_down {
evaluation_periods = 300
evaluation_periods = 300
max_scale_down_percentage = 70
}
}
// -------------------------------------
Expand All @@ -3731,6 +3734,7 @@ const testIntegrationDockerSwarmGroupConfig_Update = `
autoscale_down {
evaluation_periods = 150
max_scale_down_percentage = 20
}
}
// -------------------------------------
Expand Down
5 changes: 3 additions & 2 deletions website/docs/r/elastigroup_aws.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,7 @@ Usage:
* `num_of_units` - (Optional, Default: `0`) How many units to allocate for headroom unit.
* `autoscale_down` - (Optional) Setting for scale down actions.
* `evaluation_periods` - (Optional, Default: `5`) Number of periods over which data is compared. Minimum 3, Measured in consecutive minutes.
* `max_scale_down_percentage` - (Optional) Would represent the maximum % to scale-down. Number between 1-100.
Usage:

```hcl
Expand All @@ -730,7 +730,8 @@ integration_docker_swarm {
}
autoscale_down {
evaluation_periods = 3
evaluation_periods = 3
max_scale_down_percentage = 30
}
}
```
Expand Down

0 comments on commit 7a38214

Please sign in to comment.