aws / aws/aws-cdk

feat(cli): Get StackOutputs in CDK application

Open
#8,566 3 comments 15 reactions 0 assignees View on GitHub
effort/medium feature-request p2 package/tools
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### Use Case

I have an output
```typescript
const output = new CfnOutput(this, 'BastionPublicIP', {
exportName: 'bastion-public-ip',
value: bastion.instancePublicIp,
description: 'The public IP address of the bastion host'
});
```

And I want a simple way where I can console out a message to the user for how to to connect to the bastion host, without having to write another shell script or application that has to parse the output json file.

```typescript
console.log('Use the following ssh command to connect to the bastion host:');
console.log(`ssh ec2-user@${output.value}`)
```

### Proposed Solution

Unfortunately, I am not aware of the internals of the cli, but it would seem like perhaps some form of protected callback method in the Stack or App might be provided.

There is `Stack.resolve()` but the documentation isn't clear as to what scenario it is used for.

---

This is a :rocket: Feature Request

Contributor guide

Open the contributing guide

Research direction

Start by reading the CfnOutput example and the existing Stack.resolve() documentation or implementation. Investigate how the CLI currently produces the output JSON file and whether Stack or App exposes a suitable extension point. Done should provide a supported way for a CDK application to access StackOutputs and print a connection message without an external parser or script.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
cli, infrastructure
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.