-
Notifications
You must be signed in to change notification settings - Fork 9.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
aws_ecs_service support deployment_minimum_healthy_percent for DAEMON strategy #6150
Merged
bflad
merged 6 commits into
hashicorp:master
from
mschurenko:ecs_service-improve-daemon-strategy
Oct 31, 2018
Merged
Changes from 2 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
213d964
enabling MinimumHealthyPercent for DAEMON
mschurenko 3985d60
setting deployment_minimum_healthy_percent in test
mschurenko f7983bf
using nil value for input.DeploymentConfiguration.MaximumPercent
mschurenko 7306998
using AWS API defaults for deployment_maximum_percent and deployment_…
mschurenko dd69f6a
adding TestAccAWSEcsService_withDaemonSchedulingStrategySetDeployment…
mschurenko 7fda67f
updating ecs service html markdown
mschurenko File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -106,12 +106,6 @@ func resourceAwsEcsService() *schema.Resource { | |
Type: schema.TypeInt, | ||
Optional: true, | ||
Default: 100, | ||
DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { | ||
if d.Get("scheduling_strategy").(string) == ecs.SchedulingStrategyDaemon { | ||
return true | ||
} | ||
return false | ||
}, | ||
}, | ||
|
||
"load_balancer": { | ||
|
@@ -354,7 +348,7 @@ func resourceAwsEcsServiceCreate(d *schema.ResourceData, meta interface{}) error | |
input.SchedulingStrategy = aws.String(schedulingStrategy) | ||
if schedulingStrategy == ecs.SchedulingStrategyDaemon { | ||
// unset these if DAEMON | ||
input.DeploymentConfiguration = nil | ||
input.DeploymentConfiguration.MaximumPercent = aws.Int64(100) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a reason to keep this logic here at all? Since the comment eludes to "unsetting" values due to |
||
input.DesiredCount = nil | ||
} | ||
|
||
|
@@ -767,13 +761,20 @@ func resourceAwsEcsServiceUpdate(d *schema.ResourceData, meta interface{}) error | |
input.TaskDefinition = aws.String(n.(string)) | ||
} | ||
|
||
if schedulingStrategy != ecs.SchedulingStrategyDaemon && (d.HasChange("deployment_maximum_percent") || d.HasChange("deployment_minimum_healthy_percent")) { | ||
if schedulingStrategy == ecs.SchedulingStrategyReplica && (d.HasChange("deployment_maximum_percent") || d.HasChange("deployment_minimum_healthy_percent")) { | ||
input.DeploymentConfiguration = &ecs.DeploymentConfiguration{ | ||
MaximumPercent: aws.Int64(int64(d.Get("deployment_maximum_percent").(int))), | ||
MinimumHealthyPercent: aws.Int64(int64(d.Get("deployment_minimum_healthy_percent").(int))), | ||
} | ||
} | ||
|
||
if schedulingStrategy == ecs.SchedulingStrategyDaemon && d.HasChange("deployment_minimum_healthy_percent") { | ||
input.DeploymentConfiguration = &ecs.DeploymentConfiguration{ | ||
MaximumPercent: aws.Int64(100), | ||
MinimumHealthyPercent: aws.Int64(int64(d.Get("deployment_minimum_healthy_percent").(int))), | ||
} | ||
} | ||
|
||
if d.HasChange("network_configuration") { | ||
input.NetworkConfiguration = expandEcsNetworkConfiguration(d.Get("network_configuration").([]interface{})) | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of leaving a
Default: 100
here that only works for one of the scheduling strategies, should we instead removeDefault: 100
and implement aDiffSuppressFunc
that covers suppressing the difference depending on the strategy? A similar update should likely occur for maximum as well.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we remove the
Default
wouldn't that be backwards incompatible for those who are using areplica
strategy and didn't setdeployment_minimum_healthy_percent
?Similar for
deployment_maximum_percent
, if we removeDefault
won't that be a problem for backwards compatibility?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
port
attribute of theaws_elasticache_cluster
resource is an example of a place where we allow two defaults chosen by the API, but suppress the difference if it is left unconfigured in the Terraform configuration: https://github.com/terraform-providers/terraform-provider-aws/blob/4ef574a20eeecd860ef40bf4ca94849cee9af0ef/aws/resource_aws_elasticache_cluster.go#L146-L157Its not pretty, but it works. 😄 We could also set
Computed: true
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. So when you say
we allow two defaults chosen by the API
, do you mean by the AWS API?