Skip to content

Commit

Permalink
Merge pull request #26 from NASA-IMPACT/fix/duplicate-cfn-export
Browse files Browse the repository at this point in the history
fix: unique export names for cfn outputs
  • Loading branch information
anayeaye authored Mar 6, 2024
2 parents ed29ead + 9e400ae commit 1f422b9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
4 changes: 2 additions & 2 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
# In this case, we want this client to be able to only register new STAC ingestions in
# the STAC ingestion registry service.
stack.add_service_client(
"veda-workflows",
"workflows-client",
scopes=[
stac_registry_scopes["stac:register"],
],
Expand All @@ -98,7 +98,7 @@
)

# Programmatic Clients
client = stack.add_programmatic_client(f"{app_settings.app_name}-{app_settings.stage}-veda-sdk")
client = stack.add_programmatic_client("programmatic-client")
CfnOutput(
stack,
"client_id",
Expand Down
15 changes: 10 additions & 5 deletions infra/stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def __init__(
)
else:
auth_provider_client = self.add_programmatic_client(
f"{stack_name}-identity-provider",
"identity-provider",
name="Identity Pool Authentication Provider",
)
if app_settings.data_managers_role_arn:
Expand Down Expand Up @@ -320,20 +320,23 @@ def add_programmatic_client(
user_pool_client_name=name or service_id,
# disable_o_auth=True,
)

region = Stack.of(self).region
self._create_secret(
service_id,
{
"flow": "user_password",
"cognito_domain": self.domain.base_url(),
"client_id": client.user_pool_client_id,
"userpool_id": self.userpool.user_pool_id,
"aws_region": region,
},
)
stack_name = Stack.of(self).stack_name
CfnOutput(
self,
f"cognito-sdk-{service_id}-secret",
export_name=f"{stack_name}-cognito-sdk-secret",
f"{service_id}-secret-id",
export_name=f"{stack_name}-{service_id}-secret-id",
value=f"{stack_name}/{service_id}",
)

Expand All @@ -360,6 +363,7 @@ def add_service_client(
disable_o_auth=False,
)

region = Stack.of(self).region
self._create_secret(
service_id,
{
Expand All @@ -369,14 +373,15 @@ def add_service_client(
"client_secret": self._get_client_secret(client),
"userpool_id": self.userpool.user_pool_id,
"scope": " ".join(scope.scope_name for scope in scopes),
"aws_region": region,
},
)

stack_name = Stack.of(self).stack_name
CfnOutput(
self,
f"cognito-app-{service_id}-secret",
export_name=f"{stack_name}-cognito-app-secret",
f"{service_id}-secret-id",
export_name=f"{stack_name}-{service_id}-secret-id",
value=f"{stack_name}/{service_id}",
)

Expand Down

0 comments on commit 1f422b9

Please sign in to comment.