Skip to content

Commit

Permalink
fix: only set visibility when specified explicitly (#608)
Browse files Browse the repository at this point in the history
  • Loading branch information
bboure authored Jul 4, 2023
1 parent ffedf54 commit 227d479
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion doc/general-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions src/__tests__/__snapshots__/api.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ Object {
"Value": "Dev",
},
],
"Visibility": "GLOBAL",
"XrayEnabled": false,
},
"Type": "AWS::AppSync::GraphQLApi",
Expand Down Expand Up @@ -65,7 +64,6 @@ Object {
"Value": "Dev",
},
],
"Visibility": "GLOBAL",
"XrayEnabled": false,
},
"Type": "AWS::AppSync::GraphQLApi",
Expand Down
3 changes: 0 additions & 3 deletions src/__tests__/api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ describe('Api', () => {
"Value": "Dev",
},
],
"Visibility": "GLOBAL",
"XrayEnabled": false,
},
"Type": "AWS::AppSync::GraphQLApi",
Expand Down Expand Up @@ -92,7 +91,6 @@ describe('Api', () => {
"Value": "Dev",
},
],
"Visibility": "GLOBAL",
"XrayEnabled": false,
},
"Type": "AWS::AppSync::GraphQLApi",
Expand Down Expand Up @@ -198,7 +196,6 @@ describe('Api', () => {
"DefaultAction": "ALLOW",
"UserPoolId": "pool123",
},
"Visibility": "GLOBAL",
"XrayEnabled": false,
},
"Type": "AWS::AppSync::GraphQLApi",
Expand Down
7 changes: 6 additions & 1 deletion src/resources/Api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
},
Expand Down Expand Up @@ -106,6 +105,12 @@ export class Api {
});
}

if (this.config.visibility) {
merge(endpointResource.Properties, {
Visibility: this.config.visibility,
});
}

const resources = {
[logicalId]: endpointResource,
};
Expand Down

0 comments on commit 227d479

Please sign in to comment.