Merge latest version #3
@@ -5,10 +5,17 @@ exports.handler = (event, context, callback) => {
|
|||||||
var request = event.Records[0].cf.request;
|
var request = event.Records[0].cf.request;
|
||||||
|
|
||||||
// Extract the URI from the request
|
// Extract the URI from the request
|
||||||
var oldURI = request.url;
|
var oldURI = request.uri;
|
||||||
|
|
||||||
// Match any '/' that occurs at the end of a URI. Replace it with a default index
|
// Match any '/' that occurs at the end of a URI. Replace it with a default index
|
||||||
var newURI = oldURI.replace(/\/$, '\/index.html'/);
|
function replace_uri(uri) {
|
||||||
|
uri = uri.replace(/\/$/, "/index.html");
|
||||||
|
// uri = uri.replace(/\.io\/search\?q\=(.*)/, ".io/search/index.html?q=$1");
|
||||||
|
// console.log(uri)
|
||||||
|
return uri;
|
||||||
|
}
|
||||||
|
// var newURI = oldURI.replace(/\/$/, "/index.html");
|
||||||
|
var newURI = replace_uri(oldURI);
|
||||||
|
|
||||||
// Log the URI as received by Cloudfront and the new URI to be used to fetch from the origin
|
// Log the URI as received by Cloudfront and the new URI to be used to fetch from the origin
|
||||||
console.log(`Old URI: ${oldURI}`);
|
console.log(`Old URI: ${oldURI}`);
|
||||||
@@ -18,5 +25,5 @@ exports.handler = (event, context, callback) => {
|
|||||||
request.uri = newURI;
|
request.uri = newURI;
|
||||||
|
|
||||||
// Return to Cloudfront
|
// Return to Cloudfront
|
||||||
return callback(null, request)
|
return callback(null, request);
|
||||||
};
|
};
|
||||||
|
|||||||
BIN
infrastructure/lambda/prod-panaetius-blog-lambda/main.js.zip
Normal file
BIN
infrastructure/lambda/prod-panaetius-blog-lambda/main.js.zip
Normal file
Binary file not shown.
Binary file not shown.
@@ -35,9 +35,6 @@ module "cloudfront_s3_cdn" {
|
|||||||
tags = local.tags
|
tags = local.tags
|
||||||
aliases = var.aliases
|
aliases = var.aliases
|
||||||
index_document = "index.html"
|
index_document = "index.html"
|
||||||
|
|
||||||
ordered_cache = [
|
|
||||||
{
|
|
||||||
lambda_function_association = [
|
lambda_function_association = [
|
||||||
{
|
{
|
||||||
event_type : "origin-request",
|
event_type : "origin-request",
|
||||||
@@ -45,8 +42,6 @@ module "cloudfront_s3_cdn" {
|
|||||||
include_body : false
|
include_body : false
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
# this policy sets the bucket to be public for all newly created files
|
# this policy sets the bucket to be public for all newly created files
|
||||||
additional_bucket_policy = <<-EOT
|
additional_bucket_policy = <<-EOT
|
||||||
@@ -65,29 +60,37 @@ module "cloudfront_s3_cdn" {
|
|||||||
EOT
|
EOT
|
||||||
}
|
}
|
||||||
|
|
||||||
# cloudfront lambda@edge
|
# # cloudfront lambda@edge
|
||||||
|
|
||||||
resource "aws_s3_bucket" "lambda_s3" {
|
# resource "aws_s3_bucket" "lambda_s3" {
|
||||||
provider = aws.us_east_1
|
# provider = aws.us_east_1
|
||||||
region = var.s3_region
|
# region = var.s3_region
|
||||||
bucket = "${var.stage}-${var.name}-lambda-function"
|
# bucket = "${var.stage}-${var.name}-lambda-function"
|
||||||
acl = var.acl
|
# acl = var.acl
|
||||||
tags = local.tags
|
# tags = local.tags
|
||||||
|
# }
|
||||||
|
|
||||||
|
data "archive_file" "lambda_main" {
|
||||||
|
type = "zip"
|
||||||
|
source_file = var.source_file
|
||||||
|
output_path = "${var.source_file}.zip"
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "aws_s3_bucket_object" "main" {
|
# resource "aws_s3_bucket_object" "main" {
|
||||||
provider = aws.us_east_1
|
# provider = aws.us_east_1
|
||||||
bucket = aws_s3_bucket.lambda_s3.id
|
# bucket = aws_s3_bucket.lambda_s3.id
|
||||||
key = var.lambda_key
|
# key = var.lambda_key
|
||||||
acl = var.acl
|
# acl = var.acl
|
||||||
source = var.source_file
|
# source = var.source_file
|
||||||
}
|
# }
|
||||||
|
|
||||||
resource "aws_lambda_function" "directory_indexes" {
|
resource "aws_lambda_function" "directory_indexes" {
|
||||||
provider = aws.us_east_1
|
provider = aws.us_east_1
|
||||||
function_name = "${var.stage}-${var.name}-directory_indexes"
|
function_name = "${var.stage}-${var.name}-directory_indexes"
|
||||||
s3_bucket = aws_s3_bucket.lambda_s3.id
|
filename = "${var.source_file}.zip"
|
||||||
s3_key = var.lambda_key
|
source_code_hash = data.archive_file.lambda_main.output_base64sha256
|
||||||
|
# s3_bucket = aws_s3_bucket.lambda_s3.id
|
||||||
|
# s3_key = var.lambda_key
|
||||||
handler = var.handler
|
handler = var.handler
|
||||||
runtime = var.runtime
|
runtime = var.runtime
|
||||||
role = aws_iam_role.lambda_role.arn
|
role = aws_iam_role.lambda_role.arn
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"version": 4,
|
"version": 4,
|
||||||
"terraform_version": "0.12.26",
|
"terraform_version": "0.12.26",
|
||||||
"serial": 244,
|
"serial": 281,
|
||||||
"lineage": "cda52006-90fc-4aec-a630-42e69057b365",
|
"lineage": "cda52006-90fc-4aec-a630-42e69057b365",
|
||||||
"outputs": {
|
"outputs": {
|
||||||
"cf_arn": {
|
"cf_arn": {
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"cf_etag": {
|
"cf_etag": {
|
||||||
"value": "E3169NR3BVK3DJ",
|
"value": "E2UYU85RHS3J18",
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"cf_hosted_zone_id": {
|
"cf_hosted_zone_id": {
|
||||||
@@ -38,6 +38,32 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"resources": [
|
"resources": [
|
||||||
|
{
|
||||||
|
"mode": "data",
|
||||||
|
"type": "archive_file",
|
||||||
|
"name": "lambda_main",
|
||||||
|
"provider": "provider.archive",
|
||||||
|
"instances": [
|
||||||
|
{
|
||||||
|
"schema_version": 0,
|
||||||
|
"attributes": {
|
||||||
|
"excludes": null,
|
||||||
|
"id": "320d4868dd37d1674e98bd790b8a54b006838d04",
|
||||||
|
"output_base64sha256": "5EVmwQDkgGfYMpMXNaWHUz3cmb/dSssoWl8mM8o3aMs=",
|
||||||
|
"output_md5": "611fc9e8b494e4b399217f632b8e35ed",
|
||||||
|
"output_path": "./lambda/prod-panaetius-blog-lambda/main.js.zip",
|
||||||
|
"output_sha": "320d4868dd37d1674e98bd790b8a54b006838d04",
|
||||||
|
"output_size": 601,
|
||||||
|
"source": [],
|
||||||
|
"source_content": null,
|
||||||
|
"source_content_filename": null,
|
||||||
|
"source_dir": null,
|
||||||
|
"source_file": "./lambda/prod-panaetius-blog-lambda/main.js",
|
||||||
|
"type": "zip"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"module": "module.cloudfront_s3_cdn",
|
"module": "module.cloudfront_s3_cdn",
|
||||||
"mode": "data",
|
"mode": "data",
|
||||||
@@ -307,7 +333,7 @@
|
|||||||
{
|
{
|
||||||
"event_type": "origin-request",
|
"event_type": "origin-request",
|
||||||
"include_body": false,
|
"include_body": false,
|
||||||
"lambda_arn": "arn:aws:lambda:us-east-1:745437999005:function:prod-panaetius-blog-directory_indexes:1"
|
"lambda_arn": "arn:aws:lambda:us-east-1:745437999005:function:prod-panaetius-blog-directory_indexes:7"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"max_ttl": 31536000,
|
"max_ttl": 31536000,
|
||||||
@@ -321,13 +347,13 @@
|
|||||||
"default_root_object": "index.html",
|
"default_root_object": "index.html",
|
||||||
"domain_name": "d244ranky0ff54.cloudfront.net",
|
"domain_name": "d244ranky0ff54.cloudfront.net",
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"etag": "E3169NR3BVK3DJ",
|
"etag": "E2UYU85RHS3J18",
|
||||||
"hosted_zone_id": "Z2FDTNDATAQYW2",
|
"hosted_zone_id": "Z2FDTNDATAQYW2",
|
||||||
"http_version": "http2",
|
"http_version": "http2",
|
||||||
"id": "E2IHXIMPI3MZ2X",
|
"id": "E2IHXIMPI3MZ2X",
|
||||||
"in_progress_validation_batches": 0,
|
"in_progress_validation_batches": 0,
|
||||||
"is_ipv6_enabled": true,
|
"is_ipv6_enabled": true,
|
||||||
"last_modified_time": "2020-07-19 01:54:58.16 +0000 UTC",
|
"last_modified_time": "2020-07-21 21:34:03.839 +0000 UTC",
|
||||||
"logging_config": [
|
"logging_config": [
|
||||||
{
|
{
|
||||||
"bucket": "prod-panaetius-blog-logs.s3.amazonaws.com",
|
"bucket": "prod-panaetius-blog-logs.s3.amazonaws.com",
|
||||||
@@ -384,6 +410,8 @@
|
|||||||
},
|
},
|
||||||
"private": "eyJzY2hlbWFfdmVyc2lvbiI6IjEifQ==",
|
"private": "eyJzY2hlbWFfdmVyc2lvbiI6IjEifQ==",
|
||||||
"dependencies": [
|
"dependencies": [
|
||||||
|
"aws_iam_role.lambda_role",
|
||||||
|
"aws_iam_role_policy_attachment.lambda_logging",
|
||||||
"aws_lambda_function.directory_indexes",
|
"aws_lambda_function.directory_indexes",
|
||||||
"module.cloudfront_s3_cdn.aws_cloudfront_origin_access_identity.default",
|
"module.cloudfront_s3_cdn.aws_cloudfront_origin_access_identity.default",
|
||||||
"module.cloudfront_s3_cdn.aws_s3_bucket.origin",
|
"module.cloudfront_s3_cdn.aws_s3_bucket.origin",
|
||||||
@@ -446,7 +474,7 @@
|
|||||||
"attributes": {
|
"attributes": {
|
||||||
"arn": "arn:aws:iam::745437999005:role/prod-panaetius-blog-lambda",
|
"arn": "arn:aws:iam::745437999005:role/prod-panaetius-blog-lambda",
|
||||||
"assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Principal\":{\"Service\":[\"lambda.amazonaws.com\",\"edgelambda.amazonaws.com\"]},\"Action\":\"sts:AssumeRole\"}]}",
|
"assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Principal\":{\"Service\":[\"lambda.amazonaws.com\",\"edgelambda.amazonaws.com\"]},\"Action\":\"sts:AssumeRole\"}]}",
|
||||||
"create_date": "2020-07-19T01:43:08Z",
|
"create_date": "2020-07-21T20:01:43Z",
|
||||||
"description": "",
|
"description": "",
|
||||||
"force_detach_policies": false,
|
"force_detach_policies": false,
|
||||||
"id": "prod-panaetius-blog-lambda",
|
"id": "prod-panaetius-blog-lambda",
|
||||||
@@ -459,7 +487,7 @@
|
|||||||
"Description": "terraform resources to host the blog",
|
"Description": "terraform resources to host the blog",
|
||||||
"Project": "panaetius-blog"
|
"Project": "panaetius-blog"
|
||||||
},
|
},
|
||||||
"unique_id": "AROA23D4RF6OUVG5PVTDO"
|
"unique_id": "AROA23D4RF6O2VEGAGEXM"
|
||||||
},
|
},
|
||||||
"private": "bnVsbA=="
|
"private": "bnVsbA=="
|
||||||
}
|
}
|
||||||
@@ -474,7 +502,7 @@
|
|||||||
{
|
{
|
||||||
"schema_version": 0,
|
"schema_version": 0,
|
||||||
"attributes": {
|
"attributes": {
|
||||||
"id": "prod-panaetius-blog-lambda-20200719014309715500000001",
|
"id": "prod-panaetius-blog-lambda-20200721200145100500000001",
|
||||||
"policy_arn": "arn:aws:iam::745437999005:policy/prod-panaetius-blog-lambda_logging",
|
"policy_arn": "arn:aws:iam::745437999005:policy/prod-panaetius-blog-lambda_logging",
|
||||||
"role": "prod-panaetius-blog-lambda"
|
"role": "prod-panaetius-blog-lambda"
|
||||||
},
|
},
|
||||||
@@ -500,25 +528,25 @@
|
|||||||
"description": "",
|
"description": "",
|
||||||
"environment": [],
|
"environment": [],
|
||||||
"file_system_config": [],
|
"file_system_config": [],
|
||||||
"filename": null,
|
"filename": "./lambda/prod-panaetius-blog-lambda/main.js.zip",
|
||||||
"function_name": "prod-panaetius-blog-directory_indexes",
|
"function_name": "prod-panaetius-blog-directory_indexes",
|
||||||
"handler": "main.handler",
|
"handler": "main.handler",
|
||||||
"id": "prod-panaetius-blog-directory_indexes",
|
"id": "prod-panaetius-blog-directory_indexes",
|
||||||
"invoke_arn": "arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-1:745437999005:function:prod-panaetius-blog-directory_indexes/invocations",
|
"invoke_arn": "arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-1:745437999005:function:prod-panaetius-blog-directory_indexes/invocations",
|
||||||
"kms_key_arn": "",
|
"kms_key_arn": "",
|
||||||
"last_modified": "2020-07-19T01:48:58.316+0000",
|
"last_modified": "2020-07-21T21:34:00.971+0000",
|
||||||
"layers": [],
|
"layers": [],
|
||||||
"memory_size": 128,
|
"memory_size": 128,
|
||||||
"publish": true,
|
"publish": true,
|
||||||
"qualified_arn": "arn:aws:lambda:us-east-1:745437999005:function:prod-panaetius-blog-directory_indexes:1",
|
"qualified_arn": "arn:aws:lambda:us-east-1:745437999005:function:prod-panaetius-blog-directory_indexes:7",
|
||||||
"reserved_concurrent_executions": -1,
|
"reserved_concurrent_executions": -1,
|
||||||
"role": "arn:aws:iam::745437999005:role/prod-panaetius-blog-lambda",
|
"role": "arn:aws:iam::745437999005:role/prod-panaetius-blog-lambda",
|
||||||
"runtime": "nodejs12.x",
|
"runtime": "nodejs12.x",
|
||||||
"s3_bucket": "prod-panaetius-blog-lambda-function",
|
"s3_bucket": null,
|
||||||
"s3_key": "main.zip",
|
"s3_key": null,
|
||||||
"s3_object_version": null,
|
"s3_object_version": null,
|
||||||
"source_code_hash": "ltLABbdLTpAeXF5xOPf8vYj2Tq2wvINv206umQzPv0E=",
|
"source_code_hash": "5EVmwQDkgGfYMpMXNaWHUz3cmb/dSssoWl8mM8o3aMs=",
|
||||||
"source_code_size": 546,
|
"source_code_size": 601,
|
||||||
"tags": {
|
"tags": {
|
||||||
"Description": "terraform resources to host the blog",
|
"Description": "terraform resources to host the blog",
|
||||||
"Project": "panaetius-blog"
|
"Project": "panaetius-blog"
|
||||||
@@ -530,14 +558,13 @@
|
|||||||
"mode": "PassThrough"
|
"mode": "PassThrough"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"version": "1",
|
"version": "7",
|
||||||
"vpc_config": []
|
"vpc_config": []
|
||||||
},
|
},
|
||||||
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDB9fQ==",
|
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDB9fQ==",
|
||||||
"dependencies": [
|
"dependencies": [
|
||||||
"aws_iam_role.lambda_role",
|
"aws_iam_role.lambda_role",
|
||||||
"aws_iam_role_policy_attachment.lambda_logging",
|
"aws_iam_role_policy_attachment.lambda_logging"
|
||||||
"aws_s3_bucket.lambda_s3"
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@@ -736,53 +763,6 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"mode": "managed",
|
|
||||||
"type": "aws_s3_bucket",
|
|
||||||
"name": "lambda_s3",
|
|
||||||
"provider": "provider.aws.us_east_1",
|
|
||||||
"instances": [
|
|
||||||
{
|
|
||||||
"schema_version": 0,
|
|
||||||
"attributes": {
|
|
||||||
"acceleration_status": "",
|
|
||||||
"acl": "private",
|
|
||||||
"arn": "arn:aws:s3:::prod-panaetius-blog-lambda-function",
|
|
||||||
"bucket": "prod-panaetius-blog-lambda-function",
|
|
||||||
"bucket_domain_name": "prod-panaetius-blog-lambda-function.s3.amazonaws.com",
|
|
||||||
"bucket_prefix": null,
|
|
||||||
"bucket_regional_domain_name": "prod-panaetius-blog-lambda-function.s3.amazonaws.com",
|
|
||||||
"cors_rule": [],
|
|
||||||
"force_destroy": false,
|
|
||||||
"grant": [],
|
|
||||||
"hosted_zone_id": "Z3AQBSTGFYJSTF",
|
|
||||||
"id": "prod-panaetius-blog-lambda-function",
|
|
||||||
"lifecycle_rule": [],
|
|
||||||
"logging": [],
|
|
||||||
"object_lock_configuration": [],
|
|
||||||
"policy": null,
|
|
||||||
"region": "us-east-1",
|
|
||||||
"replication_configuration": [],
|
|
||||||
"request_payer": "BucketOwner",
|
|
||||||
"server_side_encryption_configuration": [],
|
|
||||||
"tags": {
|
|
||||||
"Description": "terraform resources to host the blog",
|
|
||||||
"Project": "panaetius-blog"
|
|
||||||
},
|
|
||||||
"versioning": [
|
|
||||||
{
|
|
||||||
"enabled": false,
|
|
||||||
"mfa_delete": false
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"website": [],
|
|
||||||
"website_domain": null,
|
|
||||||
"website_endpoint": null
|
|
||||||
},
|
|
||||||
"private": "bnVsbA=="
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"module": "module.cloudfront_s3_cdn",
|
"module": "module.cloudfront_s3_cdn",
|
||||||
"mode": "managed",
|
"mode": "managed",
|
||||||
@@ -856,47 +836,6 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"mode": "managed",
|
|
||||||
"type": "aws_s3_bucket_object",
|
|
||||||
"name": "main",
|
|
||||||
"provider": "provider.aws.us_east_1",
|
|
||||||
"instances": [
|
|
||||||
{
|
|
||||||
"schema_version": 0,
|
|
||||||
"attributes": {
|
|
||||||
"acl": "private",
|
|
||||||
"bucket": "prod-panaetius-blog-lambda-function",
|
|
||||||
"cache_control": "",
|
|
||||||
"content": null,
|
|
||||||
"content_base64": null,
|
|
||||||
"content_disposition": "",
|
|
||||||
"content_encoding": "",
|
|
||||||
"content_language": "",
|
|
||||||
"content_type": "binary/octet-stream",
|
|
||||||
"etag": "e93809f5fe6e069bfa1fbee683a28d8c",
|
|
||||||
"force_destroy": false,
|
|
||||||
"id": "main.zip",
|
|
||||||
"key": "main.zip",
|
|
||||||
"kms_key_id": null,
|
|
||||||
"metadata": {},
|
|
||||||
"object_lock_legal_hold_status": "",
|
|
||||||
"object_lock_mode": "",
|
|
||||||
"object_lock_retain_until_date": "",
|
|
||||||
"server_side_encryption": "",
|
|
||||||
"source": "./lambda/prod-panaetius-blog-lambda/main.zip",
|
|
||||||
"storage_class": "STANDARD",
|
|
||||||
"tags": {},
|
|
||||||
"version_id": "",
|
|
||||||
"website_redirect": ""
|
|
||||||
},
|
|
||||||
"private": "bnVsbA==",
|
|
||||||
"dependencies": [
|
|
||||||
"aws_s3_bucket.lambda_s3"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"module": "module.cloudfront_s3_cdn",
|
"module": "module.cloudfront_s3_cdn",
|
||||||
"mode": "managed",
|
"mode": "managed",
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"version": 4,
|
"version": 4,
|
||||||
"terraform_version": "0.12.26",
|
"terraform_version": "0.12.26",
|
||||||
"serial": 242,
|
"serial": 278,
|
||||||
"lineage": "cda52006-90fc-4aec-a630-42e69057b365",
|
"lineage": "cda52006-90fc-4aec-a630-42e69057b365",
|
||||||
"outputs": {
|
"outputs": {
|
||||||
"cf_arn": {
|
"cf_arn": {
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"cf_etag": {
|
"cf_etag": {
|
||||||
"value": "E3169NR3BVK3DJ",
|
"value": "E1CTWNZ643PUQZ",
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"cf_hosted_zone_id": {
|
"cf_hosted_zone_id": {
|
||||||
@@ -38,6 +38,32 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"resources": [
|
"resources": [
|
||||||
|
{
|
||||||
|
"mode": "data",
|
||||||
|
"type": "archive_file",
|
||||||
|
"name": "lambda_main",
|
||||||
|
"provider": "provider.archive",
|
||||||
|
"instances": [
|
||||||
|
{
|
||||||
|
"schema_version": 0,
|
||||||
|
"attributes": {
|
||||||
|
"excludes": null,
|
||||||
|
"id": "502af9bcd8bac1822a4052c962a3bd322746084b",
|
||||||
|
"output_base64sha256": "W5HchTpXhL2+aBI5O1Qzo25q4hxfbf+uhEln7zcrZpM=",
|
||||||
|
"output_md5": "e7f26d9ad3488ef6867a7f6bc2a7356a",
|
||||||
|
"output_path": "./lambda/prod-panaetius-blog-lambda/main.js.zip",
|
||||||
|
"output_sha": "502af9bcd8bac1822a4052c962a3bd322746084b",
|
||||||
|
"output_size": 597,
|
||||||
|
"source": [],
|
||||||
|
"source_content": null,
|
||||||
|
"source_content_filename": null,
|
||||||
|
"source_dir": null,
|
||||||
|
"source_file": "./lambda/prod-panaetius-blog-lambda/main.js",
|
||||||
|
"type": "zip"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"module": "module.cloudfront_s3_cdn",
|
"module": "module.cloudfront_s3_cdn",
|
||||||
"mode": "data",
|
"mode": "data",
|
||||||
@@ -307,7 +333,7 @@
|
|||||||
{
|
{
|
||||||
"event_type": "origin-request",
|
"event_type": "origin-request",
|
||||||
"include_body": false,
|
"include_body": false,
|
||||||
"lambda_arn": "arn:aws:lambda:us-east-1:745437999005:function:prod-panaetius-blog-directory_indexes:1"
|
"lambda_arn": "arn:aws:lambda:us-east-1:745437999005:function:prod-panaetius-blog-directory_indexes:6"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"max_ttl": 31536000,
|
"max_ttl": 31536000,
|
||||||
@@ -321,13 +347,13 @@
|
|||||||
"default_root_object": "index.html",
|
"default_root_object": "index.html",
|
||||||
"domain_name": "d244ranky0ff54.cloudfront.net",
|
"domain_name": "d244ranky0ff54.cloudfront.net",
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"etag": "E3169NR3BVK3DJ",
|
"etag": "E1CTWNZ643PUQZ",
|
||||||
"hosted_zone_id": "Z2FDTNDATAQYW2",
|
"hosted_zone_id": "Z2FDTNDATAQYW2",
|
||||||
"http_version": "http2",
|
"http_version": "http2",
|
||||||
"id": "E2IHXIMPI3MZ2X",
|
"id": "E2IHXIMPI3MZ2X",
|
||||||
"in_progress_validation_batches": 0,
|
"in_progress_validation_batches": 0,
|
||||||
"is_ipv6_enabled": true,
|
"is_ipv6_enabled": true,
|
||||||
"last_modified_time": "2020-07-19 01:54:58.16 +0000 UTC",
|
"last_modified_time": "2020-07-21 21:18:38.945 +0000 UTC",
|
||||||
"logging_config": [
|
"logging_config": [
|
||||||
{
|
{
|
||||||
"bucket": "prod-panaetius-blog-logs.s3.amazonaws.com",
|
"bucket": "prod-panaetius-blog-logs.s3.amazonaws.com",
|
||||||
@@ -384,6 +410,8 @@
|
|||||||
},
|
},
|
||||||
"private": "eyJzY2hlbWFfdmVyc2lvbiI6IjEifQ==",
|
"private": "eyJzY2hlbWFfdmVyc2lvbiI6IjEifQ==",
|
||||||
"dependencies": [
|
"dependencies": [
|
||||||
|
"aws_iam_role.lambda_role",
|
||||||
|
"aws_iam_role_policy_attachment.lambda_logging",
|
||||||
"aws_lambda_function.directory_indexes",
|
"aws_lambda_function.directory_indexes",
|
||||||
"module.cloudfront_s3_cdn.aws_cloudfront_origin_access_identity.default",
|
"module.cloudfront_s3_cdn.aws_cloudfront_origin_access_identity.default",
|
||||||
"module.cloudfront_s3_cdn.aws_s3_bucket.origin",
|
"module.cloudfront_s3_cdn.aws_s3_bucket.origin",
|
||||||
@@ -445,8 +473,8 @@
|
|||||||
"schema_version": 0,
|
"schema_version": 0,
|
||||||
"attributes": {
|
"attributes": {
|
||||||
"arn": "arn:aws:iam::745437999005:role/prod-panaetius-blog-lambda",
|
"arn": "arn:aws:iam::745437999005:role/prod-panaetius-blog-lambda",
|
||||||
"assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Sid\":\"\",\"Effect\":\"Allow\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},\"Action\":\"sts:AssumeRole\"},{\"Sid\":\"\",\"Effect\":\"Allow\",\"Principal\":{\"Service\":\"edgelambda.amazonaws.com\"},\"Action\":\"sts:AssumeRole\"}]}",
|
"assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Principal\":{\"Service\":[\"lambda.amazonaws.com\",\"edgelambda.amazonaws.com\"]},\"Action\":\"sts:AssumeRole\"}]}",
|
||||||
"create_date": "2020-07-19T01:43:08Z",
|
"create_date": "2020-07-21T20:01:43Z",
|
||||||
"description": "",
|
"description": "",
|
||||||
"force_detach_policies": false,
|
"force_detach_policies": false,
|
||||||
"id": "prod-panaetius-blog-lambda",
|
"id": "prod-panaetius-blog-lambda",
|
||||||
@@ -459,7 +487,7 @@
|
|||||||
"Description": "terraform resources to host the blog",
|
"Description": "terraform resources to host the blog",
|
||||||
"Project": "panaetius-blog"
|
"Project": "panaetius-blog"
|
||||||
},
|
},
|
||||||
"unique_id": "AROA23D4RF6OUVG5PVTDO"
|
"unique_id": "AROA23D4RF6O2VEGAGEXM"
|
||||||
},
|
},
|
||||||
"private": "bnVsbA=="
|
"private": "bnVsbA=="
|
||||||
}
|
}
|
||||||
@@ -474,7 +502,7 @@
|
|||||||
{
|
{
|
||||||
"schema_version": 0,
|
"schema_version": 0,
|
||||||
"attributes": {
|
"attributes": {
|
||||||
"id": "prod-panaetius-blog-lambda-20200719014309715500000001",
|
"id": "prod-panaetius-blog-lambda-20200721200145100500000001",
|
||||||
"policy_arn": "arn:aws:iam::745437999005:policy/prod-panaetius-blog-lambda_logging",
|
"policy_arn": "arn:aws:iam::745437999005:policy/prod-panaetius-blog-lambda_logging",
|
||||||
"role": "prod-panaetius-blog-lambda"
|
"role": "prod-panaetius-blog-lambda"
|
||||||
},
|
},
|
||||||
@@ -500,25 +528,25 @@
|
|||||||
"description": "",
|
"description": "",
|
||||||
"environment": [],
|
"environment": [],
|
||||||
"file_system_config": [],
|
"file_system_config": [],
|
||||||
"filename": null,
|
"filename": "./lambda/prod-panaetius-blog-lambda/main.js.zip",
|
||||||
"function_name": "prod-panaetius-blog-directory_indexes",
|
"function_name": "prod-panaetius-blog-directory_indexes",
|
||||||
"handler": "main.handler",
|
"handler": "main.handler",
|
||||||
"id": "prod-panaetius-blog-directory_indexes",
|
"id": "prod-panaetius-blog-directory_indexes",
|
||||||
"invoke_arn": "arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-1:745437999005:function:prod-panaetius-blog-directory_indexes/invocations",
|
"invoke_arn": "arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-1:745437999005:function:prod-panaetius-blog-directory_indexes/invocations",
|
||||||
"kms_key_arn": "",
|
"kms_key_arn": "",
|
||||||
"last_modified": "2020-07-19T01:48:58.316+0000",
|
"last_modified": "2020-07-21T21:18:36.437+0000",
|
||||||
"layers": [],
|
"layers": [],
|
||||||
"memory_size": 128,
|
"memory_size": 128,
|
||||||
"publish": true,
|
"publish": true,
|
||||||
"qualified_arn": "arn:aws:lambda:us-east-1:745437999005:function:prod-panaetius-blog-directory_indexes:1",
|
"qualified_arn": "arn:aws:lambda:us-east-1:745437999005:function:prod-panaetius-blog-directory_indexes:6",
|
||||||
"reserved_concurrent_executions": -1,
|
"reserved_concurrent_executions": -1,
|
||||||
"role": "arn:aws:iam::745437999005:role/prod-panaetius-blog-lambda",
|
"role": "arn:aws:iam::745437999005:role/prod-panaetius-blog-lambda",
|
||||||
"runtime": "nodejs12.x",
|
"runtime": "nodejs12.x",
|
||||||
"s3_bucket": "prod-panaetius-blog-lambda-function",
|
"s3_bucket": null,
|
||||||
"s3_key": "main.zip",
|
"s3_key": null,
|
||||||
"s3_object_version": null,
|
"s3_object_version": null,
|
||||||
"source_code_hash": "ltLABbdLTpAeXF5xOPf8vYj2Tq2wvINv206umQzPv0E=",
|
"source_code_hash": "W5HchTpXhL2+aBI5O1Qzo25q4hxfbf+uhEln7zcrZpM=",
|
||||||
"source_code_size": 546,
|
"source_code_size": 597,
|
||||||
"tags": {
|
"tags": {
|
||||||
"Description": "terraform resources to host the blog",
|
"Description": "terraform resources to host the blog",
|
||||||
"Project": "panaetius-blog"
|
"Project": "panaetius-blog"
|
||||||
@@ -530,14 +558,13 @@
|
|||||||
"mode": "PassThrough"
|
"mode": "PassThrough"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"version": "1",
|
"version": "6",
|
||||||
"vpc_config": []
|
"vpc_config": []
|
||||||
},
|
},
|
||||||
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDB9fQ==",
|
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDB9fQ==",
|
||||||
"dependencies": [
|
"dependencies": [
|
||||||
"aws_iam_role.lambda_role",
|
"aws_iam_role.lambda_role",
|
||||||
"aws_iam_role_policy_attachment.lambda_logging",
|
"aws_iam_role_policy_attachment.lambda_logging"
|
||||||
"aws_s3_bucket.lambda_s3"
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@@ -736,53 +763,6 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"mode": "managed",
|
|
||||||
"type": "aws_s3_bucket",
|
|
||||||
"name": "lambda_s3",
|
|
||||||
"provider": "provider.aws.us_east_1",
|
|
||||||
"instances": [
|
|
||||||
{
|
|
||||||
"schema_version": 0,
|
|
||||||
"attributes": {
|
|
||||||
"acceleration_status": "",
|
|
||||||
"acl": "private",
|
|
||||||
"arn": "arn:aws:s3:::prod-panaetius-blog-lambda-function",
|
|
||||||
"bucket": "prod-panaetius-blog-lambda-function",
|
|
||||||
"bucket_domain_name": "prod-panaetius-blog-lambda-function.s3.amazonaws.com",
|
|
||||||
"bucket_prefix": null,
|
|
||||||
"bucket_regional_domain_name": "prod-panaetius-blog-lambda-function.s3.amazonaws.com",
|
|
||||||
"cors_rule": [],
|
|
||||||
"force_destroy": false,
|
|
||||||
"grant": [],
|
|
||||||
"hosted_zone_id": "Z3AQBSTGFYJSTF",
|
|
||||||
"id": "prod-panaetius-blog-lambda-function",
|
|
||||||
"lifecycle_rule": [],
|
|
||||||
"logging": [],
|
|
||||||
"object_lock_configuration": [],
|
|
||||||
"policy": null,
|
|
||||||
"region": "us-east-1",
|
|
||||||
"replication_configuration": [],
|
|
||||||
"request_payer": "BucketOwner",
|
|
||||||
"server_side_encryption_configuration": [],
|
|
||||||
"tags": {
|
|
||||||
"Description": "terraform resources to host the blog",
|
|
||||||
"Project": "panaetius-blog"
|
|
||||||
},
|
|
||||||
"versioning": [
|
|
||||||
{
|
|
||||||
"enabled": false,
|
|
||||||
"mfa_delete": false
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"website": [],
|
|
||||||
"website_domain": null,
|
|
||||||
"website_endpoint": null
|
|
||||||
},
|
|
||||||
"private": "bnVsbA=="
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"module": "module.cloudfront_s3_cdn",
|
"module": "module.cloudfront_s3_cdn",
|
||||||
"mode": "managed",
|
"mode": "managed",
|
||||||
@@ -856,47 +836,6 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"mode": "managed",
|
|
||||||
"type": "aws_s3_bucket_object",
|
|
||||||
"name": "main",
|
|
||||||
"provider": "provider.aws.us_east_1",
|
|
||||||
"instances": [
|
|
||||||
{
|
|
||||||
"schema_version": 0,
|
|
||||||
"attributes": {
|
|
||||||
"acl": "private",
|
|
||||||
"bucket": "prod-panaetius-blog-lambda-function",
|
|
||||||
"cache_control": "",
|
|
||||||
"content": null,
|
|
||||||
"content_base64": null,
|
|
||||||
"content_disposition": "",
|
|
||||||
"content_encoding": "",
|
|
||||||
"content_language": "",
|
|
||||||
"content_type": "binary/octet-stream",
|
|
||||||
"etag": "e93809f5fe6e069bfa1fbee683a28d8c",
|
|
||||||
"force_destroy": false,
|
|
||||||
"id": "main.zip",
|
|
||||||
"key": "main.zip",
|
|
||||||
"kms_key_id": null,
|
|
||||||
"metadata": {},
|
|
||||||
"object_lock_legal_hold_status": "",
|
|
||||||
"object_lock_mode": "",
|
|
||||||
"object_lock_retain_until_date": "",
|
|
||||||
"server_side_encryption": "",
|
|
||||||
"source": "./lambda/prod-panaetius-blog-lambda/main.zip",
|
|
||||||
"storage_class": "STANDARD",
|
|
||||||
"tags": {},
|
|
||||||
"version_id": "",
|
|
||||||
"website_redirect": ""
|
|
||||||
},
|
|
||||||
"private": "bnVsbA==",
|
|
||||||
"dependencies": [
|
|
||||||
"aws_s3_bucket.lambda_s3"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"module": "module.cloudfront_s3_cdn",
|
"module": "module.cloudfront_s3_cdn",
|
||||||
"mode": "managed",
|
"mode": "managed",
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ allowed_origins = ["*.panaetius.io"]
|
|||||||
# s3 & lambda
|
# s3 & lambda
|
||||||
acl = "private"
|
acl = "private"
|
||||||
lambda_key = "main.zip"
|
lambda_key = "main.zip"
|
||||||
source_file = "./lambda/prod-panaetius-blog-lambda/main.zip"
|
source_file = "./lambda/prod-panaetius-blog-lambda/main.js"
|
||||||
handler = "main.handler"
|
handler = "main.handler"
|
||||||
runtime = "nodejs12.x"
|
runtime = "nodejs12.x"
|
||||||
s3_region = "us-east-1"
|
s3_region = "us-east-1"
|
||||||
|
|||||||
Reference in New Issue
Block a user