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

Fix "random" ECS task placement strategy #6176

Merged
merged 2 commits into from
Oct 18, 2018
Merged

Conversation

jnjackins
Copy link
Contributor

@jnjackins jnjackins commented Oct 16, 2018

This change fixes the "random" ECS task placement strategy. Without this change, it is impossible to use this strategy. The AWS Go SDK requires the Field parameter to be nil when Type is random, but we were sending a pointer to "".

Fixes #5387

@ghost ghost added size/M Managed by automation to categorize the size of a PR. service/ecs Issues and PRs that pertain to the ecs service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. labels Oct 16, 2018
@bflad bflad added the bug Addresses a defect in current functionality. label Oct 16, 2018
testAccCheckAWSEcsServiceExists("aws_ecs_service.mongo", &service),
resource.TestCheckResourceAttr("aws_ecs_service.mongo", "ordered_placement_strategy.#", "1"),
resource.TestCheckResourceAttr("aws_ecs_service.mongo", "ordered_placement_strategy.0.type", "random"),
resource.TestCheckNoResourceAttr("aws_ecs_service.mongo", "ordered_placement_strategy.0.field"),
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems to be failing acceptance testing at the moment:

--- FAIL: TestAccAWSEcsService_withPlacementStrategy (32.95s)
    testing.go:538: Step 2 error: Check failed: Check 4/4 error: aws_ecs_service.mongo: Attribute 'ordered_placement_strategy.0.field' found when not expected

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Whoops, my mistake. Fixed and learned how to run the acceptance tests. :)

We want Field attribute to be nil when creating the resource, but the attribute still exists when querying the resource.

@bflad bflad added this to the v1.41.0 milestone Oct 18, 2018
Copy link
Contributor

@bflad bflad left a comment

Choose a reason for hiding this comment

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

Thanks, @jnjackins! 🚀

21 tests passed (all tests)
--- PASS: TestAccAWSEcsService_disappears (7.43s)
--- PASS: TestAccAWSEcsService_withPlacementConstraints_emptyExpression (8.49s)
--- PASS: TestAccAWSEcsService_withDeploymentValues (8.88s)
--- PASS: TestAccAWSEcsService_withPlacementConstraints (8.89s)
--- PASS: TestAccAWSEcsService_withARN (12.02s)
--- PASS: TestAccAWSEcsService_withEcsClusterName (12.87s)
--- PASS: TestAccAWSEcsService_withDaemonSchedulingStrategy (20.96s)
--- PASS: TestAccAWSEcsService_withServiceRegistries_container (17.38s)
--- PASS: TestAccAWSEcsService_withServiceRegistries (28.04s)
--- PASS: TestAccAWSEcsService_withIamRole (28.91s)
--- PASS: TestAccAWSEcsService_withUnnormalizedPlacementStrategy (29.91s)
--- PASS: TestAccAWSEcsService_withReplicaSchedulingStrategy (31.08s)
--- PASS: TestAccAWSEcsService_withFamilyAndRevision (32.50s)
--- PASS: TestAccAWSEcsService_basicImport (41.71s)
--- PASS: TestAccAWSEcsService_withLaunchTypeEC2AndNetworkConfiguration (41.55s)
--- PASS: TestAccAWSEcsService_withPlacementStrategy (42.65s)
--- PASS: TestAccAWSEcsService_withRenamedCluster (44.08s)
--- PASS: TestAccAWSEcsService_withLbChanges (132.15s)
--- PASS: TestAccAWSEcsService_withAlb (185.44s)
--- PASS: TestAccAWSEcsService_healthCheckGracePeriodSeconds (197.29s)
--- PASS: TestAccAWSEcsService_withLaunchTypeFargate (359.60s)

@bflad bflad merged commit 18990d4 into hashicorp:master Oct 18, 2018
bflad added a commit that referenced this pull request Oct 18, 2018
@bflad
Copy link
Contributor

bflad commented Oct 18, 2018

This has been released in version 1.41.0 of the AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

@jnjackins
Copy link
Contributor Author

Excellent, thanks!

@ghost
Copy link

ghost commented Apr 2, 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 2, 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. service/ecs Issues and PRs that pertain to the ecs service. size/M Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Random ordered_placement_strategy
2 participants