Skip to content

Commit

Permalink
fix(apig): Adding rest api name for API resource
Browse files Browse the repository at this point in the history
  • Loading branch information
despock committed Dec 22, 2021
1 parent 43b2984 commit 7f88469
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/lib/manager/apiManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export class ApiManager {
types: props.endpointConfiguration?.types || [apig.EndpointType.REGIONAL],
vpcEndpoints: props.endpointConfiguration?.vpcEndpoints,
},
restApiName: `${props.restApiName}-${scope.props.stage}`,
handler: lambdaFunction,
defaultCorsPreflightOptions: {
allowOrigins: props.defaultCorsPreflightOptions?.allowOrigins || apig.Cors.ALL_ORIGINS,
Expand Down
6 changes: 3 additions & 3 deletions src/lib/manager/appConfigManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export class AppConfigManager {
public createApplication(id: string, scope: CommonConstruct, props: AppConfigProps): appconfig.CfnApplication {
if (!props) throw `AppConfig props undefined`

const application = new appconfig.CfnApplication(scope, `${id}Application`, {
const application = new appconfig.CfnApplication(scope, `${id}`, {
name: `${props.application.name}-${scope.props.stage}`,
description: props.application.description,
tags: props.application.tags,
Expand Down Expand Up @@ -96,7 +96,7 @@ export class AppConfigManager {
): appconfig.CfnEnvironment {
if (!props) throw `AppConfig props undefined`

const environment = new appconfig.CfnEnvironment(scope, `${id}Environment`, {
const environment = new appconfig.CfnEnvironment(scope, `${id}`, {
applicationId: applicationId,
name: scope.props.stage,
description: props.environment.description,
Expand Down Expand Up @@ -127,7 +127,7 @@ export class AppConfigManager {
): appconfig.CfnConfigurationProfile {
if (!props) throw `AppConfig props undefined`

const profile = new appconfig.CfnConfigurationProfile(scope, `${id}ConfigurationProfile`, {
const profile = new appconfig.CfnConfigurationProfile(scope, `${id}`, {
applicationId: applicationId,
locationUri: props.configurationProfile.locationUri || 'hosted',
name: `${props.configurationProfile.name}-${scope.props.stage}`,
Expand Down
4 changes: 3 additions & 1 deletion src/test/construct/graphQLApiLambda.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ class TestGraphQLApiConstruct extends GraphQLApiLambda {
this.props.graphQLApiSource = new lambda.AssetCode('src/test/common/nodejs/lib')
this.props.graphqlRestApi = {
deploy: true,
restApiName: 'test-lambda-rest-api',
deployOptions: {
description: `${this.id} - ${this.props.stage} stage`,
stageName: this.props.stage,
Expand Down Expand Up @@ -146,7 +147,8 @@ describe('TestGraphQLApiLambdaConstruct', () => {
EndpointConfiguration: {
Types: ['REGIONAL'],
},
Name: 'test-graphql-lambda-rest-api',
FailOnWarnings: false,
Name: 'test-lambda-rest-api-test',
})
})
})
Expand Down

0 comments on commit 7f88469

Please sign in to comment.