This is a terraform module that let's you create a redirect using S3.
AWS S3 let's you create a bucket where the only purpose is to perform a 301 redirect when called via an HTTP request. This module allows you to create a bucket configured this way in a simple way.
domain
- The domain to be used as the redirect hostredirect
- The URL location where the redirect must be performed
This is a short example on how you can use the module in a simple template file,
e.g. main.tf
.
module "redirect" {
source = "github.com/fallertsen/terraform-module-aws-s3-redirect"
domain = "example.com"
redirect = "www.example.com"
}
This will create a new bucket called example.com
and when an HTTP request will
be performed on that bucket public endpoint it will return a 301 redirect to
www.example.com
.
website_endpoint
- The endpoint of the bucketwebsite_domain
- The domain of the endpoint, this is used for Route53 alias recordshosted_zone_id
- The Route53 hosted zone id of the bucket region