From 1f2cb037f40eedccc3bbd4c5bad61c53c9db597e Mon Sep 17 00:00:00 2001 From: Niko Felger Date: Thu, 15 Oct 2020 13:23:45 +0200 Subject: [PATCH] Run daily imports earlier at night --- main.tf | 4 +-- terraform.tfstate | 22 +++++++-------- terraform.tfstate.backup | 59 ++++++++++++++++++++++++++++++++-------- 3 files changed, 61 insertions(+), 24 deletions(-) diff --git a/main.tf b/main.tf index 10d6a52..b059f88 100644 --- a/main.tf +++ b/main.tf @@ -207,7 +207,7 @@ resource "aws_iam_role_policy_attachment" "lambda-access" { # Schedule the update functions to run daily. resource "aws_cloudwatch_event_rule" "daily_import" { name = "fellows-2020-rechtsinfo-daily-import" - schedule_expression = "cron(0 6 * * ? *)" + schedule_expression = "cron(0 4 * * ? *)" } resource "aws_cloudwatch_event_target" "daily_import" { @@ -215,7 +215,7 @@ resource "aws_cloudwatch_event_target" "daily_import" { arn = aws_lambda_function.download_laws.arn } -# Allow lambda funtion to be triggered by CloudWatch Events. +# Allow lambda function to be triggered by CloudWatch Events. resource "aws_lambda_permission" "allow_cloudwatch_invoke" { action = "lambda:InvokeFunction" function_name = aws_lambda_function.download_laws.function_name diff --git a/terraform.tfstate b/terraform.tfstate index d9d35e0..3109082 100644 --- a/terraform.tfstate +++ b/terraform.tfstate @@ -1,7 +1,7 @@ { "version": 4, "terraform_version": "0.13.4", - "serial": 220, + "serial": 223, "lineage": "2960cc07-ae92-c576-4518-c66c2b2322ce", "outputs": {}, "resources": [ @@ -478,7 +478,7 @@ "name": "fellows-2020-rechtsinfo-daily-import", "name_prefix": null, "role_arn": "", - "schedule_expression": "cron(0 6 * * ? *)", + "schedule_expression": "cron(0 4 * * ? *)", "tags": {} }, "private": "bnVsbA==" @@ -764,7 +764,7 @@ "id": "fellows-2020-rechtsinfo-Api", "invoke_arn": "arn:aws:apigateway:eu-central-1:lambda:path/2015-03-31/functions/arn:aws:lambda:eu-central-1:415944032879:function:fellows-2020-rechtsinfo-Api/invocations", "kms_key_arn": "", - "last_modified": "2020-10-12T09:05:07.075+0000", + "last_modified": "2020-10-15T07:54:45.800+0000", "layers": [ "arn:aws:lambda:eu-central-1:415944032879:layer:fellows-2020-rechtsinfo-lambda-deps:8" ], @@ -777,8 +777,8 @@ "s3_bucket": "fellows-2020-rechtsinfo-assets", "s3_key": "lambda_function.zip", "s3_object_version": null, - "source_code_hash": "bxrR1NaffnUWK2prY3MWC6gWq1aQyEzE/0ndAsU9RAE=", - "source_code_size": 59920, + "source_code_hash": "GtM1deiEqccyGO3OgVtr35zHx8JF61LMTeI+e6i2z9A=", + "source_code_size": 65227, "tags": {}, "timeout": 30, "timeouts": null, @@ -834,7 +834,7 @@ "id": "fellows-2020-rechtsinfo-DownloadLaws", "invoke_arn": "arn:aws:apigateway:eu-central-1:lambda:path/2015-03-31/functions/arn:aws:lambda:eu-central-1:415944032879:function:fellows-2020-rechtsinfo-DownloadLaws/invocations", "kms_key_arn": "", - "last_modified": "2020-10-12T09:05:09.374+0000", + "last_modified": "2020-10-15T07:54:50.024+0000", "layers": [ "arn:aws:lambda:eu-central-1:415944032879:layer:fellows-2020-rechtsinfo-lambda-deps:8" ], @@ -847,8 +847,8 @@ "s3_bucket": "fellows-2020-rechtsinfo-assets", "s3_key": "lambda_function.zip", "s3_object_version": null, - "source_code_hash": "bxrR1NaffnUWK2prY3MWC6gWq1aQyEzE/0ndAsU9RAE=", - "source_code_size": 59920, + "source_code_hash": "GtM1deiEqccyGO3OgVtr35zHx8JF61LMTeI+e6i2z9A=", + "source_code_size": 65227, "tags": {}, "timeout": 900, "timeouts": null, @@ -895,7 +895,7 @@ "id": "fellows-2020-rechtsinfo-IngestLaws", "invoke_arn": "arn:aws:apigateway:eu-central-1:lambda:path/2015-03-31/functions/arn:aws:lambda:eu-central-1:415944032879:function:fellows-2020-rechtsinfo-IngestLaws/invocations", "kms_key_arn": "", - "last_modified": "2020-10-12T09:05:13.260+0000", + "last_modified": "2020-10-15T07:54:53.951+0000", "layers": [ "arn:aws:lambda:eu-central-1:415944032879:layer:fellows-2020-rechtsinfo-lambda-deps:8" ], @@ -908,8 +908,8 @@ "s3_bucket": "fellows-2020-rechtsinfo-assets", "s3_key": "lambda_function.zip", "s3_object_version": null, - "source_code_hash": "bxrR1NaffnUWK2prY3MWC6gWq1aQyEzE/0ndAsU9RAE=", - "source_code_size": 59920, + "source_code_hash": "GtM1deiEqccyGO3OgVtr35zHx8JF61LMTeI+e6i2z9A=", + "source_code_size": 65227, "tags": {}, "timeout": 900, "timeouts": null, diff --git a/terraform.tfstate.backup b/terraform.tfstate.backup index 6a1ea4b..d9d35e0 100644 --- a/terraform.tfstate.backup +++ b/terraform.tfstate.backup @@ -1,7 +1,7 @@ { "version": 4, "terraform_version": "0.13.4", - "serial": 217, + "serial": 220, "lineage": "2960cc07-ae92-c576-4518-c66c2b2322ce", "outputs": {}, "resources": [ @@ -333,6 +333,43 @@ } ] }, + { + "mode": "managed", + "type": "aws_api_gateway_method_settings", + "name": "settings", + "provider": "provider[\"registry.terraform.io/hashicorp/aws\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "id": "mfs359kwt6-prod-*/*", + "method_path": "*/*", + "rest_api_id": "mfs359kwt6", + "settings": [ + { + "cache_data_encrypted": false, + "cache_ttl_in_seconds": 300, + "caching_enabled": false, + "data_trace_enabled": false, + "logging_level": "", + "metrics_enabled": false, + "require_authorization_for_cache_control": true, + "throttling_burst_limit": 50, + "throttling_rate_limit": 100, + "unauthorized_cache_control_header_strategy": "SUCCEED_WITH_RESPONSE_HEADER" + } + ], + "stage_name": "prod" + }, + "private": "bnVsbA==", + "dependencies": [ + "aws_api_gateway_deployment.api", + "aws_api_gateway_rest_api.api_gateway", + "aws_api_gateway_stage.prod" + ] + } + ] + }, { "mode": "managed", "type": "aws_api_gateway_resource", @@ -727,7 +764,7 @@ "id": "fellows-2020-rechtsinfo-Api", "invoke_arn": "arn:aws:apigateway:eu-central-1:lambda:path/2015-03-31/functions/arn:aws:lambda:eu-central-1:415944032879:function:fellows-2020-rechtsinfo-Api/invocations", "kms_key_arn": "", - "last_modified": "2020-10-10T15:49:17.382+0000", + "last_modified": "2020-10-12T09:05:07.075+0000", "layers": [ "arn:aws:lambda:eu-central-1:415944032879:layer:fellows-2020-rechtsinfo-lambda-deps:8" ], @@ -740,8 +777,8 @@ "s3_bucket": "fellows-2020-rechtsinfo-assets", "s3_key": "lambda_function.zip", "s3_object_version": null, - "source_code_hash": "DuYyabqv3CPcE4N/nUFdf6EJWf9rskelUA38sUAQl0c=", - "source_code_size": 58158, + "source_code_hash": "bxrR1NaffnUWK2prY3MWC6gWq1aQyEzE/0ndAsU9RAE=", + "source_code_size": 59920, "tags": {}, "timeout": 30, "timeouts": null, @@ -797,7 +834,7 @@ "id": "fellows-2020-rechtsinfo-DownloadLaws", "invoke_arn": "arn:aws:apigateway:eu-central-1:lambda:path/2015-03-31/functions/arn:aws:lambda:eu-central-1:415944032879:function:fellows-2020-rechtsinfo-DownloadLaws/invocations", "kms_key_arn": "", - "last_modified": "2020-10-10T15:49:17.378+0000", + "last_modified": "2020-10-12T09:05:09.374+0000", "layers": [ "arn:aws:lambda:eu-central-1:415944032879:layer:fellows-2020-rechtsinfo-lambda-deps:8" ], @@ -810,8 +847,8 @@ "s3_bucket": "fellows-2020-rechtsinfo-assets", "s3_key": "lambda_function.zip", "s3_object_version": null, - "source_code_hash": "DuYyabqv3CPcE4N/nUFdf6EJWf9rskelUA38sUAQl0c=", - "source_code_size": 58158, + "source_code_hash": "bxrR1NaffnUWK2prY3MWC6gWq1aQyEzE/0ndAsU9RAE=", + "source_code_size": 59920, "tags": {}, "timeout": 900, "timeouts": null, @@ -858,7 +895,7 @@ "id": "fellows-2020-rechtsinfo-IngestLaws", "invoke_arn": "arn:aws:apigateway:eu-central-1:lambda:path/2015-03-31/functions/arn:aws:lambda:eu-central-1:415944032879:function:fellows-2020-rechtsinfo-IngestLaws/invocations", "kms_key_arn": "", - "last_modified": "2020-10-10T15:49:17.377+0000", + "last_modified": "2020-10-12T09:05:13.260+0000", "layers": [ "arn:aws:lambda:eu-central-1:415944032879:layer:fellows-2020-rechtsinfo-lambda-deps:8" ], @@ -871,8 +908,8 @@ "s3_bucket": "fellows-2020-rechtsinfo-assets", "s3_key": "lambda_function.zip", "s3_object_version": null, - "source_code_hash": "DuYyabqv3CPcE4N/nUFdf6EJWf9rskelUA38sUAQl0c=", - "source_code_size": 58158, + "source_code_hash": "bxrR1NaffnUWK2prY3MWC6gWq1aQyEzE/0ndAsU9RAE=", + "source_code_size": 59920, "tags": {}, "timeout": 900, "timeouts": null, @@ -1404,7 +1441,7 @@ "replication_configuration": [], "request_payer": "BucketOwner", "server_side_encryption_configuration": [], - "tags": null, + "tags": {}, "versioning": [ { "enabled": false,