aws-cdk-action icon indicating copy to clipboard operation
aws-cdk-action copied to clipboard

Expose stack outputs to Action

Open HappyEinara opened this issue 4 years ago • 2 comments

Hi there, not so much an issue as a feature request or question.

I am experimenting with using Actions + CDK to deploy a Lambda function with API Gateway, and as you probably know, on success the URL of the API is output as a "stack output" by CDK.

Is it currently possible, or could you consider making it possible, to somehow capture such stack outputs for re-use in the Action, perhaps as an environment variable?

Example use case: I deploy my api with gitops and would like to receive a Slack post (sent by the action) which includes the API url from the stack output later in the workflow on a successful deployment.

HappyEinara avatar Jul 12 '20 03:07 HappyEinara

This can be done with outputs, although it might be tricky to capture the API URL from the CDK output.

ScottBrenner avatar Jul 12 '20 05:07 ScottBrenner

cdk seems to output the line Outputs: followed by key-value pairs in the format key = value. Perhaps they could be mapped up to Action outputs generally, just passing through the CDK outputs as Action outputs (with a prefix?), and leaving the job of understanding them to the downstream jobs.

E.g.:

Outputs:
test001.Endpoint*** = https://***.execute-api.ap-southeast-2.amazonaws.com/prod/

TBH I'll probably be doing this sort of thing with custom domain names most of the time anyway so I wouldn't consider this urgent, but it would be nice to have. Getting the stack outputs accessible might be pretty useful generally though,

HappyEinara avatar Jul 12 '20 05:07 HappyEinara