AWS Lambda does not provide an ability to use public docker images easily. To use the Terraform automation you have two options:
-
Use ECR image pull cache (preferred way)
- Set Terraform variable
ecr_proxy_enabled=true
- Set Terraform variable
ecr_proxy_upstream_registry_url
toregistry-1.docker.io
orghcr.io
. - Create Access Token for GitHub Package registry or Docker Hub.
- Set Terraform variable
ecr_proxy_username
to your username - Set Terraform variable
ecr_proxy_access_token
to your access token
- Set Terraform variable
-
Use your own AWS ECR
- Pull kvendingoldo's image from Docker Hub / GitHub registry.
- Create your own private AWS ECR repository
- Retag pulled image and push it to your private ECR repository.
- Change
var.image
to your image URL. E.g.:image = "004867756392.dkr.ecr.us-east-1.amazonaws.com/aws_letsencrypt_lambda:0.14.0"
To get more examples, explore examples
folder.
- Add lambda module to your TF code
module "letsencrypt_lambda" {
source = "[email protected]:kvendingoldo/aws-letsencrypt-lambda.git//files/terraform/module?ref=0.14.0"
blank_name = "test-letsencrypt-lambda"
tags = {
testTagKey : "testTagValue"
}
cron_schedule = var.letsencrypt_lambda_cron_schedule
events = var.letsencrypt_lambda_events
}
- Specify variables
variable "letsencrypt_lambda_cron_schedule" {
default = "rate(168 hours)"
}
variable "letsencrypt_lambda_events" {
default = [
{
"domainName" : "<TEST_DOMAIN_1>",
"acmeUrl" : "stage",
"acmeEmail" : "<EMAIL_1>",
"reImportThreshold" : 10,
"issueType" : "force",
"storeCertInSM": "false"
},
{
"acmRegion" : "us-east-2",
"route53Region" : "us-east-1",
"domainName" : "<TEST_DOMAIN_2>",
"acmeUrl" : "prod",
"acmeEmail" : "<EMAIL_2>",
"reImportThreshold" : 30,
"issueType" : "default",
"storeCertInSM": "true"
}
]
}