Hey Clint -
Sure! Happy to elaborate.
Local invocation is very important and I'm glad you highlighted as much. To touch quickly on something Stephen said:
"...flexibility you are talking about is great during development..."
I may be misinterpreting but this to me is making a slight mistake in thinking there's a distinct development phase that's different from production operation and ongoing dev maintenance and feature development. There are differences between non-prod and prod-ops but the development toolchain and frameworks really need to be able to sustain through a project from design to sunset. I think it's healthy if we all think of development as a core part of basically all steps in application lifecycle.
What else to consider:
1. workflow is captured in one tool - sls gives the developer a one stop shop for serverless development. Check logs, deploy to a certain environment, roll back a deployment, check function stats, etc. I think the 3 step dance of packaging an application and its dependencies, uploading that to S3, and only then deploying to lambda for a certain stage/alias, makes it difficult to fit this in the terraform mold of a single step. I can imagine potentially a CI/CD pipeline operating on the sls application repo having a final step of S3 upload and have terraform handle the rest... this is not something I've implemented but would likely be worth exploring.
2. configuration captured in one place - with any of the serverless frameworks, your project (which can be a set of lambdas or a singleton) is by convention contained in a single repo. A serverless.yml (while likely split by environment, section, etc) captures all permissions, extra resources, and events. Most developers will find this more comfortable than a separation of potentially 3 or 4 repos that make up a well architected lambda app in terraform (a repo for each of the lambda application, a lambda module, potentially a lambda event module, and a terraform live repo to instantiate). IAM of course needs to be squeezed within one of those modules too.
3. out of box experience - probably the biggest reason to chose a framework is getting up and running with serverless development in minutes. With terraform, that's definitely not the case. Following the guide I linked to in my last post, while fine for someone with terraform experience, would not be such a simple task for someone uninitiated in this space.
4. The plugin ecosystem is not always high quality but it exists and covers tons of uses- If you want to extend how sls works, search github for a plugin or drop into node and hack away. My milage has varied with some of these plugins (hello orphaned resources), but others are solid (local mock dynamo, ).
To me it's obvious why sls (and friends) does a better job in this space: it's the only thing sls is designed to do whereas terraform handles the world (quite well!). I think as a developer using heroku, app engine, or elastic beanstalk you'd probably find a similar experience when comparing to terraform. I've shepherded an EB app to prod using terraform at ${last_job}. Though we did it, but it never really felt like a clean fit.
I want to stress that I'm not a serverless framework (zappa, apex, SAM, sls) fanboy. Quite the opposite: I'd MUCH rather be using terraform for everything and have often considered cobbling together the modules to bridge as much of the above as possible. I just don't think tf has the right ingredients today to be the best for working with FaaS. A subset of the problems above, terraform doesn't have an answer for because it wasn't built with AWS lambda at the center of its universe. I'd love to be shown otherwise!
Stephen - To your problem, at a previous gig, I built CI/CD around the sls tool and give limited IAM policies (not for the faint of heart) to the core developers such that they could run sls for local feature branches deploying to live (dev) functions but needed to invoke it through the normal git workflow to hit dev/test/stage/prod via the pipeline. This was adequate for us as the team owned nothing else that was terraform defined so it honestly didn't matter that we had a different tool under the hood. Obviously, every project has its own requirements and I doubt this will be a perfect fit for you but hopefully it's at least a jumping off point.
- Brandon