there are few ways to do it, for example by activating one of your AWS profiles:
export AWS_PROFILE=profile-name
or just exporting your keys
export AWS_ACCESS_KEY_ID=************
export AWS_SECRET_ACCESS_KEY=***********
https://learn.hashicorp.com/terraform/getting-started/install.html
now you can create a main.tf file under the root of your node lambda project
module "lambda-deploy" {
source = "app.terraform.io/roby/lambda-deploy/xxxxxx"
version = "0.0.1"
name = "audit_logger"
region = "ap-southeast-1"
src = "./"
lambdavars = {
hello1 = "ciao"
hello2 = 1284698.55
hello3 = "ciao2"
hello4 = "ciao3"
}
}
lambdavars will be injected in the lambda variables configuration and will be available via process.env
name will be the name of your lambda function
src is the source of the lambda (same level of package.json)
now you can run
terraform init
terraform apply -auto-approve
terraform destroy -auto-approve