Skip to content

Instantly share code, notes, and snippets.

@begmaroman
Created May 8, 2019 18:23
Show Gist options
  • Save begmaroman/bbe0d08210b2c23fcb9cf8ba41d53ab2 to your computer and use it in GitHub Desktop.
Save begmaroman/bbe0d08210b2c23fcb9cf8ba41d53ab2 to your computer and use it in GitHub Desktop.
Terraform code of CloudWatch trigger of acme-dns-route53
# Cloudwatch event rule that runs acme-dns-route53 lambda every 12 hours
resource "aws_cloudwatch_event_rule" "acme_dns_route53_sheduler" {
name = "acme-dns-route53-issuer-scheduler"
schedule_expression = "cron(0 */12 * * ? *)"
}
# Specify the lambda function to run
resource "aws_cloudwatch_event_target" "acme_dns_route53_sheduler_target" {
rule = "${aws_cloudwatch_event_rule.acme_dns_route53_sheduler.name}"
arn = "${aws_lambda_function.acme_dns_route53.arn}"
}
# Give CloudWatch permission to invoke the function
resource "aws_lambda_permission" "permission" {
action = "lambda:InvokeFunction"
function_name = "${aws_lambda_function.acme_dns_route53.function_name}"
principal = "events.amazonaws.com"
source_arn = "${aws_cloudwatch_event_rule.acme_dns_route53_sheduler.arn}"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment