Some small terraform updates

This commit is contained in:
Jocelyn Badgley (Twipped) 2021-08-11 10:20:45 -07:00
parent bcd1981d9a
commit 84133bd212
2 changed files with 15 additions and 48 deletions

View File

@ -3,26 +3,23 @@
# -----------------------------------------------------------------------------------------------------------
# IAM Role for Redirect Lambda
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": [
data "aws_iam_policy_document" "lambda_redirect" {
statement {
actions = ["sts:AssumeRole"]
principals {
type = "Service"
identifiers = [
"edgelambda.amazonaws.com",
"lambda.amazonaws.com"
]
},
"Effect": "Allow",
"Sid": ""
}
]
}
}
EOF
resource "aws_iam_role" "lambda_redirect" {
name = "${var.site}-lambda-redirect-role"
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"

View File

@ -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