I'm migrating multiple AWS Lambda functions to GCP and need to generate Terraform configurations that match the existing AWS setup. Currently, I'm manually writing each Lambda configuration, which is time-consuming and error-prone.
I'm manually creating Terraform maps like this for each Lambda function:
entity_gateway = {
function_name = "one-journey-genai-entityGateway"
role = "arn:aws:iam::<ACCOUNT_ID>:role/<ENTITY_GATEWAY_ROLE>"
handler = "src/api/v1/endpoint/entity/gateway.handler"
runtime = "nodejs20.x"
memory_size = 1536
timeout = 30
architectures = ["arm64"]
package_type = "Zip"
publish = false
description = ""
s3_bucket = "<S3_BUCKET>"
s3_key = "<S3_KEY>"
layers = ["arn:aws:lambda:<REGION>:<ACCOUNT_ID>:layer:googleStorage:<VERSION>"]
environment_variables = local.common_env_vars
tags = {
STAGE = "genai"
}
}
debugs = {
function_name = "one-journey-genai-debugs"
role = "arn:aws:iam::<ACCOUNT_ID>:role/<DEBUGS_ROLE>"
handler = "src/api/v1/core/debugs/event.handler"
runtime = "nodejs20.x"
memory_size = 1536
timeout = 6
architectures = ["arm64"]
package_type = "Zip"
publish = false
description = ""
s3_bucket = "<S3_BUCKET>"
s3_key = "<S3_KEY>"
layers = []
environment_variables = local.common_env_vars
tags = {
STAGE = "genai"
}
}
What I Need
I want to automate extracting Lambda configurations from AWS and generating Terraform code, so that when I run terraform plan, it shows no changes (configuration matches existing state).