mirror of
https://github.com/GenderDysphoria/GenderDysphoria.fyi.git
synced 2025-01-31 07:16:17 +00:00
More terraform
This commit is contained in:
parent
0d29383b38
commit
a73274d74c
@ -91,12 +91,3 @@ resource "aws_iam_role_policy" "lambda_s3_bucket_readonly" {
|
||||
role = aws_iam_role.ipixel_parser.name
|
||||
policy = data.aws_iam_policy_document.s3_bucket_readonly.json
|
||||
}
|
||||
|
||||
resource "aws_lambda_permission" "s3_bucket_invoke_function" {
|
||||
function_name = aws_lambda_function.ipixel_parser.arn
|
||||
action = "lambda:InvokeFunction"
|
||||
|
||||
principal = "s3.amazonaws.com"
|
||||
source_arn = aws_s3_bucket.ipixel_logs.arn
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
# -----------------------------------------------------------------------------------------------------------
|
||||
# Grant the log parsing lambda access to the logs bucket
|
||||
|
||||
resource "aws_lambda_permission" "allow_bucket" {
|
||||
resource "aws_lambda_permission" "s3_bucket_invoke_function" {
|
||||
statement_id = "AllowExecutionFromS3Bucket"
|
||||
action = "lambda:InvokeFunction"
|
||||
function_name = aws_lambda_function.ipixel_parser.arn
|
||||
@ -22,6 +22,8 @@ resource "aws_s3_bucket_notification" "ipixel_logs" {
|
||||
lambda_function {
|
||||
lambda_function_arn = aws_lambda_function.ipixel_parser.arn
|
||||
events = ["s3:ObjectCreated:*"]
|
||||
filter_prefix = "RAW/"
|
||||
filter_suffix = ".gz"
|
||||
}
|
||||
|
||||
depends_on = [aws_lambda_permission.s3_bucket_invoke_function]
|
||||
@ -38,7 +40,8 @@ resource "aws_lambda_function" "ipixel_parser" {
|
||||
|
||||
runtime = "nodejs12.x"
|
||||
handler = "index.handler"
|
||||
timeout = 5
|
||||
timeout = "24"
|
||||
memory_size = "512"
|
||||
reserved_concurrent_executions = 3
|
||||
|
||||
environment {
|
||||
|
@ -33,8 +33,29 @@ resource "aws_s3_bucket_object" "ipixel" {
|
||||
resource "aws_s3_bucket" "ipixel_logs" {
|
||||
bucket = "${var.site}-analytics"
|
||||
|
||||
lifecycle_rule {
|
||||
id = "logfiles"
|
||||
enabled = true
|
||||
|
||||
prefix = "RAW/"
|
||||
|
||||
transition {
|
||||
days = 30
|
||||
storage_class = "STANDARD_IA" # or "ONEZONE_IA"
|
||||
}
|
||||
|
||||
# transition {
|
||||
# days = 30
|
||||
# storage_class = "GLACIER"
|
||||
# }
|
||||
|
||||
# expiration {
|
||||
# days = 90
|
||||
# }
|
||||
}
|
||||
|
||||
tags = {
|
||||
Name = "Logs Storage"
|
||||
Name = "iPixel Logs Storage"
|
||||
Site = var.site
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user