Yet another serverless lambda redirect. This one accepts a list of domain names and redirects them to a URL. For example:
module "redirect" {
source = "../lambda-redirect"
domain_mapping = {
"test.example.com": "https://example.com/test",
"mail.example.com": "https://mailprovider.com",
}
aws_acm_certificate = aws_acm_certificate.dev
http_redirect_code = 302
}
This redirect will append the path to redirected URLs. A user visiting test.example.com/path will be redirected to https://example.com/test/path. Note that the / in the URL will be appended to the mapped URL, which works well for top level domains but may cause issues trying to redirect to a specific document.
No modules.
| Name |
Description |
Type |
Default |
Required |
| aws_acm_certificate |
ACM certificate to use with the source domains (must be in us-east-1!) |
object({ arn = string }) |
n/a |
yes |
| domain_mapping |
A key/value map of source domains -> target redirects. For example: domain_mapping: {"test.example.com": "https://example.com/test"} |
map(string) |
n/a |
yes |
| http_redirect_code |
Which HTTP redirect code to use (301 or 302) |
string |
"301" |
no |