Changes
- #1871
d3c30eb5b
- Auth: make "attachPermissionsToAuthUsers" take scope to control stack dependencies when referening resources from another stack
Auth.attachPermissionsForAuthUsers()
and Auth.attachPermissionsForUnauthUsers()
now take a scope as the first argument. Previously, when attaching permissions, the IAM policies were always added to Auth
's stack. This means that when attaching permissions from another stack, it will create a stack dependency. In some cases, this can lead to a cyclic dependency. For example:
// AuthStack.ts
const auth = new Auth(stack, "auth");
return { auth };
// ApiStack.ts
const { auth } = use(AuthStack);
const api = new Api(stack, "api", {
defaults: {
function: {
environment: {
// This causes ApiStack depend on AuthStack
USER_POOL_ID: auth.userPooldId,
}
}
}
});
// This causes AuthStack depend on ApiStack
auth.attachPermissionsForAuthUsers([api]);
Instead, if the IAM policies were added to the ApiStack, AuthStack would no longer depend on ApiStack, breaking the cyclic dependency. You can do that:
auth.attachPermissionsForAuthUsers(stack, permissions)
And if you want to preserve the previous behavior:
// Change
auth.attachPermissionsForAuthUsers([api]);
// to
auth.attachPermissionsForAuthUsers(auth, [api]);
430549cc8
- sst console: fix undefined port in the console link
Update using:
$ npx sst update v1.3.0
$ yarn sst update v1.3.0