Skip to content

Commit

Permalink
moving files to root directory
Browse files Browse the repository at this point in the history
  • Loading branch information
Cullan Carey authored and Cullan Carey committed May 8, 2022
1 parent 841f8b1 commit 231e62b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
7 changes: 6 additions & 1 deletion lambda_rotate_header.tf
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@ resource "aws_lambda_function" "rotate_custom_header_lambda" {
handler = "rotate_custom_headers.lambda_handler"

source_code_hash = "${data.archive_file.custom_header_lambda_zip.output_base64sha256}"

environment {
variables = {
primary_bucket = "${var.root_domain_name}"
backup_bucket = "www.${var.root_domain_name}"
}
}
runtime = "python3.8"
timeout = 300
tags = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import json
import random
import string

import os

def get_bucket_policy(client, bucket_name):
result = client.get_bucket_policy(Bucket=f"{bucket_name}")
Expand Down Expand Up @@ -35,9 +35,8 @@ def get_cloudfront_headers(client, value):

def lambda_handler(event, context):
s3 = boto3.client('s3')
bucket = 'justinschoenegge.com'
backup_bucket = 'backup-justinschoenegge.com'
# header = random_pass()
bucket = os.environ['primary_bucket']
backup_bucket = os.environ['backup_bucket']
value = random_pass()
policy = get_bucket_policy(s3, bucket)
backup_policy = get_bucket_policy(s3, backup_bucket)
Expand Down

0 comments on commit 231e62b

Please sign in to comment.