diff --git a/README.md b/README.md index a6bc281..114537c 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,10 @@ Pair this pacakge with [@nasa-gcn/architect-functions-search](https://github.com instanceType t3.small.search instanceCount 2 availabilityZoneCount 2 + # dedicatedMasterCount is optional; if zero or undefined, dedicated + # master nodes are disabled. + dedicatedMasterCount 3 + dedicatedMasterType t3.small.search 4. Optionally, create a file called `sandbox-search.json` or `sandbox-search.js` in your project and populate it with sample data to be passed to [`client.bulk()`](https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/bulk_examples.html). Here are some examples. diff --git a/service.ts b/service.ts index 9e6b32c..e6cedf4 100644 --- a/service.ts +++ b/service.ts @@ -8,6 +8,8 @@ export function cloudformationResources({ availabilityZoneCount, + dedicatedMasterCount, + dedicatedMasterType, instanceCount, instanceType, volumeSize, @@ -23,6 +25,16 @@ export function cloudformationResources({ const VolumeSize = parseInt(volumeSize) const ZoneAwarenessEnabled = AvailabilityZoneCount > 1 + const DedicatedMasterCount = + (dedicatedMasterCount && parseInt(dedicatedMasterCount)) || undefined + const DedicatedMasterEnabled = Boolean(DedicatedMasterCount) + const DedicatedMasterType = dedicatedMasterType + if (DedicatedMasterEnabled && !DedicatedMasterType) { + throw new Error( + 'dedicatedMasterType must be defined because dedicateMasterCount > 0' + ) + } + return { OpenSearchServiceDomain: { Type: 'AWS::OpenSearchService::Domain', @@ -39,6 +51,9 @@ export function cloudformationResources({ ], }, ClusterConfig: { + DedicatedMasterCount, + DedicatedMasterEnabled, + DedicatedMasterType, InstanceType: instanceType, InstanceCount, ZoneAwarenessEnabled,