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

resource/ecs_service: Fixes normalization issues in placement_strategy #1025

Merged
merged 1 commit into from
Jun 30, 2017

Conversation

stack72
Copy link
Contributor

@stack72 stack72 commented Jun 30, 2017

Fixes: #938

When aws_ecs_service has a placement_strategy of type spread, you can
use a field of instanceId or host interchangable. BUT AWS will normalize the
field value to return instanceId.

We have introduced a custom Set func to manage this work so that we
understand when someone uses host, we won't get a diff when AWS return
instanceId -> if there is a diff, a ForceNew is applied

% make testacc TEST=./aws TESTARGS='-run=TestAccAWSEcsService'                                                                  ✹
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -run=TestAccAWSEcsService -timeout 120m
=== RUN   TestAccAWSEcsServiceWithARN
--- PASS: TestAccAWSEcsServiceWithARN (147.06s)
=== RUN   TestAccAWSEcsServiceWithUnnormalizedPlacementStrategy
--- PASS: TestAccAWSEcsServiceWithUnnormalizedPlacementStrategy (116.97s)
=== RUN   TestAccAWSEcsServiceWithFamilyAndRevision
--- PASS: TestAccAWSEcsServiceWithFamilyAndRevision (125.69s)
=== RUN   TestAccAWSEcsServiceWithRenamedCluster
--- PASS: TestAccAWSEcsServiceWithRenamedCluster (268.02s)
=== RUN   TestAccAWSEcsService_withIamRole
--- PASS: TestAccAWSEcsService_withIamRole (155.57s)
=== RUN   TestAccAWSEcsService_withDeploymentValues
--- PASS: TestAccAWSEcsService_withDeploymentValues (128.80s)
=== RUN   TestAccAWSEcsService_withLbChanges
--- PASS: TestAccAWSEcsService_withLbChanges (242.82s)
=== RUN   TestAccAWSEcsService_withEcsClusterName
--- PASS: TestAccAWSEcsService_withEcsClusterName (113.21s)
=== RUN   TestAccAWSEcsService_withAlb
--- PASS: TestAccAWSEcsService_withAlb (349.69s)
=== RUN   TestAccAWSEcsServiceWithPlacementStrategy
--- PASS: TestAccAWSEcsServiceWithPlacementStrategy (238.08s)
=== RUN   TestAccAWSEcsServiceWithPlacementConstraints
--- PASS: TestAccAWSEcsServiceWithPlacementConstraints (123.41s)
=== RUN   TestAccAWSEcsServiceWithPlacementConstraints_emptyExpression
--- PASS: TestAccAWSEcsServiceWithPlacementConstraints_emptyExpression (126.25s)
PASS
ok	github.com/terraform-providers/terraform-provider-aws/aws	2138.968s

Fixes: #938

When aws_ecs_service has a placement_strategy of type `spread`, you can
use a field of `instanceId` or `host` interchangable. BUT AWS will normalize the
field value to return `instanceId`.

We have introduced a custom Set func to manage this work so that we
understand when someone uses `host`, we won't get a diff when AWS return
`instanceId` -> if there is a diff, a ForceNew is applied

```
% make testacc TEST=./aws TESTARGS='-run=TestAccAWSEcsService'                                                                  ✹
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -run=TestAccAWSEcsService -timeout 120m
=== RUN   TestAccAWSEcsServiceWithARN
--- PASS: TestAccAWSEcsServiceWithARN (147.06s)
=== RUN   TestAccAWSEcsServiceWithUnnormalizedPlacementStrategy
--- PASS: TestAccAWSEcsServiceWithUnnormalizedPlacementStrategy (116.97s)
=== RUN   TestAccAWSEcsServiceWithFamilyAndRevision
--- PASS: TestAccAWSEcsServiceWithFamilyAndRevision (125.69s)
=== RUN   TestAccAWSEcsServiceWithRenamedCluster
--- PASS: TestAccAWSEcsServiceWithRenamedCluster (268.02s)
=== RUN   TestAccAWSEcsService_withIamRole
--- PASS: TestAccAWSEcsService_withIamRole (155.57s)
=== RUN   TestAccAWSEcsService_withDeploymentValues
--- PASS: TestAccAWSEcsService_withDeploymentValues (128.80s)
=== RUN   TestAccAWSEcsService_withLbChanges
--- PASS: TestAccAWSEcsService_withLbChanges (242.82s)
=== RUN   TestAccAWSEcsService_withEcsClusterName
--- PASS: TestAccAWSEcsService_withEcsClusterName (113.21s)
=== RUN   TestAccAWSEcsService_withAlb
--- PASS: TestAccAWSEcsService_withAlb (349.69s)
=== RUN   TestAccAWSEcsServiceWithPlacementStrategy
--- PASS: TestAccAWSEcsServiceWithPlacementStrategy (238.08s)
=== RUN   TestAccAWSEcsServiceWithPlacementConstraints
--- PASS: TestAccAWSEcsServiceWithPlacementConstraints (123.41s)
=== RUN   TestAccAWSEcsServiceWithPlacementConstraints_emptyExpression
--- PASS: TestAccAWSEcsServiceWithPlacementConstraints_emptyExpression (126.25s)
PASS
ok	github.com/terraform-providers/terraform-provider-aws/aws	2138.968s
```
@stack72 stack72 added the bug Addresses a defect in current functionality. label Jun 30, 2017
Copy link
Contributor

@grubernaut grubernaut left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@stack72 stack72 merged commit 7068601 into master Jun 30, 2017
@stack72 stack72 deleted the b-aws-ecs-service-938 branch June 30, 2017 16:51
@ghost
Copy link

ghost commented Apr 11, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked and limited conversation to collaborators Apr 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ECS Service 'Host' Placement Strategy Forcing Service Rebuild
2 participants