DEV Community

Discussion on: Best way to make infrastructure by Terraform

aaronktberry profile image
Aaron Berry

Is it good to use terraform for invoking Lambda or serverless is the better solution?

Terraform should deal with declaring and provisioning your required infrastructure only. You can invoke Lambda functions in terraform to fetch data from that lambda function to use in your terraform modules however but it shouldn't be done to perform actions that may change infrastructure or data unknowingly.

If you need to call your lambda functions for another reason it might be good to use something like Ansible to script this action and call this as a separate step in your pipeline.