aws-amplify / amplify-cli

The AWS Amplify CLI is a toolchain for simplifying serverless web and mobile development.
Apache License 2.0
2.81k stars 819 forks source link

provide .addCfnOutput capability on AmplifyApiGraphQlResourceStackTemplate #13867

Closed electronicalias closed 2 months ago

electronicalias commented 2 months ago

Is this feature request related to a new or existing Amplify category?

api

Is this related to another service?

No response

Describe the feature you'd like to request

All other supported overrides allow for the resources.addCfnOutput method. Whereas with graphql apis it does not.

Describe the solution you'd like

When overriding the graphql api, I should be able to do the following:

resources.addCfnOutput({
    'value': `${resources.api?.GraphQLAPI?.attrRealtimeUrl}`,
    'description': 'abcd'
 }, 'thisResourceName')

Describe alternatives you've considered

No idea if this is the right terminology but I've tried to type cast things like .node, .rootStack etc, but can't find a way to natively create a cfnOutput etc.

Additional context

No response

Is this something that you'd be interested in working on?

Would this feature include a breaking change?

electronicalias commented 2 months ago

fresheyes

I managed to solve it by using this workaround, but... janky!

if (!resources.api || !resources.api.GraphQLAPI) {
        throw new Error('rootstack is undefined. Please check the structure of the resources object.');
}
const rootStack = resources.api.GraphQLAPI?.stack;

new cdk.CfnOutput(rootStack, 'someRealtimeApiId', {
        value: graphqlApiId,
        description: 'someRealtimeApiId',
});
github-actions[bot] commented 2 months ago

This issue is now closed. Comments on closed issues are hard for our team to see. If you need more assistance, please open a new issue that references this one.