Skip to content

Commit

Permalink
BBL-275 make format has been applied
Browse files Browse the repository at this point in the history
  • Loading branch information
exequielrafaela committed May 15, 2020
1 parent 1d389bc commit e7731c9
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
14 changes: 7 additions & 7 deletions bucket.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,25 @@
# This bucket will be used for storing certificates.
#
resource "aws_s3_bucket" "certificates_store" {
bucket = "${var.name_prefix}-certificates-${var.name}"
acl = "private"
bucket = "${var.name_prefix}-certificates-${var.name}"
acl = "private"
force_destroy = true

versioning {
enabled = true
}

lifecycle {
prevent_destroy = false
}

server_side_encryption_configuration {
rule {
apply_server_side_encryption_by_default {
sse_algorithm = "AES256"
}
}
}

tags = local.tags
}
}
6 changes: 3 additions & 3 deletions cloudwatch.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ resource "aws_cloudwatch_event_target" "lets_encrypt_timer_target" {

# Give cloudwatch permission to invoke the function
resource "aws_lambda_permission" "permission" {
action = "lambda:InvokeFunction"
action = "lambda:InvokeFunction"
function_name = module.certbot_lambda_jenkins.function_name
principal = "events.amazonaws.com"
source_arn = aws_cloudwatch_event_rule.certbot_lambda_timer.arn
principal = "events.amazonaws.com"
source_arn = aws_cloudwatch_event_rule.certbot_lambda_timer.arn
}
20 changes: 10 additions & 10 deletions lambda.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@
# LetsEncrypt certificates and stores them in an S3 bucket.
#
module "certbot_lambda_jenkins" {
source = "git::https://github.com/binbashar/terraform-aws-lambda?ref=master"
source = "github.com/binbashar/terraform-aws-lambda?ref=v1.2.0"

function_name = "${var.name_prefix}-${var.name}"
description = "CertBot Lambda that creates and renews certificates for ${var.certificate_domains}"
handler = "main.lambda_handler"
runtime = "python3.6"
timeout = 300

source_path = "${path.module}/src/"

trusted_entities = ["events.amazonaws.com"]

policy = {
json = data.aws_iam_policy_document.bucket_permissions.json
}

environment = {
variables = {
EMAIL = var.contact_email
Expand All @@ -41,7 +41,7 @@ data "aws_iam_policy_document" "bucket_permissions" {
aws_s3_bucket.certificates_store.arn
]
}

statement {
actions = [
"s3:PutObject"
Expand All @@ -51,15 +51,15 @@ data "aws_iam_policy_document" "bucket_permissions" {
"${aws_s3_bucket.certificates_store.arn}/*"
]
}

statement {
actions = [
"route53:ListHostedZones",
"route53:GetChange"
]
resources = ["*"]
}

statement {
actions = [
"route53:ChangeResourceRecordSets"
Expand All @@ -68,4 +68,4 @@ data "aws_iam_policy_document" "bucket_permissions" {
"arn:aws:route53:::hostedzone/${var.hosted_zone_id}"
]
}
}
}

0 comments on commit e7731c9

Please sign in to comment.