Skip to content

Commit

Permalink
[Housekeeping] Rename: information-diet -> diet
Browse files Browse the repository at this point in the history
- Concision is cool?
  • Loading branch information
blairnangle committed Dec 6, 2023
1 parent a78c226 commit 83ce67f
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# information-diet
# diet

Aggregating the content I've consumed.

Expand Down
2 changes: 1 addition & 1 deletion infra/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ provider "aws" {
terraform {
backend "s3" {
bucket = "terraform-state-blair-nangle"
key = "information-diet/terraform.tfstate"
key = "diet/terraform.tfstate"
region = "eu-west-2"
dynamodb_table = "terraform-locks"
encrypt = true
Expand Down
22 changes: 11 additions & 11 deletions infra/s3.tf
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
resource "aws_s3_bucket" "information_diet" {
bucket = "information-diet.blairnangle.com"
resource "aws_s3_bucket" "diet" {
bucket = "diet.blairnangle.com"
}

resource "aws_s3_bucket_public_access_block" "information_diet" {
bucket = aws_s3_bucket.information_diet.id
resource "aws_s3_bucket_public_access_block" "diet" {
bucket = aws_s3_bucket.diet.id

block_public_acls = false
block_public_policy = false
ignore_public_acls = false
restrict_public_buckets = false
}

resource "aws_s3_bucket_policy" "information_diet" {
bucket = aws_s3_bucket.information_diet.id
resource "aws_s3_bucket_policy" "diet" {
bucket = aws_s3_bucket.diet.id
policy = templatefile("${path.module}/templates/s3.json", {
awsAccountNumber = var.aws_account_number,
lambdaRoleArn = aws_iam_role.pocket.arn,
bucketName = aws_s3_bucket.information_diet.bucket
bucketName = aws_s3_bucket.diet.bucket
})
}

locals {
n_days_to_keep_s3_objects = 365
}

resource "aws_s3_bucket_lifecycle_configuration" "information_diet" {
bucket = aws_s3_bucket.information_diet.id
resource "aws_s3_bucket_lifecycle_configuration" "diet" {
bucket = aws_s3_bucket.diet.id

rule {
id = "delete-objects-older-than-${local.n_days_to_keep_s3_objects}-days"
Expand All @@ -36,8 +36,8 @@ resource "aws_s3_bucket_lifecycle_configuration" "information_diet" {
}
}

resource "aws_s3_bucket_cors_configuration" "information_diet" {
bucket = aws_s3_bucket.information_diet.id
resource "aws_s3_bucket_cors_configuration" "diet" {
bucket = aws_s3_bucket.diet.id

cors_rule {
allowed_headers = ["*"]
Expand Down
4 changes: 2 additions & 2 deletions infra/secrets_manager.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
resource "aws_secretsmanager_secret" "pocket_consumer_key" {
name = "information-diet-pocket-consumer-key"
name = "diet-pocket-consumer-key"
}

resource "aws_secretsmanager_secret_version" "pocket_consumer_key" {
Expand All @@ -8,7 +8,7 @@ resource "aws_secretsmanager_secret_version" "pocket_consumer_key" {
}

resource "aws_secretsmanager_secret" "pocket_access_token" {
name = "information-diet-pocket-access-token"
name = "diet-pocket-access-token"
}

resource "aws_secretsmanager_secret_version" "pocket_access_token" {
Expand Down
2 changes: 1 addition & 1 deletion src/goodreads.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def process_shelf(shelf_name: str) -> None:
date_field=("finished" if shelf_name == "read" else "started"),
)

bucket = "information-diet.blairnangle.com"
bucket = "diet.blairnangle.com"
latest_file_name = f"goodreads-{shelf_name}.json"

logging.info(f"Writing {latest_file_name} to temporary directory")
Expand Down
2 changes: 1 addition & 1 deletion src/letterboxd.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def lambda_handler(event, context):

films = parse_films()

bucket = "information-diet.blairnangle.com"
bucket = "diet.blairnangle.com"
latest_file_name = "letterboxd.json"

logging.info(f"Writing {latest_file_name} to temporary directory")
Expand Down
6 changes: 3 additions & 3 deletions src/pocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ def lambda_handler(event, context):
)

consumer_key: str = secrets_manager_client.get_secret_value(
SecretId="information-diet-pocket-consumer-key"
SecretId="diet-pocket-consumer-key"
)["SecretString"]

access_token: str = secrets_manager_client.get_secret_value(
SecretId="information-diet-pocket-access-token"
SecretId="diet-pocket-access-token"
)["SecretString"]

response: json = requests.post(
Expand Down Expand Up @@ -58,7 +58,7 @@ def lambda_handler(event, context):
}
)

bucket = "information-diet.blairnangle.com"
bucket = "diet.blairnangle.com"
latest_file_name = "pocket.json"

with open(f"/tmp/{latest_file_name}", "w") as f:
Expand Down

0 comments on commit 83ce67f

Please sign in to comment.