Skip to content

feat: Only tag ecs service if longer arns are enabled in the aws account #153

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

Merged
merged 10 commits into from
May 17, 2021

Conversation

nitrocode
Copy link
Member

Description

Closes #152

Motivation and Context

Older AWS accounts that have not enabled the longer arn format will not be able to tag the ecs service. This will allow disabling tagging of the ecs service using a boolean.

Breaking Changes

None

How Has This Been Tested?

Locally

Copy link

@SteveKekacs SteveKekacs left a comment

Choose a reason for hiding this comment

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

Lgtm -- also need this.

@nitrocode
Copy link
Member Author

@antonbabenko ping

Co-authored-by: Flaudísio Tolentino <[email protected]>
@DrFaust92
Copy link
Contributor

FYI, just a nit. if tags are changed out of state this will also cause a problem when it tries to remove tags from an ecs resource.

@DrFaust92 DrFaust92 requested a review from antonbabenko October 4, 2020 06:59
@nitrocode
Copy link
Member Author

FYI, just a nit. if tags are changed out of state this will also cause a problem when it tries to remove tags from an ecs resource.

True but the whole point of terraform is to do everything in code. Anything outside of code is a workaround.

main.tf Outdated
@@ -608,7 +608,7 @@ resource "aws_ecs_service" "atlantis" {
}
}

tags = local.tags
tags = var.use_old_arn_format ? null : local.tags
Copy link
Member

Choose a reason for hiding this comment

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

I don't have any way of testing since I don't have any accounts that do not use the newer format, but what if we do this instead (related to this comment)

Suggested change
tags = var.use_old_arn_format ? null : local.tags
tags = var.use_old_arn_format ? {} : local.tags

Copy link
Member Author

Choose a reason for hiding this comment

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

It's always better to do null since that safely removes the argument from being set in the first place.

We've been using this method in the https://github.com/cloudposse/terraform-aws-ecs-alb-service-task module with positive results.

Copy link
Member

Choose a reason for hiding this comment

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

I don't believe it always removes, which is why I was suggesting an empty map which removes any ambiguity. I do agree that null works great as a default variable value, but this is something slightly different - a different edge case. either way, we can try this approach. one thing though - I think we should adjust the variable name to use_ecs_old_arn_format to make it a bit more clear

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't believe it always removes

I tested this with 0.12.x, 0.13.x, and 0.14.x and it seems to remove the argument completely from the resource.

either way, we can try this approach.

Ok 😄

one thing though - I think we should adjust the variable name to use_ecs_old_arn_format to make it a bit more clear

Agreed, merge conflicts fixed and that change was committed.

Copy link
Member

@bryantbiggs bryantbiggs left a comment

Choose a reason for hiding this comment

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

@antonbabenko 👍🏼

@DrFaust92
Copy link
Contributor

DrFaust92 commented May 15, 2021

@nitrocode can you rebase? otherwise LGTM @antonbabenko

Copy link
Contributor

@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.

@antonbabenko antonbabenko merged commit 6f10a17 into terraform-aws-modules:master May 17, 2021
@antonbabenko
Copy link
Member

Thanks! v2.41.0 has been just released.

@nitrocode nitrocode deleted the patch-4 branch May 17, 2021 21:14
@github-actions
Copy link

github-actions bot commented Nov 9, 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 Nov 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot tag ecs service unless long arns are enabled in the aws account
6 participants