diff --git a/infrastructure/src/api/endpoints/create-endpoint.ts b/infrastructure/src/api/endpoints/create-endpoint.ts index 7a1ecfc9..068ddc5b 100644 --- a/infrastructure/src/api/endpoints/create-endpoint.ts +++ b/infrastructure/src/api/endpoints/create-endpoint.ts @@ -1,5 +1,5 @@ import { PythonFunction } from '@aws-cdk/aws-lambda-python-alpha'; -import {aws_dynamodb, aws_lambda, aws_sqs, Duration} from 'aws-cdk-lib'; +import {Aws, aws_dynamodb, aws_lambda, aws_sqs, Duration} from 'aws-cdk-lib'; import { JsonSchemaType, JsonSchemaVersion, LambdaIntegration, Model, Resource } from 'aws-cdk-lib/aws-apigateway'; import { Table } from 'aws-cdk-lib/aws-dynamodb'; import { Role } from 'aws-cdk-lib/aws-iam'; @@ -221,7 +221,7 @@ export class CreateEndpointApi { } private apiLambda() { - const role = Role.fromRoleName(this.scope, `${this.baseId}-role`, ESD_ROLE); + const role = Role.fromRoleName(this.scope, `${this.baseId}-role`, `${ESD_ROLE}-${Aws.REGION}`); return new PythonFunction(this.scope, `${this.baseId}-lambda`, { entry: '../middleware_api/endpoints', diff --git a/infrastructure/src/api/endpoints/delete-endpoints.ts b/infrastructure/src/api/endpoints/delete-endpoints.ts index 0ccae159..1dc20438 100644 --- a/infrastructure/src/api/endpoints/delete-endpoints.ts +++ b/infrastructure/src/api/endpoints/delete-endpoints.ts @@ -1,5 +1,5 @@ import {PythonFunction} from '@aws-cdk/aws-lambda-python-alpha'; -import {aws_lambda, Duration} from 'aws-cdk-lib'; +import {Aws, aws_lambda, Duration} from 'aws-cdk-lib'; import {JsonSchemaType, JsonSchemaVersion, LambdaIntegration, Model, Resource} from 'aws-cdk-lib/aws-apigateway'; import {Table} from 'aws-cdk-lib/aws-dynamodb'; import {Role} from 'aws-cdk-lib/aws-iam'; @@ -83,7 +83,7 @@ export class DeleteEndpointsApi { } private apiLambda() { - const role = Role.fromRoleName(this.scope, `${this.baseId}-role`, ESD_ROLE); + const role = Role.fromRoleName(this.scope, `${this.baseId}-role`, `${ESD_ROLE}-${Aws.REGION}`); return new PythonFunction(this.scope, `${this.baseId}-lambda`, { entry: '../middleware_api/endpoints', diff --git a/infrastructure/src/api/endpoints/list-endpoints.ts b/infrastructure/src/api/endpoints/list-endpoints.ts index b7373217..9e415b48 100644 --- a/infrastructure/src/api/endpoints/list-endpoints.ts +++ b/infrastructure/src/api/endpoints/list-endpoints.ts @@ -1,5 +1,5 @@ import { PythonFunction } from '@aws-cdk/aws-lambda-python-alpha'; -import {aws_apigateway, aws_dynamodb, aws_lambda, Duration} from 'aws-cdk-lib'; +import {Aws, aws_apigateway, aws_dynamodb, aws_lambda, Duration} from 'aws-cdk-lib'; import { JsonSchemaType, JsonSchemaVersion, LambdaIntegration, Model } from 'aws-cdk-lib/aws-apigateway'; import {Role} from 'aws-cdk-lib/aws-iam'; import { Architecture, Runtime } from 'aws-cdk-lib/aws-lambda'; @@ -141,7 +141,7 @@ export class ListEndpointsApi { } private apiLambda() { - const role = Role.fromRoleName(this.scope, `${this.baseId}-role`, ESD_ROLE); + const role = Role.fromRoleName(this.scope, `${this.baseId}-role`, `${ESD_ROLE}-${Aws.REGION}`); return new PythonFunction(this.scope, `${this.baseId}-lambda`, { entry: '../middleware_api/endpoints', diff --git a/infrastructure/src/api/roles/create-role.ts b/infrastructure/src/api/roles/create-role.ts index b0b48786..cd9c8527 100644 --- a/infrastructure/src/api/roles/create-role.ts +++ b/infrastructure/src/api/roles/create-role.ts @@ -1,5 +1,5 @@ import { PythonFunction } from '@aws-cdk/aws-lambda-python-alpha'; -import {aws_apigateway, aws_lambda, Duration} from 'aws-cdk-lib'; +import {Aws, aws_apigateway, aws_lambda, Duration} from 'aws-cdk-lib'; import { JsonSchemaType, JsonSchemaVersion, LambdaIntegration, Model } from 'aws-cdk-lib/aws-apigateway'; import {Role} from 'aws-cdk-lib/aws-iam'; import { Architecture, Runtime } from 'aws-cdk-lib/aws-lambda'; @@ -119,7 +119,7 @@ export class CreateRoleApi { } private apiLambda() { - const role = Role.fromRoleName(this.scope, `${this.baseId}-role`, ESD_ROLE); + const role = Role.fromRoleName(this.scope, `${this.baseId}-role`, `${ESD_ROLE}-${Aws.REGION}`); return new PythonFunction(this.scope, `${this.baseId}-lambda`, { entry: '../middleware_api/roles', diff --git a/infrastructure/src/api/roles/delete-roles.ts b/infrastructure/src/api/roles/delete-roles.ts index cad74b5a..2b85f82e 100644 --- a/infrastructure/src/api/roles/delete-roles.ts +++ b/infrastructure/src/api/roles/delete-roles.ts @@ -1,5 +1,5 @@ import { PythonFunction } from '@aws-cdk/aws-lambda-python-alpha'; -import {aws_lambda, Duration} from 'aws-cdk-lib'; +import {Aws, aws_lambda, Duration} from 'aws-cdk-lib'; import { JsonSchemaType, JsonSchemaVersion, @@ -95,7 +95,7 @@ export class DeleteRolesApi { } private apiLambda() { - const role = Role.fromRoleName(this.scope, `${this.baseId}-role`, ESD_ROLE); + const role = Role.fromRoleName(this.scope, `${this.baseId}-role`, `${ESD_ROLE}-${Aws.REGION}`); return new PythonFunction( this.scope, diff --git a/infrastructure/src/api/roles/list-roles.ts b/infrastructure/src/api/roles/list-roles.ts index ed0c9a03..bf550795 100644 --- a/infrastructure/src/api/roles/list-roles.ts +++ b/infrastructure/src/api/roles/list-roles.ts @@ -1,5 +1,5 @@ import { PythonFunction } from '@aws-cdk/aws-lambda-python-alpha'; -import {aws_apigateway, aws_lambda, Duration} from 'aws-cdk-lib'; +import {Aws, aws_apigateway, aws_lambda, Duration} from 'aws-cdk-lib'; import { JsonSchemaType, JsonSchemaVersion, LambdaIntegration, Model } from 'aws-cdk-lib/aws-apigateway'; import {Role} from 'aws-cdk-lib/aws-iam'; import { Architecture, Runtime } from 'aws-cdk-lib/aws-lambda'; @@ -107,7 +107,7 @@ export class ListRolesApi { } private apiLambda() { - const role = Role.fromRoleName(this.scope, `${this.baseId}-role`, ESD_ROLE); + const role = Role.fromRoleName(this.scope, `${this.baseId}-role`, `${ESD_ROLE}-${Aws.REGION}`); return new PythonFunction(this.scope, `${this.baseId}-lambda`, { entry: '../middleware_api/roles', diff --git a/infrastructure/src/api/schemas/create-schema.ts b/infrastructure/src/api/schemas/create-schema.ts index 6fe212b0..cee8afd8 100644 --- a/infrastructure/src/api/schemas/create-schema.ts +++ b/infrastructure/src/api/schemas/create-schema.ts @@ -1,5 +1,5 @@ import { PythonFunction } from '@aws-cdk/aws-lambda-python-alpha'; -import {aws_lambda, Duration} from 'aws-cdk-lib'; +import {Aws, aws_lambda, Duration} from 'aws-cdk-lib'; import { JsonSchemaType, JsonSchemaVersion, LambdaIntegration, Model, Resource } from 'aws-cdk-lib/aws-apigateway'; import { Table } from 'aws-cdk-lib/aws-dynamodb'; import { Role } from 'aws-cdk-lib/aws-iam'; @@ -134,7 +134,7 @@ export class CreateSchemaApi { } private apiLambda() { - const role = Role.fromRoleName(this.scope, `${this.baseId}-role`, ESD_ROLE); + const role = Role.fromRoleName(this.scope, `${this.baseId}-role`, `${ESD_ROLE}-${Aws.REGION}`); return new PythonFunction(this.scope, `${this.baseId}-lambda`, { entry: '../middleware_api/schemas', diff --git a/infrastructure/src/api/schemas/delete-schemas.ts b/infrastructure/src/api/schemas/delete-schemas.ts index 35d9a691..5f301811 100644 --- a/infrastructure/src/api/schemas/delete-schemas.ts +++ b/infrastructure/src/api/schemas/delete-schemas.ts @@ -1,5 +1,5 @@ import {PythonFunction} from '@aws-cdk/aws-lambda-python-alpha'; -import {aws_lambda, Duration} from 'aws-cdk-lib'; +import {Aws, aws_lambda, Duration} from 'aws-cdk-lib'; import {JsonSchemaType, JsonSchemaVersion, LambdaIntegration, Model, Resource} from 'aws-cdk-lib/aws-apigateway'; import {Table} from 'aws-cdk-lib/aws-dynamodb'; import {Role} from 'aws-cdk-lib/aws-iam'; @@ -84,7 +84,7 @@ export class DeleteSchemasApi { } private apiLambda() { - const role = Role.fromRoleName(this.scope, `${this.baseId}-role`, ESD_ROLE); + const role = Role.fromRoleName(this.scope, `${this.baseId}-role`, `${ESD_ROLE}-${Aws.REGION}`); return new PythonFunction(this.scope, `${this.baseId}-lambda`, { entry: '../middleware_api/schemas', diff --git a/infrastructure/src/api/schemas/get-schema.ts b/infrastructure/src/api/schemas/get-schema.ts index 4df63f17..ce1e2395 100644 --- a/infrastructure/src/api/schemas/get-schema.ts +++ b/infrastructure/src/api/schemas/get-schema.ts @@ -1,5 +1,5 @@ import { PythonFunction } from '@aws-cdk/aws-lambda-python-alpha'; -import {aws_lambda, Duration} from 'aws-cdk-lib'; +import {Aws, aws_lambda, Duration} from 'aws-cdk-lib'; import { JsonSchemaType, JsonSchemaVersion, LambdaIntegration, Model, Resource } from 'aws-cdk-lib/aws-apigateway'; import { Table } from 'aws-cdk-lib/aws-dynamodb'; import { Role } from 'aws-cdk-lib/aws-iam'; @@ -105,7 +105,7 @@ export class GetSchemaApi { } private apiLambda() { - const role = Role.fromRoleName(this.scope, `${this.baseId}-role`, ESD_ROLE); + const role = Role.fromRoleName(this.scope, `${this.baseId}-role`, `${ESD_ROLE}-${Aws.REGION}`); return new PythonFunction( this.scope, diff --git a/infrastructure/src/api/schemas/list-schemas.ts b/infrastructure/src/api/schemas/list-schemas.ts index d33a165d..41695e7d 100644 --- a/infrastructure/src/api/schemas/list-schemas.ts +++ b/infrastructure/src/api/schemas/list-schemas.ts @@ -1,5 +1,5 @@ import { PythonFunction } from '@aws-cdk/aws-lambda-python-alpha'; -import {aws_apigateway, aws_dynamodb, aws_lambda, Duration} from 'aws-cdk-lib'; +import {Aws, aws_apigateway, aws_dynamodb, aws_lambda, Duration} from 'aws-cdk-lib'; import { JsonSchemaType, JsonSchemaVersion, LambdaIntegration, Model } from 'aws-cdk-lib/aws-apigateway'; import {Role} from 'aws-cdk-lib/aws-iam'; import { Architecture, Runtime } from 'aws-cdk-lib/aws-lambda'; @@ -124,7 +124,7 @@ export class ListSchemasApi { } private apiLambda() { - const role = Role.fromRoleName(this.scope, `${this.baseId}-role`, ESD_ROLE); + const role = Role.fromRoleName(this.scope, `${this.baseId}-role`, `${ESD_ROLE}-${Aws.REGION}`); return new PythonFunction(this.scope, `${this.baseId}-lambda`, { entry: '../middleware_api/schemas', diff --git a/infrastructure/src/api/schemas/update-schema.ts b/infrastructure/src/api/schemas/update-schema.ts index 9988ac3d..19a49e69 100644 --- a/infrastructure/src/api/schemas/update-schema.ts +++ b/infrastructure/src/api/schemas/update-schema.ts @@ -1,5 +1,5 @@ import { PythonFunction } from '@aws-cdk/aws-lambda-python-alpha'; -import {aws_lambda, Duration} from 'aws-cdk-lib'; +import {Aws, aws_lambda, Duration} from 'aws-cdk-lib'; import { JsonSchemaType, JsonSchemaVersion, LambdaIntegration, Model, Resource } from 'aws-cdk-lib/aws-apigateway'; import { Table } from 'aws-cdk-lib/aws-dynamodb'; import { Role } from 'aws-cdk-lib/aws-iam'; @@ -113,7 +113,7 @@ export class UpdateSchemaApi { } private apiLambda() { - const role = Role.fromRoleName(this.scope, `${this.baseId}-role`, ESD_ROLE); + const role = Role.fromRoleName(this.scope, `${this.baseId}-role`, `${ESD_ROLE}-${Aws.REGION}`); return new PythonFunction( this.scope, diff --git a/infrastructure/src/api/service/ping.ts b/infrastructure/src/api/service/ping.ts index 14e91c19..a9b59b02 100644 --- a/infrastructure/src/api/service/ping.ts +++ b/infrastructure/src/api/service/ping.ts @@ -1,5 +1,5 @@ import { PythonFunction } from '@aws-cdk/aws-lambda-python-alpha'; -import {aws_lambda, Duration} from 'aws-cdk-lib'; +import {Aws, aws_lambda, Duration} from 'aws-cdk-lib'; import { JsonSchemaType, JsonSchemaVersion, LambdaIntegration, Model, Resource } from 'aws-cdk-lib/aws-apigateway'; import { Role } from 'aws-cdk-lib/aws-iam'; import { Architecture, LayerVersion, Runtime } from 'aws-cdk-lib/aws-lambda'; @@ -77,7 +77,7 @@ export class PingApi { private apiLambda() { - const role = Role.fromRoleName(this.scope, `${this.baseId}-role`, ESD_ROLE); + const role = Role.fromRoleName(this.scope, `${this.baseId}-role`, `${ESD_ROLE}-${Aws.REGION}`); return new PythonFunction(this.scope, `${this.baseId}-lambda`, diff --git a/infrastructure/src/api/service/root.ts b/infrastructure/src/api/service/root.ts index 6757eff2..7c8c8207 100644 --- a/infrastructure/src/api/service/root.ts +++ b/infrastructure/src/api/service/root.ts @@ -1,5 +1,5 @@ import { PythonFunction } from '@aws-cdk/aws-lambda-python-alpha'; -import {Duration} from 'aws-cdk-lib'; +import {Aws, Duration} from 'aws-cdk-lib'; import { JsonSchemaType, JsonSchemaVersion, LambdaIntegration, Model, RestApi } from 'aws-cdk-lib/aws-apigateway'; import { Role } from 'aws-cdk-lib/aws-iam'; import { Architecture, LayerVersion, Runtime, Tracing } from 'aws-cdk-lib/aws-lambda'; @@ -72,7 +72,7 @@ export class RootAPI { } private apiLambda() { - const role = Role.fromRoleName(this.scope, `${this.baseId}-role`, ESD_ROLE); + const role = Role.fromRoleName(this.scope, `${this.baseId}-role`, `${ESD_ROLE}-${Aws.REGION}`); return new PythonFunction(this.scope, `${this.baseId}-lambda`, diff --git a/infrastructure/src/api/users/create-user.ts b/infrastructure/src/api/users/create-user.ts index 29e31534..f94ff8fc 100644 --- a/infrastructure/src/api/users/create-user.ts +++ b/infrastructure/src/api/users/create-user.ts @@ -1,5 +1,5 @@ import { PythonFunction } from '@aws-cdk/aws-lambda-python-alpha'; -import {aws_apigateway, aws_dynamodb, aws_kms, aws_lambda, Duration} from 'aws-cdk-lib'; +import {Aws, aws_apigateway, aws_dynamodb, aws_kms, aws_lambda, Duration} from 'aws-cdk-lib'; import { JsonSchemaType, JsonSchemaVersion, LambdaIntegration, Model } from 'aws-cdk-lib/aws-apigateway'; import {Role} from 'aws-cdk-lib/aws-iam'; import { Architecture, Runtime } from 'aws-cdk-lib/aws-lambda'; @@ -108,7 +108,7 @@ export class CreateUserApi { } private apiLambda() { - const role = Role.fromRoleName(this.scope, `${this.baseId}-role`, ESD_ROLE); + const role = Role.fromRoleName(this.scope, `${this.baseId}-role`, `${ESD_ROLE}-${Aws.REGION}`); return new PythonFunction(this.scope, `${this.baseId}-lambda`, { entry: '../middleware_api/users', diff --git a/infrastructure/src/api/users/delete-users.ts b/infrastructure/src/api/users/delete-users.ts index f7dc84d6..cf007fd7 100644 --- a/infrastructure/src/api/users/delete-users.ts +++ b/infrastructure/src/api/users/delete-users.ts @@ -1,5 +1,5 @@ import { PythonFunction } from '@aws-cdk/aws-lambda-python-alpha'; -import {aws_apigateway, aws_dynamodb, aws_lambda, Duration} from 'aws-cdk-lib'; +import {Aws, aws_apigateway, aws_dynamodb, aws_lambda, Duration} from 'aws-cdk-lib'; import { JsonSchemaType, JsonSchemaVersion, LambdaIntegration, Model } from 'aws-cdk-lib/aws-apigateway'; import {Role} from 'aws-cdk-lib/aws-iam'; import { Architecture, Runtime } from 'aws-cdk-lib/aws-lambda'; @@ -82,7 +82,7 @@ export class DeleteUsersApi { } private apiLambda() { - const role = Role.fromRoleName(this.scope, `${this.baseId}-role`, ESD_ROLE); + const role = Role.fromRoleName(this.scope, `${this.baseId}-role`, `${ESD_ROLE}-${Aws.REGION}`); return new PythonFunction(this.scope, `${this.baseId}-lambda`, { entry: '../middleware_api/users', diff --git a/infrastructure/src/api/users/list-users.ts b/infrastructure/src/api/users/list-users.ts index 59ff2752..f844e3b3 100644 --- a/infrastructure/src/api/users/list-users.ts +++ b/infrastructure/src/api/users/list-users.ts @@ -1,5 +1,5 @@ import { PythonFunction } from '@aws-cdk/aws-lambda-python-alpha'; -import {aws_apigateway, aws_dynamodb, aws_kms, aws_lambda, Duration} from 'aws-cdk-lib'; +import {Aws, aws_apigateway, aws_dynamodb, aws_kms, aws_lambda, Duration} from 'aws-cdk-lib'; import { JsonSchemaType, JsonSchemaVersion, LambdaIntegration, Model } from 'aws-cdk-lib/aws-apigateway'; import {Role} from 'aws-cdk-lib/aws-iam'; import { Architecture, Runtime } from 'aws-cdk-lib/aws-lambda'; @@ -122,7 +122,7 @@ export class ListUsersApi { } private apiLambda() { - const role = Role.fromRoleName(this.scope, `${this.baseId}-role`, ESD_ROLE); + const role = Role.fromRoleName(this.scope, `${this.baseId}-role`, `${ESD_ROLE}-${Aws.REGION}`); return new PythonFunction(this.scope, `${this.baseId}-lambda`, { entry: '../middleware_api/users', diff --git a/infrastructure/src/api/workflows/create-workflow.ts b/infrastructure/src/api/workflows/create-workflow.ts index b3d15d6c..a9093971 100644 --- a/infrastructure/src/api/workflows/create-workflow.ts +++ b/infrastructure/src/api/workflows/create-workflow.ts @@ -1,5 +1,5 @@ import { PythonFunction } from '@aws-cdk/aws-lambda-python-alpha'; -import {aws_lambda, Duration} from 'aws-cdk-lib'; +import {Aws, aws_lambda, Duration} from 'aws-cdk-lib'; import { JsonSchemaType, JsonSchemaVersion, LambdaIntegration, Model, Resource } from 'aws-cdk-lib/aws-apigateway'; import { Table } from 'aws-cdk-lib/aws-dynamodb'; import { Role } from 'aws-cdk-lib/aws-iam'; @@ -143,7 +143,7 @@ export class CreateWorkflowApi { } private apiLambda() { - const role = Role.fromRoleName(this.scope, `${this.baseId}-role`, ESD_ROLE); + const role = Role.fromRoleName(this.scope, `${this.baseId}-role`, `${ESD_ROLE}-${Aws.REGION}`); return new PythonFunction(this.scope, `${this.baseId}-lambda`, { entry: '../middleware_api/workflows', diff --git a/infrastructure/src/api/workflows/delete-workflows.ts b/infrastructure/src/api/workflows/delete-workflows.ts index 69ba94d4..822ed984 100644 --- a/infrastructure/src/api/workflows/delete-workflows.ts +++ b/infrastructure/src/api/workflows/delete-workflows.ts @@ -1,5 +1,5 @@ import {PythonFunction} from '@aws-cdk/aws-lambda-python-alpha'; -import {aws_lambda, Duration} from 'aws-cdk-lib'; +import {Aws, aws_lambda, Duration} from 'aws-cdk-lib'; import {JsonSchemaType, JsonSchemaVersion, LambdaIntegration, Model, Resource} from 'aws-cdk-lib/aws-apigateway'; import {Table} from 'aws-cdk-lib/aws-dynamodb'; import {Role} from 'aws-cdk-lib/aws-iam'; @@ -86,7 +86,7 @@ export class DeleteWorkflowsApi { } private apiLambda() { - const role = Role.fromRoleName(this.scope, `${this.baseId}-role`, ESD_ROLE); + const role = Role.fromRoleName(this.scope, `${this.baseId}-role`, `${ESD_ROLE}-${Aws.REGION}`); const deleteHandle = new PythonFunction(this.scope, `${this.baseId}-handler-lambda`, { entry: '../middleware_api/workflows', diff --git a/infrastructure/src/api/workflows/get-workflow.ts b/infrastructure/src/api/workflows/get-workflow.ts index 7f1dcb63..b39e83a1 100644 --- a/infrastructure/src/api/workflows/get-workflow.ts +++ b/infrastructure/src/api/workflows/get-workflow.ts @@ -1,5 +1,5 @@ import { PythonFunction } from '@aws-cdk/aws-lambda-python-alpha'; -import {aws_lambda, Duration} from 'aws-cdk-lib'; +import {Aws, aws_lambda, Duration} from 'aws-cdk-lib'; import { JsonSchemaType, JsonSchemaVersion, LambdaIntegration, Model, Resource } from 'aws-cdk-lib/aws-apigateway'; import { Table } from 'aws-cdk-lib/aws-dynamodb'; import { Role } from 'aws-cdk-lib/aws-iam'; @@ -107,7 +107,7 @@ export class GetWorkflowApi { } private apiLambda() { - const role = Role.fromRoleName(this.scope, `${this.baseId}-role`, ESD_ROLE); + const role = Role.fromRoleName(this.scope, `${this.baseId}-role`, `${ESD_ROLE}-${Aws.REGION}`); return new PythonFunction( this.scope, diff --git a/infrastructure/src/api/workflows/list-workflows.ts b/infrastructure/src/api/workflows/list-workflows.ts index 1a370e58..f3885ff5 100644 --- a/infrastructure/src/api/workflows/list-workflows.ts +++ b/infrastructure/src/api/workflows/list-workflows.ts @@ -1,5 +1,5 @@ import { PythonFunction } from '@aws-cdk/aws-lambda-python-alpha'; -import {aws_apigateway, aws_dynamodb, aws_lambda, Duration} from 'aws-cdk-lib'; +import {Aws, aws_apigateway, aws_dynamodb, aws_lambda, Duration} from 'aws-cdk-lib'; import { JsonSchemaType, JsonSchemaVersion, LambdaIntegration, Model } from 'aws-cdk-lib/aws-apigateway'; import {Role} from 'aws-cdk-lib/aws-iam'; import { Architecture, Runtime } from 'aws-cdk-lib/aws-lambda'; @@ -124,7 +124,7 @@ export class ListWorkflowsApi { } private apiLambda() { - const role = Role.fromRoleName(this.scope, `${this.baseId}-role`, ESD_ROLE); + const role = Role.fromRoleName(this.scope, `${this.baseId}-role`, `${ESD_ROLE}-${Aws.REGION}`); return new PythonFunction(this.scope, `${this.baseId}-lambda`, { entry: '../middleware_api/workflows', diff --git a/infrastructure/src/shared/const.ts b/infrastructure/src/shared/const.ts index 027a3e28..3798b945 100644 --- a/infrastructure/src/shared/const.ts +++ b/infrastructure/src/shared/const.ts @@ -1,10 +1,7 @@ -import {ESD_VERSION} from "./version"; - export const KEY_ALIAS = 'sd-extension-password-key'; export const STACK_ID = 'Extension-for-Stable-Diffusion-on-AWS'; export const SOLUTION_NAME = 'comfy-aws-extension'; -export const ESD_VERSION_MAIN = ESD_VERSION.split('-')[0]; -export const ESD_ROLE = `ESDRole-${ESD_VERSION_MAIN}`; +export const ESD_ROLE = `ESDRole`; export const ESD_POLICY_DOCUMENT = { Version: '2012-10-17', Statement: [{ diff --git a/infrastructure/src/shared/resource-provider-on-event.ts b/infrastructure/src/shared/resource-provider-on-event.ts index 08002e2f..b9c42d9c 100644 --- a/infrastructure/src/shared/resource-provider-on-event.ts +++ b/infrastructure/src/shared/resource-provider-on-event.ts @@ -64,7 +64,7 @@ export async function handler(event: Event, context: Object) { } async function createAndCheckResources() { - await createRegionRole(ESD_ROLE); + await createRegionRole(`${ESD_ROLE}-${AWS_REGION}`); await new Promise(resolve => setTimeout(resolve, 1000)); await createBucket();