Skip to content

agy/terraform-provider-lambda

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

terraform-provider-lambda

A simple Terraform provider to invoke a syncronous AWS Lambda function and provide the output.

Similar to the HTTP provider.

Example Usage

Example Lambda Function: hello

import json


# Return the JSON event that we receive
def lambda_handler(event, context):
    e = json.dumps(event, indent=2)
    return e

Example Terraform config:

data "lambda_function_invoke" "hello" {
  fn_name = "hello"

  payload = {
    foo = "bar"
  }
}

output "lambda_output" {
  value = "${data.lambda_function_invoke.hello.*.response}"
}

Example terminal session:

$ terraform apply
data.lambda_function_invoke.hello: Refreshing state...

Apply complete! Resources: 0 added, 0 changed, 0 destroyed.

Outputs:

lambda_output = [
    {
        foo = bar
    }
]