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

Add aws_ecs_task_set resource #13651

Closed
wants to merge 9 commits into from
Closed

Add aws_ecs_task_set resource #13651

wants to merge 9 commits into from

Conversation

kumarappan-arumugam
Copy link
Contributor

@kumarappan-arumugam kumarappan-arumugam commented Jun 7, 2020

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for pull request followers and do not help prioritize the request

Requires: #8652
Fixes #8124
Related #8131 (another implementation)

Release note for CHANGELOG:

resource/aws_ecs_task_set: Add `ecs_task_set` resource

Output from acceptance testing:

❯ AWS_PROFILE=terraform-dev-test make testacc TEST=./aws TESTARGS='-run=TestAccAWSEcsTaskSet_'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSEcsTaskSet_ -timeout 120m
=== RUN   TestAccAWSEcsTaskSet_withARN
=== PAUSE TestAccAWSEcsTaskSet_withARN
=== RUN   TestAccAWSEcsTaskSet_disappears
=== PAUSE TestAccAWSEcsTaskSet_disappears
=== RUN   TestAccAWSEcsTaskSet_scale
=== PAUSE TestAccAWSEcsTaskSet_scale
=== RUN   TestAccAWSEcsTaskSet_withCapacityProviderStrategy
=== PAUSE TestAccAWSEcsTaskSet_withCapacityProviderStrategy
=== RUN   TestAccAWSEcsTaskSet_withMultipleCapacityProviderStrategies
=== PAUSE TestAccAWSEcsTaskSet_withMultipleCapacityProviderStrategies
=== RUN   TestAccAWSEcsTaskSet_withAlb
=== PAUSE TestAccAWSEcsTaskSet_withAlb
=== RUN   TestAccAWSEcsTaskSet_withLaunchTypeFargate
=== PAUSE TestAccAWSEcsTaskSet_withLaunchTypeFargate
=== RUN   TestAccAWSEcsTaskSet_withLaunchTypeFargateAndPlatformVersion
=== PAUSE TestAccAWSEcsTaskSet_withLaunchTypeFargateAndPlatformVersion
=== RUN   TestAccAWSEcsTaskSet_withServiceRegistries
=== PAUSE TestAccAWSEcsTaskSet_withServiceRegistries
=== RUN   TestAccAWSEcsTaskSet_Tags
=== PAUSE TestAccAWSEcsTaskSet_Tags
=== CONT  TestAccAWSEcsTaskSet_withARN
=== CONT  TestAccAWSEcsTaskSet_withLaunchTypeFargate
=== CONT  TestAccAWSEcsTaskSet_withCapacityProviderStrategy
=== CONT  TestAccAWSEcsTaskSet_withAlb
=== CONT  TestAccAWSEcsTaskSet_withMultipleCapacityProviderStrategies
=== CONT  TestAccAWSEcsTaskSet_scale
=== CONT  TestAccAWSEcsTaskSet_Tags
=== CONT  TestAccAWSEcsTaskSet_withServiceRegistries
=== CONT  TestAccAWSEcsTaskSet_withLaunchTypeFargateAndPlatformVersion
=== CONT  TestAccAWSEcsTaskSet_disappears
--- PASS: TestAccAWSEcsTaskSet_disappears (43.37s)
--- PASS: TestAccAWSEcsTaskSet_withLaunchTypeFargate (51.77s)
--- PASS: TestAccAWSEcsTaskSet_scale (60.76s)
--- PASS: TestAccAWSEcsTaskSet_Tags (67.21s)
--- PASS: TestAccAWSEcsTaskSet_withARN (70.58s)
--- PASS: TestAccAWSEcsTaskSet_withMultipleCapacityProviderStrategies (74.49s)
--- PASS: TestAccAWSEcsTaskSet_withCapacityProviderStrategy (115.18s)
--- PASS: TestAccAWSEcsTaskSet_withLaunchTypeFargateAndPlatformVersion (129.61s)
--- PASS: TestAccAWSEcsTaskSet_withServiceRegistries (140.07s)
--- PASS: TestAccAWSEcsTaskSet_withAlb (194.49s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	197.634s

...

@kumarappan-arumugam kumarappan-arumugam requested a review from a team June 7, 2020 02:57
@ghost ghost added size/XXL Managed by automation to categorize the size of a PR. needs-triage Waiting for first response or review from a maintainer. documentation Introduces or discusses updates to documentation. service/ecs Issues and PRs that pertain to the ecs service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. provider Pertains to the provider itself, rather than any interaction with AWS. labels Jun 7, 2020
Copy link
Collaborator

@DrFaust92 DrFaust92 left a comment

Choose a reason for hiding this comment

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

Hey,

took a quick look at this, and i have some comments. ill take a deeper look later as well

aws/resource_aws_ecs_task_set.go Outdated Show resolved Hide resolved
aws/resource_aws_ecs_task_set.go Outdated Show resolved Hide resolved
aws/resource_aws_ecs_task_set.go Outdated Show resolved Hide resolved
aws/resource_aws_ecs_task_set.go Outdated Show resolved Hide resolved
aws/resource_aws_ecs_task_set.go Outdated Show resolved Hide resolved
aws/resource_aws_ecs_task_set.go Outdated Show resolved Hide resolved
aws/resource_aws_ecs_task_set.go Outdated Show resolved Hide resolved
aws/resource_aws_ecs_task_set.go Outdated Show resolved Hide resolved
aws/resource_aws_ecs_task_set_test.go Outdated Show resolved Hide resolved
aws/resource_aws_ecs_task_set_test.go Show resolved Hide resolved
Copy link
Collaborator

@DrFaust92 DrFaust92 left a comment

Choose a reason for hiding this comment

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

Thanks for the quick changes, another round of comments.

please add import checks to all test cases, see https://github.com/terraform-providers/terraform-provider-aws/blob/master/docs/contributing/running-and-writing-acceptance-tests.md#basic-acceptance-tests for an example.

aws/resource_aws_ecs_task_set.go Outdated Show resolved Hide resolved

if d.Get("wait_until_stable").(bool) {
waitUntilStableTimeOut := d.Timeout(schema.TimeoutCreate)
if v, ok := d.GetOk("wait_until_stable_timeout"); ok && v.(string) != "" {
Copy link
Collaborator

Choose a reason for hiding this comment

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

can't this be achieved with changing the TimeoutCreate value?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No this is to explicitly give control to users to increase the wait timeout if they want to, in case their task set takes more time to stabilize for some reason.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

  • wait_until_stable_timeout - (Optional) Wait timeout for task set to reach STEADY_STATE. Default 10m

aws/resource_aws_ecs_task_set.go Outdated Show resolved Hide resolved
@kumarappan-arumugam
Copy link
Contributor Author

@DrFaust92 could you please take another look? Would like to merge this as soon as possible.

@kumarappan-arumugam
Copy link
Contributor Author

@bflad Can you please merge this one?

@breathingdust breathingdust added new-resource Introduces a new resource. and removed needs-triage Waiting for first response or review from a maintainer. labels Jul 3, 2020
Comment on lines +94 to +97
// If you are using the CodeDeploy or an external deployment controller,
// multiple target groups are not supported.
// https://docs.aws.amazon.com/AmazonECS/latest/developerguide/register-multiple-targetgroups.html
"load_balancers": {

Choose a reason for hiding this comment

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

If this is constrained to a single load balancer, should the property name be load_balancer singular? The corresponding property in aws_ecs_service is also singular.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I initially had it singular, but changed it because of this comment
#13651 (comment)

This is the corresponding API - loadBalancers
https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_TaskSet.html

@jamroks
Copy link

jamroks commented Aug 17, 2020

Hello , thanks for the work on this @kumarappan-arumugam .

Is there anything preventing this PR to be merge ?

@kumarappan-arumugam
Copy link
Contributor Author

kumarappan-arumugam commented Aug 17, 2020

Is there anything preventing this PR to be merge ?

None that I can think of (if it's addressed to me).

@teamterraform
Copy link

Notification of Recent and Upcoming Changes to Contributions

Thank you for this contribution! There have been a few recent development changes that affect this pull request. We apologize for the inconvenience, especially if there have been long review delays up until now. Please note that this is automated message from an unmonitored account. See the FAQ for additional information on the maintainer team and review prioritization.

If you are unable to complete these updates, please leave a comment for the community and maintainers so someone can potentially continue the work. The maintainers will encourage other contributors to use the existing contribution as the base for additional changes as appropriate. Otherwise, contributions that do not receive updated code or comments from the original contributor may be closed in the future so the maintainers can focus on active items.

For the most up to date information about Terraform AWS Provider development, see the Contributing Guide. Additional technical debt changes can be tracked with the technical-debt label on issues.

As part of updating a pull request with these changes, the most current unit testing and linting will run. These may report issues that were not previously reported.

Action Required: Terraform 0.12 Syntax

Reference: #8950
Reference: #14417

Version 3 and later of the Terraform AWS Provider, which all existing contributions would potentially be added, only supports Terraform 0.12 and later. Certain syntax elements of Terraform 0.11 and earlier show deprecation warnings during runs with Terraform 0.12. Documentation and test configurations, such as those including deprecated string interpolations (some_attribute = "${aws_service_thing.example.id}") should be updated to the newer syntax (some_attribute = aws_service_thing.example.id). Contribution testing will automatically fail on older syntax in the near future. Please see the referenced issues for additional information.

Action Required: Terraform Plugin SDK Version 2

Reference: #14551

The Terraform AWS Provider has been upgraded to the latest version of the Terraform Plugin SDK. Generally, most changes to contributions should only involve updating Go import paths in source code files. Please see the referenced issue for additional information.

Action Required: Removal of website/aws.erb File

Reference: #14712

Any changes to the website/aws.erb file are no longer necessary and should be removed from this contribution to prevent merge issues in the near future when the file is removed from the repository. Please see the referenced issue for additional information.

Upcoming Change of Git Branch Naming

Reference: #14292

Development environments will need their upstream Git branch updated from master to main in the near future. Please see the referenced issue for additional information and scheduling.

Upcoming Change of GitHub Organization

Reference: #14715

This repository will be migrating from https://github.com/terraform-providers/terraform-provider-aws to https://github.com/hashicorp/terraform-provider-aws. No practitioner or developer action is anticipated and most GitHub functionality will automatically redirect to the new location. Go import paths including terraform-providers can remain for now. Please see the referenced issue for additional information and scheduling.

@maxbfigma
Copy link

I noticed some unusual behavior on this resource — I ran an apply to change the subnets of the network_configuration of a task set, and the proposed action was an update-in place (redacted version below):

  ~ resource "aws_ecs_task_set" "template" {
        arn               = "value"
        cluster           = "value"
        external_id       = "template"
        id                = "value"
        launch_type       = "FARGATE"
        platform_version  = "value"
        service           = "value"
        task_definition   = "value"
        wait_until_stable = false

        load_balancers {
            container_name   = "value"
            container_port   = 0
            target_group_arn = "value"
        }

      ~ network_configuration {
            assign_public_ip = false
            security_groups  = [
                "sg-",
                "sg-",
                "sg-",
                "sg-",
                "sg-",
            ]
          ~ subnets          = [
              + "subnet-new",
              + "subnet-new",
              + "subnet-new",
              - "subnet-old",
              - "subnet-old",
              - "subnet-old",
            ]
        }

        scale {
            unit  = "PERCENT"
            value = 0
        }
    }

After applying this plan, terraform reported a success, but subnets were not actually changed. Subsequent plans would propose the same change. In order to actually get this change to take effect, I had to use terraform taint to mark the resource for replacement, at which point the values actually changed. I suspect the AWS API doesn't allow modifications on this value, and thus changes in this field should mark the resource for replacement.

Base automatically changed from master to main January 23, 2021 00:58
@breathingdust breathingdust requested a review from a team as a code owner January 23, 2021 00:58
@jfranzoi
Copy link

hello here,
just wondering if there's any plan for this to be released, thank you!

@tomaszdudek7
Copy link

Is anyone reviewing it?

@zhelding
Copy link
Contributor

Pull request #21306 has significantly refactored the AWS Provider codebase. As a result, most PRs opened prior to the refactor now have merge conflicts that must be resolved before proceeding.

Specifically, PR #21306 relocated the code for all AWS resources and data sources from a single aws directory to a large number of separate directories in internal/service, each corresponding to a particular AWS service. This separation of code has also allowed for us to simplify the names of underlying functions -- while still avoiding namespace collisions.

We recognize that many pull requests have been open for some time without yet being addressed by our maintainers. Therefore, we want to make it clear that resolving these conflicts in no way affects the prioritization of a particular pull request. Once a pull request has been prioritized for review, the necessary changes will be made by a maintainer -- either directly or in collaboration with the pull request author.

For a more complete description of this refactor, including examples of how old filepaths and function names correspond to their new counterparts: please refer to issue #20000.

For a quick guide on how to amend your pull request to resolve the merge conflicts resulting from this refactor and bring it in line with our new code patterns: please refer to our Service Package Refactor Pull Request Guide.

@YakDriver YakDriver added the pre-service-packages Includes pre-Service Packages aspects. label Nov 30, 2021
@anGie44 anGie44 self-assigned this Dec 2, 2021
@anGie44
Copy link
Contributor

anGie44 commented Dec 3, 2021

Hi @kumarappan-arumugam , thank you for this PR! I'm going to be reviewing this PR and in the meantime, I recommend setting this PR to allow maintainers to edit so that we can help you update this PR for service packages (see #20000). If edits are possible, I will resolve merge conflicts on my end.

@kumarappan-arumugam
Copy link
Contributor Author

@anGie44 Thanks for your interest in the PR. It has been pending for quite sometime, even before these conflicts were introduced. I don't see an option Allow edits from maintainers in the PR 🤔

@anGie44
Copy link
Contributor

anGie44 commented Dec 6, 2021

Hi @kumarappan-arumugam thanks for getting back to me! hmm do you by any chance see a checkbox on the right side of this page, perhaps below Linked Issues and Notifications similar to image in Step 4 of this github docs page https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork ? if not, not a problem :) we can create a new PR and cherry pick your commits if needed

@kumarappan-arumugam
Copy link
Contributor Author

@anGie44 yes I know that option, saw the same page you mentioned already, but unfortunately I don't see that option on my end.

@anGie44
Copy link
Contributor

anGie44 commented Dec 7, 2021

😕 , no worries @kumarappan-arumugam , i've linked the new PR which carries over your commits and refactors into service packages 👍

@github-actions
Copy link

github-actions bot commented Jun 4, 2022

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Introduces or discusses updates to documentation. new-resource Introduces a new resource. pre-service-packages Includes pre-Service Packages aspects. provider Pertains to the provider itself, rather than any interaction with AWS. service/ecs Issues and PRs that pertain to the ecs service. size/XXL 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.

Support ECS TaskSet