diff --git a/doc/general-config.md b/doc/general-config.md index 26e79905..e91972d3 100644 --- a/doc/general-config.md +++ b/doc/general-config.md @@ -49,7 +49,7 @@ appSync: - `waf`: See [Web Application Firefall](WAF.md) - `logging`: See [Logging](#Logging) - `xrayEnabled`: Boolean. Enable or disable X-Ray tracing. -- `visibility`: Optional. `GLOBAL` or `PRIVATE`. Defaults to `GLOBAL`. +- `visibility`: Optional. `GLOBAL` or `PRIVATE`. **Changing this value requires the replacement of the API.** - `tags`: A key-value pair for tagging this AppSync API ## Schema diff --git a/src/__tests__/__snapshots__/api.test.ts.snap b/src/__tests__/__snapshots__/api.test.ts.snap index b160f5a2..37d43140 100644 --- a/src/__tests__/__snapshots__/api.test.ts.snap +++ b/src/__tests__/__snapshots__/api.test.ts.snap @@ -27,7 +27,6 @@ Object { "Value": "Dev", }, ], - "Visibility": "GLOBAL", "XrayEnabled": false, }, "Type": "AWS::AppSync::GraphQLApi", @@ -65,7 +64,6 @@ Object { "Value": "Dev", }, ], - "Visibility": "GLOBAL", "XrayEnabled": false, }, "Type": "AWS::AppSync::GraphQLApi", diff --git a/src/__tests__/api.test.ts b/src/__tests__/api.test.ts index 28cba2d3..c8389f11 100644 --- a/src/__tests__/api.test.ts +++ b/src/__tests__/api.test.ts @@ -22,7 +22,6 @@ describe('Api', () => { "Value": "Dev", }, ], - "Visibility": "GLOBAL", "XrayEnabled": false, }, "Type": "AWS::AppSync::GraphQLApi", @@ -92,7 +91,6 @@ describe('Api', () => { "Value": "Dev", }, ], - "Visibility": "GLOBAL", "XrayEnabled": false, }, "Type": "AWS::AppSync::GraphQLApi", @@ -198,7 +196,6 @@ describe('Api', () => { "DefaultAction": "ALLOW", "UserPoolId": "pool123", }, - "Visibility": "GLOBAL", "XrayEnabled": false, }, "Type": "AWS::AppSync::GraphQLApi", diff --git a/src/resources/Api.ts b/src/resources/Api.ts index c1ea0a2a..95e41923 100644 --- a/src/resources/Api.ts +++ b/src/resources/Api.ts @@ -74,7 +74,6 @@ export class Api { Type: 'AWS::AppSync::GraphQLApi', Properties: { Name: this.config.name, - Visibility: this.config.visibility || 'GLOBAL', XrayEnabled: this.config.xrayEnabled || false, Tags: this.getTagsConfig(), }, @@ -106,6 +105,12 @@ export class Api { }); } + if (this.config.visibility) { + merge(endpointResource.Properties, { + Visibility: this.config.visibility, + }); + } + const resources = { [logicalId]: endpointResource, };