Last active
November 13, 2021 11:18
-
-
Save madagra/bae2c28d262fdb24f88c224844e77d4c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module "lambda" { | |
source = "terraform-aws-modules/lambda/aws" | |
function_name = "lambda-es-backup" | |
description = "OpenSearch domain snapshot backup" | |
handler = "es_snapshot_handler.lambda_handler" | |
runtime = "python3.9" | |
attach_policy = true | |
policy = aws_iam_policy.snapshot_passrole_policy.arn | |
source_path = [ | |
"${path.module}/lambda/es_snapshot_handler.py", | |
{ | |
pip_requirements = "${path.module}/lambda/requirements.txt" | |
} | |
] | |
vpc_subnet_ids = var.lambda_vpc_subnets | |
vpc_security_group_ids = [var.lambda_vpc_sg] | |
attach_network_policy = true | |
environment_variables = { | |
DOMAIN_HOST = "https://my-aws-es-domain-url" | |
DOMAIN_REGION = "us-east-1" | |
DOMAIN_REPO_NAME = "my-es-snapshot-repo" | |
DOMAIN_SNAPSHOT_NAME = "my-es-snapshot" | |
DOMAIN_REPO_S3BUCKET = aws_s3_bucket.snapshot_repo.id | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment