Skip to content

RestApi Endpoint Output Name & Export #1611

@aecollver

Description

@aecollver

The Endpoint child created by RestApi doesn't seem usable because it has random characters appended to it (e.g. apiEndpoint9349E63C) and the exported name collides across multiple stack instances (I'm synthesizing the stack once in a build step and deploying multiple instances of it from CodePipeline).

Can we remove the Endpoint child construct so 1) I don't have to use findChild to disable exporting the output (see below) and 2) I don't have unnecessary stack outputs?

     const restApi = new api.RestApi(this, 'api', {
      restApiName: (new cdk.AwsStackName()) as any
    });
    // Don't export the stack output because it collides when multiple
    // CloudFormation stacks are created in one account.
    restApi.findChild('Endpoint')['export'] = undefined;

    new cdk.Output(this, 'Endpoint', {
      value: restApi.urlForPath(),
      disableExport: true
    });

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions