-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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 support for 'redirect' and 'fixed-response' into lb_listener_rule action type #5344
Comments
I'm interested to work on this feature. The As for the potential Terraform configuration, I propose the following: Redirectresource "aws_lb_listener" "web_port80" {
load_balancer_arn = "${aws_lb.web_alb.arn}"
port = 80
protocol = "HTTP"
default_action {
type = "redirect"
host = "#{host}"
path = "/#{path}"
port = "#{port}"
protocol = "#{protocol}"
query = "#{query}"
status_code = "301"
}
} Fixed responseresource "aws_lb_listener" "web_port80" {
load_balancer_arn = "${aws_lb.web_alb.arn}"
port = 80
protocol = "HTTP"
default_action {
type = "fixed-response"
content_type = "text/plain"
message_body = "Hello"
status_code = "200"
}
} Config for |
Caution: setting these types of rules outside Terraform will cause the AWS provider to crash in all versions up through the latest (version 1.29.0 as of this writing): #5357 I will be submitting a pull request today to prevent this type of crash across all ALB/NLB resources and we should probably wait on those fixes before adding this feature. |
Crash prevention pull request submitted: #5367 |
The crash fix has been merged into master so it should be okay to work with the code for this on top of those changes. 👍 |
We now have 3 different types of actions: "fixed-response", "forward" and "redirect", each with different sets of parameters. Would it be better if the action config for selected action type is grouped in a block instead of flattening them at the top level? Examples:
The Action datatype now groups action type-specific config in a nested object, so doing it this way would be (almost) a 1:1 mapping: https://docs.aws.amazon.com/elasticloadbalancing/latest/APIReference/API_Action.html Also, I noticed that the
If this |
We recommend following the SDK structure in most cases, so separate blocks in this case would be appropriate. This allows us to easily add the argument validation as well as keep the code simpler. |
Since the scope of this includes Additionally, I didn't see anything about adding headers in the API links above so not clear how I'd set something like an |
Are there any plans to add authentication too? |
Support for |
This has been released in version 1.33.0 of the AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. |
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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks! |
Community Note
Description
AWS added support for ELB Redirects, which is very useful to do an out-of-the-box experience for HTTP to HTTPS redirects without using an EC2 instance with an HTTP server listening in there.
It would be cool if you could add the support for this feature.
New or Affected Resource(s)
Potential Terraform Configuration
References
Official announcement: https://aws.amazon.com/about-aws/whats-new/2018/07/elastic-load-balancing-announces-support-for-redirects-and-fixed-responses-for-application-load-balancer/
Documentation:
The text was updated successfully, but these errors were encountered: