Merge latest version #3

Merged
dtomlinson merged 18 commits from develop into master 2020-07-22 23:03:57 +00:00
29 changed files with 575 additions and 157 deletions

1
.gitignore vendored
View File

@@ -18,6 +18,7 @@ blog/node_modules
# static # static
blog/static blog/static
!blog/static/images/*
test/ test/
.DS_Store .DS_Store

View File

@@ -1,4 +1,5 @@
baseURL = "http://127.0.0.1:6060" baseURL = "https://panaetius.io/"
# relativeURLs = true
title = "panaetius.io" title = "panaetius.io"
# theme = "panaetius-chunky-theme" # theme = "panaetius-chunky-theme"
theme = ["hugo-notice-admonition", "panaetius-theme"] theme = ["hugo-notice-admonition", "panaetius-theme"]
@@ -83,5 +84,6 @@ page = ["HTML", "RSS"]
[markup] [markup]
[markup.highlight] [markup.highlight]
style = "monokailight" # style = "monokailight"
style = "paraiso-dark"
lineNos = true lineNos = true

View File

@@ -1,5 +1,5 @@
--- ---
title: "Really long title Second Post Copy for layout scaling with flexbox using css 2." title: "Really long title Second Post Copy for layout scaling with flexbox using css 2"
date: "2020-05-05T02:14:50+01:00" date: "2020-05-05T02:14:50+01:00"
images: ["images/banner.svg"] images: ["images/banner.svg"]
draft: true draft: true

View File

@@ -1,5 +1,5 @@
--- ---
title: "Really long title Second Post Copy for layout scaling with flexbox using css." title: "Really long title Second Post Copy for layout scaling with flexbox using css"
date: "2020-05-06T02:14:51+01:00" date: "2020-05-06T02:14:51+01:00"
images: images:
- "images/banner.svg" - "images/banner.svg"

View File

@@ -6,7 +6,6 @@ images:
draft: true draft: true
authors: authors:
- "Daniel Tomlinson" - "Daniel Tomlinson"
- "New Authors"
tags: tags:
- "Introduction" - "Introduction"
- "test" - "test"

View File

@@ -14,14 +14,7 @@
"webpack": "^4.43.0" "webpack": "^4.43.0"
}, },
"scripts": { "scripts": {
"buildSearch": "gulp buildSearch",
"buildHugo": "gulp buildHugo",
"buildBlog": "gulp buildBlog", "buildBlog": "gulp buildBlog",
"buildTheme": "gulp buildTheme", "buildLunr": "gulp buildLunr"
"buildLunr": "gulp buildLunr",
"cleanJS": "gulp cleanJS",
"insertJS": "gulp insertJS",
"minifyJS": "gulp minifyJS",
"minifyImages": "gulp minifyImages"
} }
} }

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 203 KiB

View File

@@ -0,0 +1 @@
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" x="0" y="0" viewBox="0 0 512 512" xml:space="preserve"><style>.st6{fill:#aac3d7}.st9{fill:#329682}.st10{fill:#fff}.st11{fill:#9b5faa}.st15{fill:#784687}</style><path d="M404.241 352.8h-304v-216c0-66.274 53.726-120 120-120h64c66.274 0 120 53.726 120 120v216z" fill="#7dc8aa"/><path d="M308.241 216.8h24c13.255 0 24-10.745 24-24v-24c0-13.255-10.745-24-24-24h-104c-13.255 0-24 10.745-24 24v40l8 16v16c0 8.836 7.163 16 16 16h-24c-8.837 0-16-7.164-16-16v-112h-48v32c0 8.836 7.163 16 16 16v64c0 26.51 21.49 48 48 48h40v22.059c0 6.365 2.529 12.47 7.029 16.971l8.971 8.971c-8.836 0-16 7.164-16 16h112c0-8.836-7.163-16-16-16l8.971-8.971a23.998 23.998 0 007.029-16.97V240.8h-64v-8c0-8.836 7.164-16 16-16z" fill="#147864"/><path class="st9" d="M180.241 144.8h-20a4 4 0 00-4 4c0 6.627 5.373 12 12 12h4c0 8.837 7.164 16 16 16v-24a8 8 0 00-8-8zm72 112h-24c-8.837 0-16-7.163-16-16v-16l-8-16v-40c0-13.255 10.745-24 24-24h104c13.255 0 24 10.745 24 24h-72a8 8 0 00-8 8v32l-8 16v16c0 8.837-7.163 16-16 16zm-80-176a8 8 0 000 16v16h-32a8 8 0 000 16h48v-32c0-8.836-7.163-16-16-16z"/><path d="M232.241 200.8h-4c-8.837 0-16-7.163-16-16v-6.667a4 4 0 014-4h4c8.837 0 16 7.163 16 16v6.667a4 4 0 01-4 4zm16 0h4c8.837 0 16-7.163 16-16v-6.667a4 4 0 00-4-4h-4c-8.837 0-16 7.163-16 16v6.667a4 4 0 004 4z" fill="#323232"/><circle class="st6" cx="221.575" cy="183.467" r="4"/><circle class="st6" cx="258.908" cy="183.467" r="4"/><path class="st9" d="M364.241 256.8c0-13.255-10.745-24-24-24s-24 10.745-24 24c0 7.107 3.091 13.489 8 17.884V352.8h32v-78.116c4.909-4.395 8-10.777 8-17.884z"/><path class="st10" d="M372.241 144.8a8 8 0 01-8-8c0-44.112-35.888-80-80-80a8 8 0 010-16c52.935 0 96 43.065 96 96a8 8 0 01-8 8zm0 40a8 8 0 01-8-8v-8a8 8 0 0116 0v8a8 8 0 01-8 8z"/><circle class="st11" cx="252.241" cy="464.8" r="32"/><circle class="st11" cx="364.241" cy="464.8" r="32"/><circle class="st11" cx="140.241" cy="464.8" r="32"/><path fill="#faa51e" d="M452.241 400.8h-400l48-48h304z"/><path d="M404.241 464.8h-304c-26.51 0-48-21.49-48-48v-16h400v16c0 26.51-21.49 48-48 48z" fill="#463c4b"/><path d="M252.241 464.8h152c26.51 0 48-21.49 48-48h-176c-13.255 0-24 10.745-24 24v24z" fill="#32283c"/><path fill="#d76e28" d="M452.241 400.8l-48-48h-152v48z"/><circle class="st11" cx="76.241" cy="376.8" r="10.667"/><circle class="st11" cx="193.575" cy="376.8" r="10.667"/><circle class="st15" cx="310.908" cy="376.8" r="10.667"/><circle class="st15" cx="428.241" cy="376.8" r="10.667"/><path class="st10" d="M172.241 68.8c11.028 0 20 8.972 20 20s-8.972 20-20 20-20-8.972-20-20 8.972-20 20-20m0-4c-13.255 0-24 10.745-24 24s10.745 24 24 24 24-10.745 24-24-10.745-24-24-24z"/><circle class="st10" cx="172.241" cy="88.8" r="8"/></svg>

After

Width:  |  Height:  |  Size: 2.7 KiB

BIN
blog/static/images/icons/Gods.png LFS Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -1,6 +1,6 @@
# Webpack # Webpack
TODO: This note should also go under a note for structuring a website.s TODO: This note should also go under a note for structuring a website.
Great tutorial for the basics: <https://www.sitepoint.com/bundle-static-site-webpack/>. Great tutorial for the basics: <https://www.sitepoint.com/bundle-static-site-webpack/>.

View File

@@ -0,0 +1,29 @@
"use strict";
exports.handler = (event, context, callback) => {
// Extract the request from the Cloudfront event that is sent to Lambda@Edge
var request = event.Records[0].cf.request;
// Extract the URI from the request
var oldURI = request.uri;
// Match any '/' that occurs at the end of a URI. Replace it with a default index
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
console.log(`Old URI: ${oldURI}`);
console.log(`New URI: ${newURI}`);
// Replace the received URI with the URI that includes the index page
request.uri = newURI;
// Return to Cloudfront
return callback(null, request);
};

View File

@@ -1,9 +1,17 @@
# aws config
provider "aws" { provider "aws" {
region = var.region region = var.region
profile = var.profile profile = var.profile
version = "~> 2.66" version = "~> 2.66"
} }
provider "aws" {
alias = "us_east_1"
profile = var.profile
region = "us-east-1"
}
# tags
locals { locals {
tags = { tags = {
"Project" = "panaetius-blog" "Project" = "panaetius-blog"
@@ -11,21 +19,31 @@ locals {
} }
} }
# cloudfront
module "cloudfront_s3_cdn" { module "cloudfront_s3_cdn" {
source = "git::https://github.com/cloudposse/terraform-aws-cloudfront-s3-cdn.git?ref=tags/0.23.1" source = "git::https://github.com/cloudposse/terraform-aws-cloudfront-s3-cdn.git?ref=tags/0.23.1"
stage = var.stage stage = var.stage
name = var.name name = var.name
parent_zone_id = var.parent_zone_id parent_zone_id = var.parent_zone_id
acm_certificate_arn = var.acm_certificate_arn acm_certificate_arn = var.acm_certificate_arn
# log_expiration_days = var.log_expiration_days
# log_standard_transition_days = var.log_standard_transition_days
use_regional_s3_endpoint = true use_regional_s3_endpoint = true
origin_force_destroy = true origin_force_destroy = true
compress = true
cors_allowed_headers = ["*"] cors_allowed_headers = ["*"]
cors_allowed_methods = ["GET", "HEAD", "PUT", "POST"] cors_allowed_methods = ["GET", "HEAD", "PUT", "POST"]
cors_allowed_origins = var.allowed_origins cors_allowed_origins = var.allowed_origins
tags = local.tags tags = local.tags
aliases = var.aliases aliases = var.aliases
index_document = "index.html"
lambda_function_association = [
{
event_type : "origin-request",
lambda_arn : aws_lambda_function.directory_indexes.qualified_arn,
include_body : false
}
]
# this policy sets the bucket to be public for all newly created files
additional_bucket_policy = <<-EOT additional_bucket_policy = <<-EOT
{ {
"Version": "2012-10-17", "Version": "2012-10-17",
@@ -35,18 +53,99 @@ module "cloudfront_s3_cdn" {
"Effect":"Allow", "Effect":"Allow",
"Principal":"*", "Principal":"*",
"Action":["s3:GetObject"], "Action":["s3:GetObject"],
"Resource": "arn:aws:s3:::${var.bucket_name}/*" "Resource":"arn:aws:s3:::${module.cloudfront_s3_cdn.s3_bucket}/*"
} }
] ]
} }
EOT EOT
} }
resource "aws_s3_bucket_object" "index" { # # cloudfront lambda@edge
bucket = module.cloudfront_s3_cdn.s3_bucket
key = "index.html" # resource "aws_s3_bucket" "lambda_s3" {
acl = "public-read" # provider = aws.us_east_1
source = "${path.module}/test/index.html" # region = var.s3_region
content_type = "text/html" # bucket = "${var.stage}-${var.name}-lambda-function"
etag = md5(file("${path.module}/test/index.html")) # acl = var.acl
# 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" {
# provider = aws.us_east_1
# bucket = aws_s3_bucket.lambda_s3.id
# key = var.lambda_key
# acl = var.acl
# source = var.source_file
# }
resource "aws_lambda_function" "directory_indexes" {
provider = aws.us_east_1
function_name = "${var.stage}-${var.name}-directory_indexes"
filename = "${var.source_file}.zip"
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
runtime = var.runtime
role = aws_iam_role.lambda_role.arn
publish = true
tags = local.tags
depends_on = [aws_iam_role_policy_attachment.lambda_logging]
}
## Lambda iam role & policies
resource "aws_iam_role" "lambda_role" {
name = "${var.stage}-${var.name}-lambda"
tags = local.tags
assume_role_policy = <<-EOT
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": [
"lambda.amazonaws.com",
"edgelambda.amazonaws.com"
]
},
"Action": "sts:AssumeRole"
}
]
}
EOT
}
resource "aws_iam_policy" "lambda_logging" {
name = "${var.stage}-${var.name}-lambda_logging"
policy = <<-EOT
{
"Version": "2012-10-17",
"Statement": [
{
"Action": [
"logs:CreateLogGroup",
"logs:CreateLogStream",
"logs:PutLogEvents"
],
"Resource": "arn:aws:logs:*:*:*",
"Effect": "Allow"
}
]
}
EOT
}
resource "aws_iam_role_policy_attachment" "lambda_logging" {
role = aws_iam_role.lambda_role.name
policy_arn = aws_iam_policy.lambda_logging.arn
} }

View File

@@ -1,7 +1,7 @@
{ {
"version": 4, "version": 4,
"terraform_version": "0.12.26", "terraform_version": "0.12.26",
"serial": 90, "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": "E2SEL7AYXF1CKS", "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",
@@ -283,7 +309,7 @@
"GET", "GET",
"HEAD" "HEAD"
], ],
"compress": false, "compress": true,
"default_ttl": 60, "default_ttl": 60,
"field_level_encryption_id": "", "field_level_encryption_id": "",
"forwarded_values": [ "forwarded_values": [
@@ -303,7 +329,13 @@
"query_string_cache_keys": [] "query_string_cache_keys": []
} }
], ],
"lambda_function_association": [], "lambda_function_association": [
{
"event_type": "origin-request",
"include_body": false,
"lambda_arn": "arn:aws:lambda:us-east-1:745437999005:function:prod-panaetius-blog-directory_indexes:7"
}
],
"max_ttl": 31536000, "max_ttl": 31536000,
"min_ttl": 0, "min_ttl": 0,
"smooth_streaming": false, "smooth_streaming": false,
@@ -315,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": "E2SEL7AYXF1CKS", "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-15 00:18:34.684 +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",
@@ -378,6 +410,9 @@
}, },
"private": "eyJzY2hlbWFfdmVyc2lvbiI6IjEifQ==", "private": "eyJzY2hlbWFfdmVyc2lvbiI6IjEifQ==",
"dependencies": [ "dependencies": [
"aws_iam_role.lambda_role",
"aws_iam_role_policy_attachment.lambda_logging",
"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",
"module.cloudfront_s3_cdn.module.logs.aws_s3_bucket.default" "module.cloudfront_s3_cdn.module.logs.aws_s3_bucket.default"
@@ -398,7 +433,7 @@
"caller_reference": "terraform-20200713232645930800000001", "caller_reference": "terraform-20200713232645930800000001",
"cloudfront_access_identity_path": "origin-access-identity/cloudfront/E21A7YWJ1RT3K5", "cloudfront_access_identity_path": "origin-access-identity/cloudfront/E21A7YWJ1RT3K5",
"comment": "prod-panaetius-blog", "comment": "prod-panaetius-blog",
"etag": "EESE0U5KF261", "etag": "E38E5DTUJGROV",
"iam_arn": "arn:aws:iam::cloudfront:user/CloudFront Origin Access Identity E21A7YWJ1RT3K5", "iam_arn": "arn:aws:iam::cloudfront:user/CloudFront Origin Access Identity E21A7YWJ1RT3K5",
"id": "E21A7YWJ1RT3K5", "id": "E21A7YWJ1RT3K5",
"s3_canonical_user_id": "2d7779400635ec843efe9b677769fc4f82b0d384408cf22382bf3a90540502e09e75d1346e7105b4da159515b229f39b" "s3_canonical_user_id": "2d7779400635ec843efe9b677769fc4f82b0d384408cf22382bf3a90540502e09e75d1346e7105b4da159515b229f39b"
@@ -407,6 +442,133 @@
} }
] ]
}, },
{
"mode": "managed",
"type": "aws_iam_policy",
"name": "lambda_logging",
"provider": "provider.aws",
"instances": [
{
"schema_version": 0,
"attributes": {
"arn": "arn:aws:iam::745437999005:policy/prod-panaetius-blog-lambda_logging",
"description": "",
"id": "arn:aws:iam::745437999005:policy/prod-panaetius-blog-lambda_logging",
"name": "prod-panaetius-blog-lambda_logging",
"name_prefix": null,
"path": "/",
"policy": "{\n \"Version\": \"2012-10-17\",\n \"Statement\": [\n {\n \"Action\": [\n \"logs:CreateLogGroup\",\n \"logs:CreateLogStream\",\n \"logs:PutLogEvents\"\n ],\n \"Resource\": \"arn:aws:logs:*:*:*\",\n \"Effect\": \"Allow\"\n }\n ]\n}\n"
},
"private": "bnVsbA=="
}
]
},
{
"mode": "managed",
"type": "aws_iam_role",
"name": "lambda_role",
"provider": "provider.aws",
"instances": [
{
"schema_version": 0,
"attributes": {
"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\"}]}",
"create_date": "2020-07-21T20:01:43Z",
"description": "",
"force_detach_policies": false,
"id": "prod-panaetius-blog-lambda",
"max_session_duration": 3600,
"name": "prod-panaetius-blog-lambda",
"name_prefix": null,
"path": "/",
"permissions_boundary": null,
"tags": {
"Description": "terraform resources to host the blog",
"Project": "panaetius-blog"
},
"unique_id": "AROA23D4RF6O2VEGAGEXM"
},
"private": "bnVsbA=="
}
]
},
{
"mode": "managed",
"type": "aws_iam_role_policy_attachment",
"name": "lambda_logging",
"provider": "provider.aws",
"instances": [
{
"schema_version": 0,
"attributes": {
"id": "prod-panaetius-blog-lambda-20200721200145100500000001",
"policy_arn": "arn:aws:iam::745437999005:policy/prod-panaetius-blog-lambda_logging",
"role": "prod-panaetius-blog-lambda"
},
"private": "bnVsbA==",
"dependencies": [
"aws_iam_policy.lambda_logging",
"aws_iam_role.lambda_role"
]
}
]
},
{
"mode": "managed",
"type": "aws_lambda_function",
"name": "directory_indexes",
"provider": "provider.aws.us_east_1",
"instances": [
{
"schema_version": 0,
"attributes": {
"arn": "arn:aws:lambda:us-east-1:745437999005:function:prod-panaetius-blog-directory_indexes",
"dead_letter_config": [],
"description": "",
"environment": [],
"file_system_config": [],
"filename": "./lambda/prod-panaetius-blog-lambda/main.js.zip",
"function_name": "prod-panaetius-blog-directory_indexes",
"handler": "main.handler",
"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",
"kms_key_arn": "",
"last_modified": "2020-07-21T21:34:00.971+0000",
"layers": [],
"memory_size": 128,
"publish": true,
"qualified_arn": "arn:aws:lambda:us-east-1:745437999005:function:prod-panaetius-blog-directory_indexes:7",
"reserved_concurrent_executions": -1,
"role": "arn:aws:iam::745437999005:role/prod-panaetius-blog-lambda",
"runtime": "nodejs12.x",
"s3_bucket": null,
"s3_key": null,
"s3_object_version": null,
"source_code_hash": "5EVmwQDkgGfYMpMXNaWHUz3cmb/dSssoWl8mM8o3aMs=",
"source_code_size": 601,
"tags": {
"Description": "terraform resources to host the blog",
"Project": "panaetius-blog"
},
"timeout": 3,
"timeouts": null,
"tracing_config": [
{
"mode": "PassThrough"
}
],
"version": "7",
"vpc_config": []
},
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDB9fQ==",
"dependencies": [
"aws_iam_role.lambda_role",
"aws_iam_role_policy_attachment.lambda_logging"
]
}
]
},
{ {
"module": "module.cloudfront_s3_cdn.module.dns", "module": "module.cloudfront_s3_cdn.module.dns",
"mode": "managed", "mode": "managed",
@@ -674,47 +836,6 @@
} }
] ]
}, },
{
"mode": "managed",
"type": "aws_s3_bucket_object",
"name": "index",
"provider": "provider.aws",
"instances": [
{
"schema_version": 0,
"attributes": {
"acl": "public-read",
"bucket": "prod-panaetius-blog-origin",
"cache_control": "",
"content": null,
"content_base64": null,
"content_disposition": "",
"content_encoding": "",
"content_language": "",
"content_type": "text/html",
"etag": "83350948ee374f30e5513497c69c0fe5",
"force_destroy": false,
"id": "index.html",
"key": "index.html",
"kms_key_id": null,
"metadata": {},
"object_lock_legal_hold_status": "",
"object_lock_mode": "",
"object_lock_retain_until_date": "",
"server_side_encryption": "",
"source": "./test/index.html",
"storage_class": "STANDARD",
"tags": {},
"version_id": "",
"website_redirect": ""
},
"private": "bnVsbA==",
"dependencies": [
"module.cloudfront_s3_cdn.aws_s3_bucket.origin"
]
}
]
},
{ {
"module": "module.cloudfront_s3_cdn", "module": "module.cloudfront_s3_cdn",
"mode": "managed", "mode": "managed",
@@ -729,7 +850,7 @@
"attributes": { "attributes": {
"bucket": "prod-panaetius-blog-origin", "bucket": "prod-panaetius-blog-origin",
"id": "prod-panaetius-blog-origin", "id": "prod-panaetius-blog-origin",
"policy": "{\n \"Version\": \"2012-10-17\",\n \"Statement\": [\n {\n \"Sid\": \"S3GetObjectForCloudFront\",\n \"Effect\": \"Allow\",\n \"Action\": \"s3:GetObject\",\n \"Resource\": \"arn:aws:s3:::prod-panaetius-blog-origin/*\",\n \"Principal\": {\n \"AWS\": \"arn:aws:iam::cloudfront:user/CloudFront Origin Access Identity E21A7YWJ1RT3K5\"\n }\n },\n {\n \"Sid\": \"S3ListBucketForCloudFront\",\n \"Effect\": \"Allow\",\n \"Action\": \"s3:ListBucket\",\n \"Resource\": \"arn:aws:s3:::prod-panaetius-blog-origin\",\n \"Principal\": {\n \"AWS\": \"arn:aws:iam::cloudfront:user/CloudFront Origin Access Identity E21A7YWJ1RT3K5\"\n }\n },\n {\n \"Sid\": \"PublicRead\",\n \"Effect\": \"Allow\",\n \"Action\": [\n \"s3:GetObject\"\n ],\n \"Resource\": \"arn:aws:s3:::prod-panaetius-blog-origin/*\",\n \"Principal\": \"*\"\n }\n ]\n}" "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Sid\":\"S3GetObjectForCloudFront\",\"Effect\":\"Allow\",\"Principal\":{\"AWS\":\"arn:aws:iam::cloudfront:user/CloudFront Origin Access Identity E21A7YWJ1RT3K5\"},\"Action\":\"s3:GetObject\",\"Resource\":\"arn:aws:s3:::prod-panaetius-blog-origin/*\"},{\"Sid\":\"S3ListBucketForCloudFront\",\"Effect\":\"Allow\",\"Principal\":{\"AWS\":\"arn:aws:iam::cloudfront:user/CloudFront Origin Access Identity E21A7YWJ1RT3K5\"},\"Action\":\"s3:ListBucket\",\"Resource\":\"arn:aws:s3:::prod-panaetius-blog-origin\"},{\"Sid\":\"PublicRead\",\"Effect\":\"Allow\",\"Principal\":\"*\",\"Action\":\"s3:GetObject\",\"Resource\":\"arn:aws:s3:::prod-panaetius-blog-origin/*\"}]}"
}, },
"private": "bnVsbA==", "private": "bnVsbA==",
"dependencies": [ "dependencies": [

View File

@@ -1,7 +1,7 @@
{ {
"version": 4, "version": 4,
"terraform_version": "0.12.26", "terraform_version": "0.12.26",
"serial": 88, "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": "E2SEL7AYXF1CKS", "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",
@@ -48,9 +74,9 @@
{ {
"schema_version": 0, "schema_version": 0,
"attributes": { "attributes": {
"id": "1149999058", "id": "3493490045",
"json": "{\n \"Version\": \"2012-10-17\",\n \"Statement\": [\n {\n \"Sid\": \"S3GetObjectForCloudFront\",\n \"Effect\": \"Allow\",\n \"Action\": \"s3:GetObject\",\n \"Resource\": \"arn:aws:s3:::${bucket_name}${origin_path}*\",\n \"Principal\": {\n \"AWS\": \"${cloudfront_origin_access_identity_iam_arn}\"\n }\n },\n {\n \"Sid\": \"S3ListBucketForCloudFront\",\n \"Effect\": \"Allow\",\n \"Action\": \"s3:ListBucket\",\n \"Resource\": \"arn:aws:s3:::${bucket_name}\",\n \"Principal\": {\n \"AWS\": \"${cloudfront_origin_access_identity_iam_arn}\"\n }\n }\n ]\n}", "json": "{\n \"Version\": \"2012-10-17\",\n \"Statement\": [\n {\n \"Sid\": \"S3GetObjectForCloudFront\",\n \"Effect\": \"Allow\",\n \"Action\": \"s3:GetObject\",\n \"Resource\": \"arn:aws:s3:::${bucket_name}${origin_path}*\",\n \"Principal\": {\n \"AWS\": \"${cloudfront_origin_access_identity_iam_arn}\"\n }\n },\n {\n \"Sid\": \"S3ListBucketForCloudFront\",\n \"Effect\": \"Allow\",\n \"Action\": \"s3:ListBucket\",\n \"Resource\": \"arn:aws:s3:::${bucket_name}\",\n \"Principal\": {\n \"AWS\": \"${cloudfront_origin_access_identity_iam_arn}\"\n }\n },\n {\n \"Sid\": \"PublicRead\",\n \"Effect\": \"Allow\",\n \"Action\": [\n \"s3:GetObject\"\n ],\n \"Resource\": \"arn:aws:s3:::prod-panaetius-blog-origin/*\",\n \"Principal\": \"*\"\n }\n ]\n}",
"override_json": "{\n \"Sid\":\"PublicRead\",\n \"Effect\":\"Allow\",\n \"Principal\": \"*\",\n \"Action\":[\"s3:GetObject\"],\n \"Resource\": \"arn:aws:s3:::prod-panaetius-blog-origin/*\"\n}\n", "override_json": "{\n \"Version\": \"2012-10-17\",\n \"Statement\": [\n {\n \"Sid\":\"PublicRead\",\n \"Effect\":\"Allow\",\n \"Principal\":\"*\",\n \"Action\":[\"s3:GetObject\"],\n \"Resource\":\"arn:aws:s3:::prod-panaetius-blog-origin/*\"\n }\n ]\n}\n",
"policy_id": null, "policy_id": null,
"source_json": null, "source_json": null,
"statement": [ "statement": [
@@ -114,9 +140,9 @@
{ {
"schema_version": 0, "schema_version": 0,
"attributes": { "attributes": {
"id": "239689126", "id": "736817168",
"json": "{\n \"Version\": \"2012-10-17\",\n \"Statement\": [\n {\n \"Sid\": \"S3GetObjectForCloudFront\",\n \"Effect\": \"Allow\",\n \"Action\": \"s3:GetObject\",\n \"Resource\": \"arn:aws:s3:::${bucket_name}${origin_path}*\",\n \"Principal\": {\n \"AWS\": \"*\"\n }\n }\n ]\n}", "json": "{\n \"Version\": \"2012-10-17\",\n \"Statement\": [\n {\n \"Sid\": \"S3GetObjectForCloudFront\",\n \"Effect\": \"Allow\",\n \"Action\": \"s3:GetObject\",\n \"Resource\": \"arn:aws:s3:::${bucket_name}${origin_path}*\",\n \"Principal\": {\n \"AWS\": \"*\"\n }\n },\n {\n \"Sid\": \"PublicRead\",\n \"Effect\": \"Allow\",\n \"Action\": [\n \"s3:GetObject\"\n ],\n \"Resource\": \"arn:aws:s3:::prod-panaetius-blog-origin/*\",\n \"Principal\": \"*\"\n }\n ]\n}",
"override_json": "{\n \"Sid\":\"PublicRead\",\n \"Effect\":\"Allow\",\n \"Principal\": \"*\",\n \"Action\":[\"s3:GetObject\"],\n \"Resource\": \"arn:aws:s3:::prod-panaetius-blog-origin/*\"\n}\n", "override_json": "{\n \"Version\": \"2012-10-17\",\n \"Statement\": [\n {\n \"Sid\":\"PublicRead\",\n \"Effect\":\"Allow\",\n \"Principal\":\"*\",\n \"Action\":[\"s3:GetObject\"],\n \"Resource\":\"arn:aws:s3:::prod-panaetius-blog-origin/*\"\n }\n ]\n}\n",
"policy_id": null, "policy_id": null,
"source_json": null, "source_json": null,
"statement": [ "statement": [
@@ -234,9 +260,9 @@
"schema_version": 0, "schema_version": 0,
"attributes": { "attributes": {
"filename": null, "filename": null,
"id": "bf2245baaea68e5cc89448356e64936cbd79d0706457d884cdd7badc903719e8", "id": "ef8d6cdd8c782d412e41e1e574ea39e8674f2d80726946a8f8dbe8ea50c1ac8b",
"rendered": "{\n \"Version\": \"2012-10-17\",\n \"Statement\": [\n {\n \"Sid\": \"S3GetObjectForCloudFront\",\n \"Effect\": \"Allow\",\n \"Action\": \"s3:GetObject\",\n \"Resource\": \"arn:aws:s3:::prod-panaetius-blog-origin/*\",\n \"Principal\": {\n \"AWS\": \"arn:aws:iam::cloudfront:user/CloudFront Origin Access Identity E21A7YWJ1RT3K5\"\n }\n },\n {\n \"Sid\": \"S3ListBucketForCloudFront\",\n \"Effect\": \"Allow\",\n \"Action\": \"s3:ListBucket\",\n \"Resource\": \"arn:aws:s3:::prod-panaetius-blog-origin\",\n \"Principal\": {\n \"AWS\": \"arn:aws:iam::cloudfront:user/CloudFront Origin Access Identity E21A7YWJ1RT3K5\"\n }\n }\n ]\n}", "rendered": "{\n \"Version\": \"2012-10-17\",\n \"Statement\": [\n {\n \"Sid\": \"S3GetObjectForCloudFront\",\n \"Effect\": \"Allow\",\n \"Action\": \"s3:GetObject\",\n \"Resource\": \"arn:aws:s3:::prod-panaetius-blog-origin/*\",\n \"Principal\": {\n \"AWS\": \"arn:aws:iam::cloudfront:user/CloudFront Origin Access Identity E21A7YWJ1RT3K5\"\n }\n },\n {\n \"Sid\": \"S3ListBucketForCloudFront\",\n \"Effect\": \"Allow\",\n \"Action\": \"s3:ListBucket\",\n \"Resource\": \"arn:aws:s3:::prod-panaetius-blog-origin\",\n \"Principal\": {\n \"AWS\": \"arn:aws:iam::cloudfront:user/CloudFront Origin Access Identity E21A7YWJ1RT3K5\"\n }\n },\n {\n \"Sid\": \"PublicRead\",\n \"Effect\": \"Allow\",\n \"Action\": [\n \"s3:GetObject\"\n ],\n \"Resource\": \"arn:aws:s3:::prod-panaetius-blog-origin/*\",\n \"Principal\": \"*\"\n }\n ]\n}",
"template": "{\n \"Version\": \"2012-10-17\",\n \"Statement\": [\n {\n \"Sid\": \"S3GetObjectForCloudFront\",\n \"Effect\": \"Allow\",\n \"Action\": \"s3:GetObject\",\n \"Resource\": \"arn:aws:s3:::${bucket_name}${origin_path}*\",\n \"Principal\": {\n \"AWS\": \"${cloudfront_origin_access_identity_iam_arn}\"\n }\n },\n {\n \"Sid\": \"S3ListBucketForCloudFront\",\n \"Effect\": \"Allow\",\n \"Action\": \"s3:ListBucket\",\n \"Resource\": \"arn:aws:s3:::${bucket_name}\",\n \"Principal\": {\n \"AWS\": \"${cloudfront_origin_access_identity_iam_arn}\"\n }\n }\n ]\n}", "template": "{\n \"Version\": \"2012-10-17\",\n \"Statement\": [\n {\n \"Sid\": \"S3GetObjectForCloudFront\",\n \"Effect\": \"Allow\",\n \"Action\": \"s3:GetObject\",\n \"Resource\": \"arn:aws:s3:::${bucket_name}${origin_path}*\",\n \"Principal\": {\n \"AWS\": \"${cloudfront_origin_access_identity_iam_arn}\"\n }\n },\n {\n \"Sid\": \"S3ListBucketForCloudFront\",\n \"Effect\": \"Allow\",\n \"Action\": \"s3:ListBucket\",\n \"Resource\": \"arn:aws:s3:::${bucket_name}\",\n \"Principal\": {\n \"AWS\": \"${cloudfront_origin_access_identity_iam_arn}\"\n }\n },\n {\n \"Sid\": \"PublicRead\",\n \"Effect\": \"Allow\",\n \"Action\": [\n \"s3:GetObject\"\n ],\n \"Resource\": \"arn:aws:s3:::prod-panaetius-blog-origin/*\",\n \"Principal\": \"*\"\n }\n ]\n}",
"vars": { "vars": {
"bucket_name": "prod-panaetius-blog-origin", "bucket_name": "prod-panaetius-blog-origin",
"cloudfront_origin_access_identity_iam_arn": "arn:aws:iam::cloudfront:user/CloudFront Origin Access Identity E21A7YWJ1RT3K5", "cloudfront_origin_access_identity_iam_arn": "arn:aws:iam::cloudfront:user/CloudFront Origin Access Identity E21A7YWJ1RT3K5",
@@ -283,7 +309,7 @@
"GET", "GET",
"HEAD" "HEAD"
], ],
"compress": false, "compress": true,
"default_ttl": 60, "default_ttl": 60,
"field_level_encryption_id": "", "field_level_encryption_id": "",
"forwarded_values": [ "forwarded_values": [
@@ -303,7 +329,13 @@
"query_string_cache_keys": [] "query_string_cache_keys": []
} }
], ],
"lambda_function_association": [], "lambda_function_association": [
{
"event_type": "origin-request",
"include_body": false,
"lambda_arn": "arn:aws:lambda:us-east-1:745437999005:function:prod-panaetius-blog-directory_indexes:6"
}
],
"max_ttl": 31536000, "max_ttl": 31536000,
"min_ttl": 0, "min_ttl": 0,
"smooth_streaming": false, "smooth_streaming": false,
@@ -315,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": "E2SEL7AYXF1CKS", "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-15 00:18:34.684 +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",
@@ -378,6 +410,9 @@
}, },
"private": "eyJzY2hlbWFfdmVyc2lvbiI6IjEifQ==", "private": "eyJzY2hlbWFfdmVyc2lvbiI6IjEifQ==",
"dependencies": [ "dependencies": [
"aws_iam_role.lambda_role",
"aws_iam_role_policy_attachment.lambda_logging",
"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",
"module.cloudfront_s3_cdn.module.logs.aws_s3_bucket.default" "module.cloudfront_s3_cdn.module.logs.aws_s3_bucket.default"
@@ -398,7 +433,7 @@
"caller_reference": "terraform-20200713232645930800000001", "caller_reference": "terraform-20200713232645930800000001",
"cloudfront_access_identity_path": "origin-access-identity/cloudfront/E21A7YWJ1RT3K5", "cloudfront_access_identity_path": "origin-access-identity/cloudfront/E21A7YWJ1RT3K5",
"comment": "prod-panaetius-blog", "comment": "prod-panaetius-blog",
"etag": "EESE0U5KF261", "etag": "E38E5DTUJGROV",
"iam_arn": "arn:aws:iam::cloudfront:user/CloudFront Origin Access Identity E21A7YWJ1RT3K5", "iam_arn": "arn:aws:iam::cloudfront:user/CloudFront Origin Access Identity E21A7YWJ1RT3K5",
"id": "E21A7YWJ1RT3K5", "id": "E21A7YWJ1RT3K5",
"s3_canonical_user_id": "2d7779400635ec843efe9b677769fc4f82b0d384408cf22382bf3a90540502e09e75d1346e7105b4da159515b229f39b" "s3_canonical_user_id": "2d7779400635ec843efe9b677769fc4f82b0d384408cf22382bf3a90540502e09e75d1346e7105b4da159515b229f39b"
@@ -407,6 +442,133 @@
} }
] ]
}, },
{
"mode": "managed",
"type": "aws_iam_policy",
"name": "lambda_logging",
"provider": "provider.aws",
"instances": [
{
"schema_version": 0,
"attributes": {
"arn": "arn:aws:iam::745437999005:policy/prod-panaetius-blog-lambda_logging",
"description": "",
"id": "arn:aws:iam::745437999005:policy/prod-panaetius-blog-lambda_logging",
"name": "prod-panaetius-blog-lambda_logging",
"name_prefix": null,
"path": "/",
"policy": "{\n \"Version\": \"2012-10-17\",\n \"Statement\": [\n {\n \"Action\": [\n \"logs:CreateLogGroup\",\n \"logs:CreateLogStream\",\n \"logs:PutLogEvents\"\n ],\n \"Resource\": \"arn:aws:logs:*:*:*\",\n \"Effect\": \"Allow\"\n }\n ]\n}\n"
},
"private": "bnVsbA=="
}
]
},
{
"mode": "managed",
"type": "aws_iam_role",
"name": "lambda_role",
"provider": "provider.aws",
"instances": [
{
"schema_version": 0,
"attributes": {
"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\"}]}",
"create_date": "2020-07-21T20:01:43Z",
"description": "",
"force_detach_policies": false,
"id": "prod-panaetius-blog-lambda",
"max_session_duration": 3600,
"name": "prod-panaetius-blog-lambda",
"name_prefix": null,
"path": "/",
"permissions_boundary": null,
"tags": {
"Description": "terraform resources to host the blog",
"Project": "panaetius-blog"
},
"unique_id": "AROA23D4RF6O2VEGAGEXM"
},
"private": "bnVsbA=="
}
]
},
{
"mode": "managed",
"type": "aws_iam_role_policy_attachment",
"name": "lambda_logging",
"provider": "provider.aws",
"instances": [
{
"schema_version": 0,
"attributes": {
"id": "prod-panaetius-blog-lambda-20200721200145100500000001",
"policy_arn": "arn:aws:iam::745437999005:policy/prod-panaetius-blog-lambda_logging",
"role": "prod-panaetius-blog-lambda"
},
"private": "bnVsbA==",
"dependencies": [
"aws_iam_policy.lambda_logging",
"aws_iam_role.lambda_role"
]
}
]
},
{
"mode": "managed",
"type": "aws_lambda_function",
"name": "directory_indexes",
"provider": "provider.aws.us_east_1",
"instances": [
{
"schema_version": 0,
"attributes": {
"arn": "arn:aws:lambda:us-east-1:745437999005:function:prod-panaetius-blog-directory_indexes",
"dead_letter_config": [],
"description": "",
"environment": [],
"file_system_config": [],
"filename": "./lambda/prod-panaetius-blog-lambda/main.js.zip",
"function_name": "prod-panaetius-blog-directory_indexes",
"handler": "main.handler",
"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",
"kms_key_arn": "",
"last_modified": "2020-07-21T21:18:36.437+0000",
"layers": [],
"memory_size": 128,
"publish": true,
"qualified_arn": "arn:aws:lambda:us-east-1:745437999005:function:prod-panaetius-blog-directory_indexes:6",
"reserved_concurrent_executions": -1,
"role": "arn:aws:iam::745437999005:role/prod-panaetius-blog-lambda",
"runtime": "nodejs12.x",
"s3_bucket": null,
"s3_key": null,
"s3_object_version": null,
"source_code_hash": "W5HchTpXhL2+aBI5O1Qzo25q4hxfbf+uhEln7zcrZpM=",
"source_code_size": 597,
"tags": {
"Description": "terraform resources to host the blog",
"Project": "panaetius-blog"
},
"timeout": 3,
"timeouts": null,
"tracing_config": [
{
"mode": "PassThrough"
}
],
"version": "6",
"vpc_config": []
},
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDB9fQ==",
"dependencies": [
"aws_iam_role.lambda_role",
"aws_iam_role_policy_attachment.lambda_logging"
]
}
]
},
{ {
"module": "module.cloudfront_s3_cdn.module.dns", "module": "module.cloudfront_s3_cdn.module.dns",
"mode": "managed", "mode": "managed",
@@ -674,47 +836,6 @@
} }
] ]
}, },
{
"mode": "managed",
"type": "aws_s3_bucket_object",
"name": "index",
"provider": "provider.aws",
"instances": [
{
"schema_version": 0,
"attributes": {
"acl": "public-read",
"bucket": "prod-panaetius-blog-origin",
"cache_control": "",
"content": null,
"content_base64": null,
"content_disposition": "",
"content_encoding": "",
"content_language": "",
"content_type": "text/html",
"etag": "83350948ee374f30e5513497c69c0fe5",
"force_destroy": false,
"id": "index.html",
"key": "index.html",
"kms_key_id": null,
"metadata": {},
"object_lock_legal_hold_status": "",
"object_lock_mode": "",
"object_lock_retain_until_date": "",
"server_side_encryption": "",
"source": "./test/index.html",
"storage_class": "STANDARD",
"tags": {},
"version_id": "",
"website_redirect": ""
},
"private": "bnVsbA==",
"dependencies": [
"module.cloudfront_s3_cdn.aws_s3_bucket.origin"
]
}
]
},
{ {
"module": "module.cloudfront_s3_cdn", "module": "module.cloudfront_s3_cdn",
"mode": "managed", "mode": "managed",
@@ -729,11 +850,10 @@
"attributes": { "attributes": {
"bucket": "prod-panaetius-blog-origin", "bucket": "prod-panaetius-blog-origin",
"id": "prod-panaetius-blog-origin", "id": "prod-panaetius-blog-origin",
"policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Sid\":\"S3GetObjectForCloudFront\",\"Effect\":\"Allow\",\"Principal\":{\"AWS\":\"arn:aws:iam::cloudfront:user/CloudFront Origin Access Identity E21A7YWJ1RT3K5\"},\"Action\":\"s3:GetObject\",\"Resource\":\"arn:aws:s3:::prod-panaetius-blog-origin/*\"},{\"Sid\":\"S3ListBucketForCloudFront\",\"Effect\":\"Allow\",\"Principal\":{\"AWS\":\"arn:aws:iam::cloudfront:user/CloudFront Origin Access Identity E21A7YWJ1RT3K5\"},\"Action\":\"s3:ListBucket\",\"Resource\":\"arn:aws:s3:::prod-panaetius-blog-origin\"}]}" "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Sid\":\"S3GetObjectForCloudFront\",\"Effect\":\"Allow\",\"Principal\":{\"AWS\":\"arn:aws:iam::cloudfront:user/CloudFront Origin Access Identity E21A7YWJ1RT3K5\"},\"Action\":\"s3:GetObject\",\"Resource\":\"arn:aws:s3:::prod-panaetius-blog-origin/*\"},{\"Sid\":\"S3ListBucketForCloudFront\",\"Effect\":\"Allow\",\"Principal\":{\"AWS\":\"arn:aws:iam::cloudfront:user/CloudFront Origin Access Identity E21A7YWJ1RT3K5\"},\"Action\":\"s3:ListBucket\",\"Resource\":\"arn:aws:s3:::prod-panaetius-blog-origin\"},{\"Sid\":\"PublicRead\",\"Effect\":\"Allow\",\"Principal\":\"*\",\"Action\":\"s3:GetObject\",\"Resource\":\"arn:aws:s3:::prod-panaetius-blog-origin/*\"}]}"
}, },
"private": "bnVsbA==", "private": "bnVsbA==",
"dependencies": [ "dependencies": [
"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"
] ]
} }

View File

@@ -14,10 +14,6 @@ variable "profile" {
} }
variable "bucket_name" {
}
variable "acm_certificate_arn" { variable "acm_certificate_arn" {
} }
@@ -34,11 +30,26 @@ variable "allowed_origins" {
} }
variable "acl" {
# variable "log_expiration_days" { }
# } variable "lambda_key" {
# variable "log_standard_transition_days" { }
# } variable "source_file" {
}
variable "handler" {
}
variable "runtime" {
}
variable "s3_region" {
}

View File

@@ -1,11 +1,19 @@
# module
name = "panaetius-blog" name = "panaetius-blog"
region = "eu-west-1" region = "eu-west-1"
stage = "prod" stage = "prod"
profile = "admin" profile = "admin"
bucket_name = "prod-panaetius-blog-origin"
# cloudfront
acm_certificate_arn = "arn:aws:acm:us-east-1:745437999005:certificate/60af49f0-07bb-4680-8f5b-3c9a33f756e5" acm_certificate_arn = "arn:aws:acm:us-east-1:745437999005:certificate/60af49f0-07bb-4680-8f5b-3c9a33f756e5"
parent_zone_id = "Z05316671VABVSMAAF1RC" parent_zone_id = "Z05316671VABVSMAAF1RC"
aliases = ["panaetius.io"] aliases = ["panaetius.io"]
allowed_origins = ["*.panaetius.io"] allowed_origins = ["*.panaetius.io"]
# log_expiration_days = 60
# log_standard_transition_days = 60 # s3 & lambda
acl = "private"
lambda_key = "main.zip"
source_file = "./lambda/prod-panaetius-blog-lambda/main.js"
handler = "main.handler"
runtime = "nodejs12.x"
s3_region = "us-east-1"