Launched!

This commit is contained in:
Jocelyn Badgley (Twipped) 2020-02-20 18:20:00 -08:00
parent fc39ad3c39
commit 6e3572add9
2 changed files with 27 additions and 26 deletions

View File

@ -23,7 +23,7 @@ data "archive_file" "logs_parser" {
resource "aws_lambda_function" "logs_parser" { resource "aws_lambda_function" "logs_parser" {
filename = data.archive_file.logs_parser.output_path filename = data.archive_file.logs_parser.output_path
function_name = "${var.site}-lambda" function_name = "${var.site}-logs-decorator"
handler = "index.handler" handler = "index.handler"
source_code_hash = data.archive_file.logs_parser.output_base64sha256 source_code_hash = data.archive_file.logs_parser.output_base64sha256
runtime = "nodejs12.x" runtime = "nodejs12.x"

View File

@ -31,7 +31,7 @@ EOF
resource "aws_cloudfront_distribution" "site" { resource "aws_cloudfront_distribution" "site" {
origin { origin {
domain_name = aws_s3_bucket.temp_redirect.bucket_regional_domain_name domain_name = aws_s3_bucket.src.bucket_regional_domain_name
origin_id = "S3-Website-${aws_s3_bucket.src.website_endpoint}" origin_id = "S3-Website-${aws_s3_bucket.src.website_endpoint}"
custom_origin_config { custom_origin_config {
@ -64,11 +64,11 @@ resource "aws_cloudfront_distribution" "site" {
} }
} }
# lambda_function_association { lambda_function_association {
# event_type = "origin-request" event_type = "origin-request"
# lambda_arn = aws_lambda_function.index_redirect.qualified_arn lambda_arn = aws_lambda_function.index_redirect.qualified_arn
# include_body = false include_body = false
# } }
viewer_protocol_policy = "redirect-to-https" viewer_protocol_policy = "redirect-to-https"
min_ttl = 0 min_ttl = 0
@ -128,24 +128,25 @@ resource "aws_route53_record" "www" {
# ----------------------------------------------------------------------------------------------------------- # -----------------------------------------------------------------------------------------------------------
# Lambda Subdirectory index.html Redirect # Lambda Subdirectory index.html Redirect
# data "archive_file" "index_redirect" { data "archive_file" "index_redirect" {
# type = "zip" type = "zip"
# output_path = "${path.module}/files/index_redirect.js.zip" output_path = "${path.module}/files/index_redirect.js.zip"
# source_file = "${path.module}/files/index_redirect.js" source_file = "${path.module}/files/index_redirect.js"
# } }
# resource "aws_lambda_function" "index_redirect" { resource "aws_lambda_function" "index_redirect" {
# description = "index.html subdirectory redirect" description = "index.html subdirectory redirect"
# filename = "${path.module}/files/index_redirect.js.zip" filename = "${path.module}/files/index_redirect.js.zip"
# function_name = "folder-index-redirect" function_name = "${var.site}-index-redirect"
# handler = "index_redirect.handler" handler = "index_redirect.handler"
# source_code_hash = data.archive_file.index_redirect.output_base64sha256 source_code_hash = data.archive_file.index_redirect.output_base64sha256
# publish = true publish = true
# role = aws_iam_role.lambda_redirect.arn role = aws_iam_role.lambda_redirect.arn
# runtime = "nodejs12.x" runtime = "nodejs10.x"
tags = {
Name = "${var.site}-index-redirect"
Site = var.site
}
}
# tags = {
# Name = "${var.site}-index-redirect"
# Site = var.site
# }
# }