diff --git a/terraform/lambda.tf b/terraform/lambda.tf index 1611c1c..b67197d 100644 --- a/terraform/lambda.tf +++ b/terraform/lambda.tf @@ -3,26 +3,23 @@ # ----------------------------------------------------------------------------------------------------------- # IAM Role for Redirect Lambda +data "aws_iam_policy_document" "lambda_redirect" { + statement { + actions = ["sts:AssumeRole"] + + principals { + type = "Service" + identifiers = [ + "edgelambda.amazonaws.com", + "lambda.amazonaws.com" + ] + } + } +} + resource "aws_iam_role" "lambda_redirect" { name = "${var.site}-lambda-redirect-role" - assume_role_policy = <<EOF -{ - "Version": "2012-10-17", - "Statement": [ - { - "Action": "sts:AssumeRole", - "Principal": { - "Service": [ - "edgelambda.amazonaws.com", - "lambda.amazonaws.com" - ] - }, - "Effect": "Allow", - "Sid": "" - } - ] -} -EOF + assume_role_policy = data.aws_iam_policy_document.lambda_redirect.json tags = { Site = var.site @@ -60,9 +57,6 @@ data "aws_iam_policy_document" "lambda_assume_role" { } } - - - resource "aws_iam_role" "ipixel_parser" { name = "lambda-${var.site}-ipixel" diff --git a/terraform/www.tf b/terraform/www.tf index ba2bdb6..2527231 100644 --- a/terraform/www.tf +++ b/terraform/www.tf @@ -1,31 +1,4 @@ -resource "aws_s3_bucket" "temp_redirect" { - bucket = "${var.site}-redirect" - acl = "public-read" - - website { - index_document = "index.html" - error_document = "index.html" - # redirect_all_requests_to = "https://curvyandtrans.com/p/740D5B/gender-dysphoria/" - } -} - -resource "aws_s3_bucket_object" "redirect_page" { - bucket = aws_s3_bucket.temp_redirect.bucket - key = "index.html" - acl = "public-read" - content_type = "text/html" - - metadata = { - "website-redirect-location" = "https://curvyandtrans.com/p/740D5B/gender-dysphoria/" - } - content = <<EOF -<html xmlns="http://www.w3.org/1999/xhtml"><head> - <meta http-equiv="refresh" content="0;URL='https://curvyandtrans.com/p/740D5B/gender-dysphoria/'" /> -</head><body></body></html> -EOF -} - # ----------------------------------------------------------------------------------------------------------- # Cloudfront Configuration