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

provider/aws: Fix bug w/ changing ECS svc/ELB association #4366

Merged
merged 5 commits into from
Jan 7, 2016

Conversation

radeksimko
Copy link
Member

This is fixing #3444 and #4227

Copy-pasting the RCA:

Changing ELB association is apparently a destructive action since there's no way to update it - we'll need to mark all aws_ecs_service.load_balancer.* fields as ForceNew: true.

You could probably make it less destructive by using lifecycle { create_before_destroy = true } on the aws_ecs_service, so that the new association takes place, traffic is served from the new service and old association is removed. For that however we will need to make name optional & generated, otherwise this would fail due to name conflict.

The other commit is also addressing the problem mentioned in #4326

It is not addressing the optional&generated name yet. Having not very positive experience with ELBs and LCs & generated names there, I'd like to make it generated with a prefix, so a human is able to identify each service outside of terraform. The lack of tags in ECS is making prefixes even more important.

log.Printf("[DEBUG] Trying to delete ECS service again: %q",
ec2err.Message())
return err
}
Copy link
Member Author

Choose a reason for hiding this comment

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

@hngkr this is what I meant in my comment #4326 (comment)

@radeksimko
Copy link
Member Author

I've been trying to make the LB change non-destructive (as described in #3444) and it seems it's not as easy as I thought due to the lifecycle of ECS task definitions.

In order to change the port number, we have to change both the aws_ecs_task_definition and aws_ecs_service which in combination w/ lifecycle { create_before_destroy = true } (rightly) ends up in a cycle. We don't permit two versions (two task definition ARNs) to be present & referenced at the same time.

It would be nice to make changing LB ports smooth, but for now I will just polish what I have to fix the original bug.

@radeksimko radeksimko changed the title [WIP] provider/aws: Fix bug w/ changing ECS svc/ELB association provider/aws: Fix bug w/ changing ECS svc/ELB association Dec 23, 2015
@radeksimko radeksimko removed the wip label Dec 23, 2015
@radeksimko
Copy link
Member Author

$ make testacc TEST=./builtin/providers/aws TESTARGS='-run=AWSEcsService'
==> Checking that code complies with gofmt requirements...
go generate ./...
TF_ACC=1 go test ./builtin/providers/aws -v -run=AWSEcsService -timeout 90m
=== RUN   TestAccAWSEcsServiceWithARN
--- PASS: TestAccAWSEcsServiceWithARN (59.60s)
=== RUN   TestAccAWSEcsServiceWithFamilyAndRevision
--- PASS: TestAccAWSEcsServiceWithFamilyAndRevision (108.20s)
=== RUN   TestAccAWSEcsServiceWithRenamedCluster
--- PASS: TestAccAWSEcsServiceWithRenamedCluster (157.00s)
=== RUN   TestAccAWSEcsService_withIamRole
--- PASS: TestAccAWSEcsService_withIamRole (122.41s)
=== RUN   TestAccAWSEcsService_withLbChanges
--- PASS: TestAccAWSEcsService_withLbChanges (69.52s)
=== RUN   TestAccAWSEcsService_withEcsClusterName
--- PASS: TestAccAWSEcsService_withEcsClusterName (19.72s)
PASS
ok      github.com/hashicorp/terraform/builtin/providers/aws    536.469s

Theoretically the tests may fail intermittently due to #4375 but that's out of scope of this PR, so it's ready for review & merge.

@catsby
Copy link
Contributor

catsby commented Jan 7, 2016

This looks good to me @radeksimko , thanks!
Sorry for the delay in review :)

@catsby
Copy link
Contributor

catsby commented Jan 7, 2016

Feel free to merge at your convenience :)

radeksimko added a commit that referenced this pull request Jan 7, 2016
provider/aws: Fix bug w/ changing ECS svc/ELB association
@radeksimko radeksimko merged commit ddcee32 into hashicorp:master Jan 7, 2016
@radeksimko radeksimko deleted the b-ecs-svc-fixes branch January 7, 2016 21:11
@ghost
Copy link

ghost commented Apr 29, 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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants