Skip to content

Commit

Permalink
Run daily imports earlier at night
Browse files Browse the repository at this point in the history
  • Loading branch information
nfelger committed Oct 15, 2020
1 parent 4623eda commit 1f2cb03
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 24 deletions.
4 changes: 2 additions & 2 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -207,15 +207,15 @@ 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" {
rule = aws_cloudwatch_event_rule.daily_import.name
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
Expand Down
22 changes: 11 additions & 11 deletions terraform.tfstate
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"version": 4,
"terraform_version": "0.13.4",
"serial": 220,
"serial": 223,
"lineage": "2960cc07-ae92-c576-4518-c66c2b2322ce",
"outputs": {},
"resources": [
Expand Down Expand Up @@ -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=="
Expand Down Expand Up @@ -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"
],
Expand All @@ -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,
Expand Down Expand Up @@ -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"
],
Expand All @@ -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,
Expand Down Expand Up @@ -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"
],
Expand All @@ -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,
Expand Down
59 changes: 48 additions & 11 deletions terraform.tfstate.backup
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"version": 4,
"terraform_version": "0.13.4",
"serial": 217,
"serial": 220,
"lineage": "2960cc07-ae92-c576-4518-c66c2b2322ce",
"outputs": {},
"resources": [
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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"
],
Expand All @@ -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,
Expand Down Expand Up @@ -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"
],
Expand All @@ -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,
Expand Down Expand Up @@ -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"
],
Expand All @@ -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,
Expand Down Expand Up @@ -1404,7 +1441,7 @@
"replication_configuration": [],
"request_payer": "BucketOwner",
"server_side_encryption_configuration": [],
"tags": null,
"tags": {},
"versioning": [
{
"enabled": false,
Expand Down

0 comments on commit 1f2cb03

Please sign in to comment.