Skip to content

Add support for specifying a custom Logical ID for the AWS::AppSync::GraphQLApi resource#618

Closed
manwaring wants to merge 3 commits into
sid88in:masterfrom
manwaring:master
Closed

Add support for specifying a custom Logical ID for the AWS::AppSync::GraphQLApi resource#618
manwaring wants to merge 3 commits into
sid88in:masterfrom
manwaring:master

Conversation

@manwaring

@manwaring manwaring commented Oct 3, 2023

Copy link
Copy Markdown

Exploring a possible solution to #617 by supporting a parameter to prefix the AWS::AppSync::GraphQLApi Logical ID (instead of only supporting GraphQlApi)

  • Update plugin schema/types
  • Add optional override property
  • Add unit tests
  • Confirm if approach is acceptable to library creator/maintainer

Comment thread src/resources/Naming.ts

getAuthenticationEmbeddedLamdbaName() {
return `${this.apiName}Authorizer`;
return `${this.config.name}Authorizer`;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this necessary?

Unless I am missing something, we probably could get away with having a
apiLogicalId that overrides getLogicalId.

The rest of the logical ids should be safe. i.e. They might be re-created but they are not stateful.

That would simplify everything.

Comment thread src/types/plugin.ts
pipelineFunctions: Record<string, PipelineFunctionConfig>;
substitutions?: Substitutions;
xrayEnabled?: boolean;
logicalIdPrefix?: string;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As per my other comment, could this be named apiLogicalId?

@bboure bboure left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @manwaring

Could we also add documentation of when and how to use it?

@sid88in

sid88in commented Jun 4, 2026

Copy link
Copy Markdown
Owner

Closing this in its current form — as noted in review, it makes far more logical IDs
configurable than necessary. Only the AWS::AppSync::GraphQLApi logical ID is stateful
(changing it replaces the API); the schema/data-source/resolver/log-group IDs can be
recreated harmlessly, so they don't need to be overridable.

The useful, minimal version of this is a single optional apiLogicalId that overrides just
getApiLogicalId() — handy for migrating an existing CFN-managed API into the plugin without
forcing a replacement. If anyone wants that, I've opened a scoped good first issue for it.

Thanks for the contribution and the prod on the use case!

@sid88in sid88in closed this Jun 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants