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

feat(terraform): adds ignore_default_action input variable #140

Closed
wants to merge 2 commits into from

Conversation

jbrt
Copy link

@jbrt jbrt commented May 23, 2023

what

Adds a new ignore_default_action_changes input variables.

why

Because when this module is used in a AWS CodeDeploy Blue/Green deployment context, CodeDeploy will manipulates target groups and this module will drift. By adding a lifecycle on this module, it's now possible to use CodeDeploy deployments with this module.

references

Cloudposse's TF modules used for testing:
https://registry.terraform.io/modules/cloudposse/ecs-alb-service-task/aws/latest
https://registry.terraform.io/modules/cloudposse/alb/aws/latest
https://registry.terraform.io/modules/cloudposse/code-deploy/aws/latest

@jbrt jbrt requested review from a team as code owners May 23, 2023 09:56
@jbrt jbrt requested review from Gowiem and joe-niland and removed request for a team May 23, 2023 09:56
@jbrt
Copy link
Author

jbrt commented Jun 2, 2023

Hello 👋

@Gowiem @joe-niland can you please review this PR ? ;)

Regards

Copy link
Author

@jbrt jbrt left a comment

Choose a reason for hiding this comment

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

Hello @Gowiem @joe-niland

Is there any chance to have my PR reviewed? 🤔 🙏

Regards

@Gowiem
Copy link
Member

Gowiem commented Oct 4, 2023

/terratest

@Gowiem
Copy link
Member

Gowiem commented Oct 4, 2023

@jbrt checking it out, but these types of changes are always painful as adding a whole other resource / conditional logic to manage that resource means multiple locations that future changes need to be made. We'll want to make sure we actually want to support this use-case within the Cloud Posse ecosystem. I'll bring this up with the rest of the contributor team and I'll let you know.

Side note -- you've got failures at the CI level. Mind doing the following locally and then pushing:

Please run the following commands and commit the changes

make init
make github/init
make readme

@@ -171,8 +171,36 @@ resource "aws_lb_listener" "http_forward" {
}
}

resource "aws_lb_listener" "http_forward_ignore_default_action" {
Copy link
Member

Choose a reason for hiding this comment

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

Huh this is beyond the scope of your PR, but noting for myself and any fellow contributors: I'm not even sure why we need to have two of these resources for http_forward + http_redirect. It seems we could just do the conditional logic In the default action itself without requiring two resources.

@joe-niland do you happen to know the history behind why it was done this way?

Copy link
Sponsor Member

Choose a reason for hiding this comment

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

@Gowiem sorry I missed this one! I don't know why but it dates back to the initial implementation I think. I agree it could be refactored as you described.

Copy link
Member

Choose a reason for hiding this comment

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

@joe-niland I'll create an issue and we can see if a passer by wants to pick it up!

@@ -40,23 +40,23 @@ output "default_target_group_arn_suffix" {

output "http_listener_arn" {
description = "The ARN of the HTTP forwarding listener"
value = one(aws_lb_listener.http_forward[*].arn)
value = join("", aws_lb_listener.http_forward.*.arn, aws_lb_listener.http_forward_ignore_default_action.*.arn)
Copy link
Member

Choose a reason for hiding this comment

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

@jbrt for all of these lint errors, you do want to use brackets instead of .*. as that is the preferred way of using that operator.

@Gowiem
Copy link
Member

Gowiem commented Oct 4, 2023

@jbrt test error is surrounding a failure to delete a bucket it looks like. Probably not due to your changes. I'd make the lint fixes, we'll discuss internally, and then I'll rerun tests and we'll see if a 2nd run does the trick.

@jamengual
Copy link
Contributor

this feels to me like a shortcut to deal with drift which is not the purpose of this module, those businesses's needs should be outside of this root module.

you can still use this module to create the LB without any listeners and in your wrapper you can add an ignore lifecycle or any other needs you have.

@Gowiem
Copy link
Member

Gowiem commented Oct 4, 2023

@jamengual solid point regarding these listener rules being created inside the root module instead of in the child. I agree with that suggestion as the path forward instead of introducing this complexity here @jbrt. Does that make sense? If you feel otherwise, feel free to state your case, but I'd suggest you take Pepe's approach.

@Gowiem
Copy link
Member

Gowiem commented Nov 15, 2023

@jbrt going to close this PR out following the discussion above. Appreciate your work on this PR, but since this can be handled in the root module for your case and we can avoid adding additional complexity to an any already complex module we've decided against this enhance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants