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

Replaced cert on LB listener still keeps previous cert association on LB #25652

Open
nitrocode opened this issue Jul 1, 2022 · 5 comments
Open
Labels
bug Addresses a defect in current functionality. service/elbv2 Issues and PRs that pertain to the elbv2 service.

Comments

@nitrocode
Copy link
Contributor

nitrocode commented Jul 1, 2022

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue 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 issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform CLI and Terraform AWS Provider Version

⨠ terraform -chdir=components/terraform/acm version
Terraform v1.2.3
on linux_amd64
+ provider registry.terraform.io/cloudposse/utils v0.17.26
+ provider registry.terraform.io/hashicorp/aws v4.21.0
+ provider registry.terraform.io/hashicorp/external v2.2.2
+ provider registry.terraform.io/hashicorp/local v2.2.3

Affected Resource(s)

Terraform Configuration Files

Please include all Terraform configurations required to reproduce the bug. Bug reports without a functional reproduction may be closed without investigation.

resource "aws_lb_listener" "https" {
  certificate_arn = "arn:aws:acm:us-east-1:<redacted>:certificate/<redacted>"
}

Debug Output

N/A

Panic Output

N/A

Expected Behavior

The cert should be replaced on the listener and the old referenced SNI should be removed so the old cert can be removed.

Actual Behavior

The cert was replaced on the listener and the old referenced SNI remained. This then required me to clickops delete the SNI from each load balancer in order to get the old cert to be unassociated so the old cert could be removed.

Steps to Reproduce

  1. terraform apply

Important Factoids

I'm unsure if the API supports this.

From the aws elbv2 modify-listener documentation, it looks like the --certificates can be used to replace all of the SNI certs and set one as the default. I'd prefer if we could keep the --certificates as a single cert. I suppose this would point to the aws_lb resource.

References

@github-actions github-actions bot added needs-triage Waiting for first response or review from a maintainer. service/elbv2 Issues and PRs that pertain to the elbv2 service. labels Jul 1, 2022
@nitrocode nitrocode changed the title aws_lb_listener: New cert added without removing old cert's SNI thus requiring clickops to remove cert assoc. Replaced cert on LB listener still keeps previous cert association on LB Jul 1, 2022
@justinretzolk justinretzolk added bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels Jul 6, 2022
@pmozdzynskiwh
Copy link

same issue noticed during the certificate replacement. ( new ARN )

@VuxLuan
Copy link

VuxLuan commented Jan 17, 2024

I have the same issue, is there any way to fix it?

@pmozdzynskiwh
Copy link

@VuxLuan - basically the default ( main ) certificate that was previously there was moved from default to be a listener certificate. You can delete this old certificate.

the "describe-listeners" API call only shows the DEFAULT NLB certificate in use by the listeners. That API call does Not show the additional "Listener certificates for SNI" in use by the Listener. To get a list of all the certificates being used, use the API call "describe-listener-certificates" instead.
In order to remove the non-default certificates on the Listeners, use the command "remove-listener-certificates". It takes in the Listener ARN & the certificate ARN as the inputs.

Alternatively, you can also remove the non-default certificates on the console by following the procedure below:
https://docs.aws.amazon.com/elasticloadbalancing/latest/network/listener-update-certificates.html#remove-certificates

@htgold
Copy link

htgold commented Feb 22, 2024

@pmozdzynskiwh - Sure, doing this manually after running "terraform apply" is one way to do it, but I think we're all looking for a way to have terraform do it for us. I work in a system that requires separation of duties, so being able to script the deployment manager's operations is preferred.

@mobious999
Copy link

I just ran into this issue as well. Is there any progress on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Addresses a defect in current functionality. service/elbv2 Issues and PRs that pertain to the elbv2 service.
Projects
None yet
Development

No branches or pull requests

6 participants