Search code examples
amazon-web-servicesterraformterraformer

How to use filters in Terraformer for importing AWS Lambda function


I have a lambda named blog-dev-createArticle in us-east-1 region. I am trying to use Terraformer to generate its terraform files.

I am unable to use filters and generate the terraform files for a specific lambda function.
I have tried the following till now but all of them either selects all the lambdas & generates the .tf files for them or selects no lambda at all.

terraformer import aws --resources=lambda --filter="Name=tags.FunctionName;Value=blog-dev-createArticle" --regions=us-east-1
terraformer import aws --resources=lambda --filter="FunctionName=blog-dev-createArticle" --regions=us-east-1
terraformer import aws --resources=lambda --filter="Type=aws_lambda_function;FunctionName=blog-dev-createArticle" --regions=us-east-1

Can someone help me in using filters for AWS Lambda with Terraformer in the right way?


Solution

  • AWS Lambda uses FunctionName as attribute for name whereas terraform uses function_name.
    So, using function_name as attribute in filter did the trick.

    terraformer import aws --resources=lambda --regions=ca-central-1 --filter="Name=function_name;Value=blog-dev-createArticle"