Skip to content

feature request: bring back export outputs with --include-outputs arg #35

@theburningmonk

Description

@theburningmonk

In v2.0 the plugin has removed fetching the stack outputs, while I'm not sure what you were referring to when you said it caused more problems than it solved, but it was a very valuable capability.

From some of the changes in 2.0 I guess the use case you have in mind is for capturing env vars for individual functions to facilitate sls invoke, but another use case I've had for this plugin is to support testing my function code locally before deploying them (what I call "integration tests").

For that use case, I'm always capturing all the environment variables (I use a consistent naming convention to the env vars so when two env vars have the same name, they reference the same CFN resource), and there are often times when there are things that I don't want to include as env vars for the functions themselves. For example, when using cognito, I might create a cognito client to use by the test and allows the test to set up new users to test the authenticated endpoints (in what I call "end-to-end tests" even though these tests don't test the client application, which might be a mobile app or a web app, but nonetheless they test the deployed API endpoints to make sure they're working as expected). This cognito client is not necessary for any of the Lambda functions and is used only by the tests, so it's a bit silly to have to add it to some random function (or worse yet, to the provider.environment) just so I can capture it in the .env file.

In some cases, we'd also like to add conditional resources to facilitate end-to-end tests for more event-driven architectures, e.g. creating SQS queues to subscribe to EventBridge buses in dev environments so we can poll the queue to see what messages are sent to EventBridge. It's hard to capture these conditional resources into environment variables, but it's easy to capture them as stack outputs.

There are other plugins that can capture the stack output, but using two plugins that write to the .env file creates other problems (besides just adding more moving parts) such as the fact that each plugin would want to overwrite the whole file. So if I can get this plugin to fetch the stack outputs as well, it'd make life so much easier.

I understand that you've made an explicit decision to move away from doing this in v2, but how about making it an optional behaviour and gate it with another flag like --include-outputs?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions