Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: temporary hack to create an exact export name #29

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@
)

# Programmatic Clients
client = stack.add_programmatic_client("programmatic-client")
# Note add_cognito_app_secret_export forces an export named <stack-name>-cognito-app-secret
# but defaults to False to avoid duplicate export names for mulitple clients
client = stack.add_programmatic_client("programmatic-client", add_congito_app_secret_export=True)
CfnOutput(
stack,
"client_id",
Expand Down
11 changes: 11 additions & 0 deletions infra/stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@ def add_programmatic_client(
self,
service_id: str,
name: Optional[str] = None,
add_congito_app_secret_export: Optional[bool] = False,
) -> cognito.UserPoolClient:
client = self.userpool.add_client(
service_id,
Expand Down Expand Up @@ -340,6 +341,16 @@ def add_programmatic_client(
value=f"{stack_name}/{service_id}",
)

# Temporarily support a downstream application looking for this exact export name,
# this will fail if multiple clients are configured with this flag set to true
if add_congito_app_secret_export:
CfnOutput(
self,
f"{service_id}-duplicate-export-cognito-app-secret",
export_name=f"{stack_name}-cognito-app-secret",
value=f"{stack_name}/{service_id}",
)

return client

def add_service_client(
Expand Down
Loading