Skip to content
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

remove capacity_provider_strategy validation for aws_ecs_service resource #39723

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/39706.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/aws_ecs_service: Remove zero check for weight and base fields in capacity_provider_strategy block.
```
13 changes: 1 addition & 12 deletions internal/service/ecs/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -1938,22 +1938,11 @@ func triggersCustomizeDiff(_ context.Context, d *schema.ResourceDiff, meta inter
}

func capacityProviderStrategyCustomizeDiff(_ context.Context, d *schema.ResourceDiff, meta interface{}) error {
// to be backward compatible, should ForceNew almost always (previous behavior), unless:
// force_new_deployment is true and
// neither the old set nor new set is 0 length
// to be backward compatible, should ForceNew almost always (previous behavior), unless force_new_deployment is true
if v := d.Get("force_new_deployment").(bool); !v {
return capacityProviderStrategyForceNew(d)
}

old, new := d.GetChange(names.AttrCapacityProviderStrategy)

ol := old.(*schema.Set).Len()
nl := new.(*schema.Set).Len()

if (ol == 0 && nl > 0) || (ol > 0 && nl == 0) {
return capacityProviderStrategyForceNew(d)
}

return nil
}

Expand Down