A Daring Way cloudfront edge lambda
Contestant: AWS for $00, Alex.
Alex: How you easily configure AWS Cloudfront to do standard redirect and rewrites ?
Contestant: What is the Daring Way AWS Cloudfront Viewer Request Lambda Terraform Module.
Alex: That is correct.
Lambda Supports:
- Redirect apex domain such as (daringway.com -> www.daringway.com)
- Rewrite uri for S3 such as (www.daringway.com/ -> www.daringway.com/index.html)
- Redirect for ghost server management such as (www.daringway.com/ghost -> ghost.daringway.com/ghost)
module cloudfront_lambda {
source = "daringway/cloudfront-viewer-request-lambda/aws"
tags = {}
apex_domain_redirect = true
index_rewrite = true
}
resource aws_cloudfront_distribution a_distribution {
...
lambda_function_association {
event_type = "viewer-request"
lambda_arn = module.cloudfront_lambda.qualified_arn
include_body = false
}
...
}
Semantic Version is being applied to the modules.
- MAJOR version requires a change.
- upgrading to new version of terraform
- variable name changes
- new variable without a default value
- changes that will require manually updating the terraform.tfstate file such as a
terraform state mv
- changes that will require resources being destroy and created that require external terraform application configuration
- MINOR version add new functionality in a backwards compatible manner
- new variable with default value
- PATCH version have backwards compatible bug fixes