@pulumi/eks 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/nodegroup.js CHANGED
@@ -73,8 +73,9 @@ class NodeGroupInternal extends pulumi.ComponentResource {
73
73
  return;
74
74
  }
75
75
  super(type, name, args, opts);
76
- const core = pulumi.output(args.cluster)
77
- .apply(c => c instanceof cluster_1.ClusterInternal ? c.core : c);
76
+ const core = pulumi
77
+ .output(args.cluster)
78
+ .apply((c) => (c instanceof cluster_1.ClusterInternal ? c.core : c));
78
79
  const group = createNodeGroupInternal(name, args, core, this, opts === null || opts === void 0 ? void 0 : opts.provider);
79
80
  this.autoScalingGroupName = group.autoScalingGroupName;
80
81
  this.cfnStack = pulumi.output(group.cfnStack);
@@ -128,8 +129,9 @@ class NodeGroupV2Internal extends pulumi.ComponentResource {
128
129
  return;
129
130
  }
130
131
  super(type, name, args, opts);
131
- const core = pulumi.output(args.cluster)
132
- .apply(c => c instanceof cluster_1.ClusterInternal ? c.core : c);
132
+ const core = pulumi
133
+ .output(args.cluster)
134
+ .apply((c) => (c instanceof cluster_1.ClusterInternal ? c.core : c));
133
135
  const group = createNodeGroupV2Internal(name, args, core, this, opts === null || opts === void 0 ? void 0 : opts.provider);
134
136
  this.autoScalingGroup = pulumi.output(group.autoScalingGroup);
135
137
  this.extraNodeSecurityGroups = pulumi.output((_a = group.extraNodeSecurityGroups) !== null && _a !== void 0 ? _a : []);
@@ -155,14 +157,14 @@ function createNodeGroup(name, args, parent, provider) {
155
157
  exports.createNodeGroup = createNodeGroup;
156
158
  function createNodeGroupInternal(name, args, core, parent, provider) {
157
159
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
158
- const instanceProfile = core.apply(c => {
160
+ const instanceProfile = core.apply((c) => {
159
161
  var _a;
160
162
  if (!args.instanceProfile && !c.nodeGroupOptions.instanceProfile) {
161
163
  throw new Error(`an instanceProfile is required`);
162
164
  }
163
165
  return (_a = args.instanceProfile) !== null && _a !== void 0 ? _a : c.nodeGroupOptions.instanceProfile;
164
166
  });
165
- core.apply(c => {
167
+ core.apply((c) => {
166
168
  if (c.nodeGroupOptions.nodeSecurityGroup && args.nodeSecurityGroup) {
167
169
  if (c.nodeSecurityGroupTags &&
168
170
  c.nodeGroupOptions.nodeSecurityGroup.id !== args.nodeSecurityGroup.id) {
@@ -176,12 +178,17 @@ function createNodeGroupInternal(name, args, core, parent, provider) {
176
178
  if (args.amiId && args.gpu) {
177
179
  throw new Error("amiId and gpu are mutually exclusive.");
178
180
  }
179
- if (args.nodeUserDataOverride && (args.nodeUserData || args.labels || args.taints || args.kubeletExtraArgs || args.bootstrapExtraArgs)) {
181
+ if (args.nodeUserDataOverride &&
182
+ (args.nodeUserData ||
183
+ args.labels ||
184
+ args.taints ||
185
+ args.kubeletExtraArgs ||
186
+ args.bootstrapExtraArgs)) {
180
187
  throw new Error("nodeUserDataOverride and any combination of {nodeUserData, labels, taints, kubeletExtraArgs, or bootstrapExtraArgs} is mutually exclusive.");
181
188
  }
182
189
  let nodeSecurityGroup;
183
190
  const eksCluster = core.cluster;
184
- const cfnStackDeps = core.apply(c => {
191
+ const cfnStackDeps = core.apply((c) => {
185
192
  const result = [];
186
193
  if (c.vpcCni !== undefined) {
187
194
  result.push(c.vpcCni);
@@ -203,20 +210,20 @@ function createNodeGroupInternal(name, args, core, parent, provider) {
203
210
  vpcId: core.vpcId,
204
211
  clusterSecurityGroup: core.clusterSecurityGroup,
205
212
  eksCluster: eksCluster,
206
- tags: pulumi.all([
207
- core.tags,
208
- core.nodeSecurityGroupTags,
209
- ]).apply(([tags, nodeSecurityGroupTags]) => (Object.assign(Object.assign({}, nodeSecurityGroupTags), tags))),
213
+ tags: pulumi.all([core.tags, core.nodeSecurityGroupTags]).apply(([tags, nodeSecurityGroupTags]) => (Object.assign(Object.assign({}, nodeSecurityGroupTags), tags))),
210
214
  }, parent);
211
215
  }
212
216
  // This apply is necessary in s.t. the launchConfiguration picks up a
213
217
  // dependency on the eksClusterIngressRule. The nodes may fail to
214
218
  // connect to the cluster if we attempt to create them before the
215
219
  // ingress rule is applied.
216
- const nodeSecurityGroupId = pulumi.all([nodeSecurityGroup.id, eksClusterIngressRule.id])
220
+ const nodeSecurityGroupId = pulumi
221
+ .all([nodeSecurityGroup.id, eksClusterIngressRule.id])
217
222
  .apply(([id]) => id);
218
223
  // Collect the IDs of any extra, user-specific security groups.
219
- const extraNodeSecurityGroupIds = args.extraNodeSecurityGroups ? args.extraNodeSecurityGroups.map(sg => sg.id) : [];
224
+ const extraNodeSecurityGroupIds = args.extraNodeSecurityGroups
225
+ ? args.extraNodeSecurityGroups.map((sg) => sg.id)
226
+ : [];
220
227
  // If requested, add a new EC2 KeyPair for SSH access to the instances.
221
228
  let keyName = args.keyName;
222
229
  if (args.nodePublicKey) {
@@ -248,7 +255,7 @@ function createNodeGroupInternal(name, args, core, parent, provider) {
248
255
  kubeletExtraArgs.push("--register-with-taints=" + parts.join(","));
249
256
  }
250
257
  }
251
- let bootstrapExtraArgs = args.bootstrapExtraArgs ? (" " + args.bootstrapExtraArgs) : "";
258
+ let bootstrapExtraArgs = args.bootstrapExtraArgs ? " " + args.bootstrapExtraArgs : "";
252
259
  if (kubeletExtraArgs.length === 1) {
253
260
  // For backward compatibility with previous versions of this package, don't wrap a single argument with `''`.
254
261
  bootstrapExtraArgs += ` --kubelet-extra-args ${kubeletExtraArgs[0]}`;
@@ -256,7 +263,15 @@ function createNodeGroupInternal(name, args, core, parent, provider) {
256
263
  else if (kubeletExtraArgs.length > 1) {
257
264
  bootstrapExtraArgs += ` --kubelet-extra-args '${kubeletExtraArgs.join(" ")}'`;
258
265
  }
259
- const userdata = pulumi.all([awsRegion, eksCluster.name, eksCluster.endpoint, eksCluster.certificateAuthority, cfnStackName, userDataArg])
266
+ const userdata = pulumi
267
+ .all([
268
+ awsRegion,
269
+ eksCluster.name,
270
+ eksCluster.endpoint,
271
+ eksCluster.certificateAuthority,
272
+ cfnStackName,
273
+ userDataArg,
274
+ ])
260
275
  .apply(([region, clusterName, clusterEndpoint, clusterCa, stackName, customUserData]) => {
261
276
  if (customUserData !== "") {
262
277
  customUserData = `cat >/opt/user-data <<${stackName}-user-data
@@ -278,7 +293,7 @@ ${customUserData}
278
293
  let amiId = args.amiId;
279
294
  if (!amiId) {
280
295
  const amiType = ((_a = args.amiType) !== null && _a !== void 0 ? _a : args.gpu) ? "amazon-linux-2-gpu" : "amazon-linux-2";
281
- amiId = version.apply(v => {
296
+ amiId = version.apply((v) => {
282
297
  const parameterName = `/aws/service/eks/optimized-ami/${v}/${amiType}/recommended/image_id`;
283
298
  return pulumi.output(aws.ssm.getParameter({ name: parameterName }, { parent, async: true })).value;
284
299
  });
@@ -290,7 +305,7 @@ ${customUserData}
290
305
  if (args.nodeAssociatePublicIpAddress !== undefined) {
291
306
  nodeAssociatePublicIpAddress = args.nodeAssociatePublicIpAddress;
292
307
  }
293
- const numeric = new RegExp("^\d+$");
308
+ const numeric = new RegExp("^d+$");
294
309
  if (args.nodeRootVolumeIops && args.nodeRootVolumeType !== "io1") {
295
310
  throw new Error("Cannot create a cluster node root volume of non-io1 type with provisioned IOPS (nodeRootVolumeIops).");
296
311
  }
@@ -316,7 +331,7 @@ ${customUserData}
316
331
  securityGroups: [nodeSecurityGroupId, ...extraNodeSecurityGroupIds],
317
332
  spotPrice: args.spotPrice,
318
333
  rootBlockDevice: {
319
- encrypted: (_f = ((_e = ((_d = args.encryptRootBlockDevice) !== null && _d !== void 0 ? _d : args.encryptRootBockDevice)) !== null && _e !== void 0 ? _e : args.nodeRootVolumeEncrypted)) !== null && _f !== void 0 ? _f : false,
334
+ encrypted: (_f = (_e = (_d = args.encryptRootBlockDevice) !== null && _d !== void 0 ? _d : args.encryptRootBockDevice) !== null && _e !== void 0 ? _e : args.nodeRootVolumeEncrypted) !== null && _f !== void 0 ? _f : false,
320
335
  volumeSize: (_g = args.nodeRootVolumeSize) !== null && _g !== void 0 ? _g : 20,
321
336
  volumeType: (_h = args.nodeRootVolumeType) !== null && _h !== void 0 ? _h : "gp2",
322
337
  iops: args.nodeRootVolumeIops,
@@ -327,15 +342,18 @@ ${customUserData}
327
342
  }, { parent, provider });
328
343
  // Compute the worker node group subnets to use from the various approaches.
329
344
  let workerSubnetIds;
330
- if (args.nodeSubnetIds !== undefined) { // Use the specified override subnetIds.
345
+ if (args.nodeSubnetIds !== undefined) {
346
+ // Use the specified override subnetIds.
331
347
  workerSubnetIds = pulumi.output(args.nodeSubnetIds);
332
348
  }
333
349
  else {
334
- workerSubnetIds = core.apply(c => {
335
- if (c.privateSubnetIds !== undefined) { // Use the specified private subnetIds.
350
+ workerSubnetIds = core.apply((c) => {
351
+ if (c.privateSubnetIds !== undefined) {
352
+ // Use the specified private subnetIds.
336
353
  return Promise.resolve(c.privateSubnetIds);
337
354
  }
338
- else if (c.publicSubnetIds !== undefined) { // Use the specified public subnetIds.
355
+ else if (c.publicSubnetIds !== undefined) {
356
+ // Use the specified public subnetIds.
339
357
  return Promise.resolve(c.publicSubnetIds);
340
358
  }
341
359
  else {
@@ -358,18 +376,19 @@ ${customUserData}
358
376
  if (args.spotPrice) {
359
377
  minInstancesInService = 0;
360
378
  }
361
- const autoScalingGroupTags = pulumi.all([
362
- eksCluster.name,
363
- args.autoScalingGroupTags,
364
- ]).apply(([clusterName, asgTags]) => (Object.assign({ "Name": `${clusterName}-worker`, [`kubernetes.io/cluster/${clusterName}`]: "owned" }, asgTags)));
365
- const cfnTemplateBody = pulumi.all([
379
+ const autoScalingGroupTags = pulumi
380
+ .all([eksCluster.name, args.autoScalingGroupTags])
381
+ .apply(([clusterName, asgTags]) => (Object.assign({ Name: `${clusterName}-worker`, [`kubernetes.io/cluster/${clusterName}`]: "owned" }, asgTags)));
382
+ const cfnTemplateBody = pulumi
383
+ .all([
366
384
  nodeLaunchConfiguration.id,
367
385
  args.desiredCapacity,
368
386
  args.minSize,
369
387
  args.maxSize,
370
388
  tagsToAsgTags(autoScalingGroupTags),
371
389
  workerSubnetIds.apply(JSON.stringify),
372
- ]).apply(([launchConfig, desiredCapacity, minSize, maxSize, asgTags, vpcSubnetIds]) => `
390
+ ])
391
+ .apply(([launchConfig, desiredCapacity, minSize, maxSize, asgTags, vpcSubnetIds]) => `
373
392
  AWSTemplateFormatVersion: '2010-09-09'
374
393
  Outputs:
375
394
  NodeGroup:
@@ -393,12 +412,9 @@ ${customUserData}
393
412
  const cfnStack = new aws.cloudformation.Stack(`${name}-nodes`, {
394
413
  name: cfnStackName,
395
414
  templateBody: cfnTemplateBody,
396
- tags: pulumi.all([
397
- core.tags,
398
- args.cloudFormationTags,
399
- ]).apply(([tags, cloudFormationTags]) => (Object.assign(Object.assign({ "Name": `${name}-nodes` }, cloudFormationTags), tags))),
415
+ tags: pulumi.all([core.tags, args.cloudFormationTags]).apply(([tags, cloudFormationTags]) => (Object.assign(Object.assign({ Name: `${name}-nodes` }, cloudFormationTags), tags))),
400
416
  }, { parent, dependsOn: cfnStackDeps, provider });
401
- const autoScalingGroupName = cfnStack.outputs.apply(outputs => {
417
+ const autoScalingGroupName = cfnStack.outputs.apply((outputs) => {
402
418
  if (!("NodeGroup" in outputs)) {
403
419
  throw new Error("CloudFormation stack is not ready. Stack output key 'NodeGroup' does not exist.");
404
420
  }
@@ -424,14 +440,14 @@ function createNodeGroupV2(name, args, parent, provider) {
424
440
  exports.createNodeGroupV2 = createNodeGroupV2;
425
441
  function createNodeGroupV2Internal(name, args, core, parent, provider) {
426
442
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
427
- const instanceProfileArn = core.apply(c => {
443
+ const instanceProfileArn = core.apply((c) => {
428
444
  var _a, _b;
429
445
  if (!args.instanceProfile && !c.nodeGroupOptions.instanceProfile) {
430
446
  throw new Error(`an instanceProfile is required`);
431
447
  }
432
448
  return (_b = (_a = args.instanceProfile) === null || _a === void 0 ? void 0 : _a.arn) !== null && _b !== void 0 ? _b : c.nodeGroupOptions.instanceProfile.arn;
433
449
  });
434
- core.apply(c => {
450
+ core.apply((c) => {
435
451
  if (c.nodeGroupOptions.nodeSecurityGroup && args.nodeSecurityGroup) {
436
452
  if (c.nodeSecurityGroupTags &&
437
453
  c.nodeGroupOptions.nodeSecurityGroup.id !== args.nodeSecurityGroup.id) {
@@ -445,12 +461,17 @@ function createNodeGroupV2Internal(name, args, core, parent, provider) {
445
461
  if (args.amiId && args.gpu) {
446
462
  throw new Error("amiId and gpu are mutually exclusive.");
447
463
  }
448
- if (args.nodeUserDataOverride && (args.nodeUserData || args.labels || args.taints || args.kubeletExtraArgs || args.bootstrapExtraArgs)) {
464
+ if (args.nodeUserDataOverride &&
465
+ (args.nodeUserData ||
466
+ args.labels ||
467
+ args.taints ||
468
+ args.kubeletExtraArgs ||
469
+ args.bootstrapExtraArgs)) {
449
470
  throw new Error("nodeUserDataOverride and any combination of {nodeUserData, labels, taints, kubeletExtraArgs, or bootstrapExtraArgs} is mutually exclusive.");
450
471
  }
451
472
  let nodeSecurityGroup;
452
473
  const eksCluster = core.cluster;
453
- const nodeGroupDeps = core.apply(c => {
474
+ const nodeGroupDeps = core.apply((c) => {
454
475
  const result = [];
455
476
  if (c.vpcCni !== undefined) {
456
477
  result.push(c.vpcCni);
@@ -472,18 +493,23 @@ function createNodeGroupV2Internal(name, args, core, parent, provider) {
472
493
  vpcId: core.vpcId,
473
494
  clusterSecurityGroup: core.clusterSecurityGroup,
474
495
  eksCluster: eksCluster,
475
- tags: core.apply(c => (Object.assign(Object.assign({}, c.nodeSecurityGroupTags), c.tags))),
496
+ tags: core.apply((c) => (Object.assign(Object.assign({}, c.nodeSecurityGroupTags), c.tags))),
476
497
  }, parent);
477
498
  }
478
499
  // This apply is necessary in s.t. the launchConfiguration picks up a
479
500
  // dependency on the eksClusterIngressRule. The nodes may fail to
480
501
  // connect to the cluster if we attempt to create them before the
481
502
  // ingress rule is applied.
482
- const nodeSecurityGroupId = pulumi.all([nodeSecurityGroup.id, eksClusterIngressRule.id])
503
+ const nodeSecurityGroupId = pulumi
504
+ .all([nodeSecurityGroup.id, eksClusterIngressRule.id])
483
505
  .apply(([id]) => id);
484
506
  // Collect the IDs of any extra, user-specific security groups.
485
- const extraNodeSecurityGroupIds = args.extraNodeSecurityGroups ? args.extraNodeSecurityGroups.map(sg => sg.id) : [];
486
- const extraNodeSecurityGroupNames = args.extraNodeSecurityGroups ? args.extraNodeSecurityGroups.map(sg => sg.name) : [];
507
+ const extraNodeSecurityGroupIds = args.extraNodeSecurityGroups
508
+ ? args.extraNodeSecurityGroups.map((sg) => sg.id)
509
+ : [];
510
+ const extraNodeSecurityGroupNames = args.extraNodeSecurityGroups
511
+ ? args.extraNodeSecurityGroups.map((sg) => sg.name)
512
+ : [];
487
513
  // If requested, add a new EC2 KeyPair for SSH access to the instances.
488
514
  let keyName = args.keyName;
489
515
  if (args.nodePublicKey) {
@@ -514,7 +540,7 @@ function createNodeGroupV2Internal(name, args, core, parent, provider) {
514
540
  kubeletExtraArgs.push("--register-with-taints=" + parts.join(","));
515
541
  }
516
542
  }
517
- let bootstrapExtraArgs = args.bootstrapExtraArgs ? (" " + args.bootstrapExtraArgs) : "";
543
+ let bootstrapExtraArgs = args.bootstrapExtraArgs ? " " + args.bootstrapExtraArgs : "";
518
544
  if (kubeletExtraArgs.length === 1) {
519
545
  // For backward compatibility with previous versions of this package, don't wrap a single argument with `''`.
520
546
  bootstrapExtraArgs += ` --kubelet-extra-args ${kubeletExtraArgs[0]}`;
@@ -522,8 +548,17 @@ function createNodeGroupV2Internal(name, args, core, parent, provider) {
522
548
  else if (kubeletExtraArgs.length > 1) {
523
549
  bootstrapExtraArgs += ` --kubelet-extra-args '${kubeletExtraArgs.join(" ")}'`;
524
550
  }
525
- const userdata = pulumi.all([awsRegion, eksCluster.name, eksCluster.endpoint, eksCluster.certificateAuthority, name, userDataArg, args.nodeUserDataOverride])
526
- .apply(([region, clusterName, clusterEndpoint, clusterCa, stackName, customUserData, nodeUserDataOverride]) => {
551
+ const userdata = pulumi
552
+ .all([
553
+ awsRegion,
554
+ eksCluster.name,
555
+ eksCluster.endpoint,
556
+ eksCluster.certificateAuthority,
557
+ name,
558
+ userDataArg,
559
+ args.nodeUserDataOverride,
560
+ ])
561
+ .apply(([region, clusterName, clusterEndpoint, clusterCa, stackName, customUserData, nodeUserDataOverride,]) => {
527
562
  if (nodeUserDataOverride !== undefined && nodeUserDataOverride !== "") {
528
563
  return nodeUserDataOverride;
529
564
  }
@@ -540,13 +575,14 @@ chmod +x /opt/user-data
540
575
  /etc/eks/bootstrap.sh --apiserver-endpoint "${clusterEndpoint}" --b64-cluster-ca "${clusterCa.data}" "${clusterName}"${bootstrapExtraArgs}
541
576
  ${customUserData}
542
577
  `;
543
- }).apply(x => Buffer.from(x, "utf-8").toString("base64")); // Launch Templates require user data to be passed as base64.
578
+ })
579
+ .apply((x) => Buffer.from(x, "utf-8").toString("base64")); // Launch Templates require user data to be passed as base64.
544
580
  const version = pulumi.output(args.version || core.cluster.version);
545
581
  // https://docs.aws.amazon.com/eks/latest/userguide/retrieve-ami-id.html
546
582
  let amiId = args.amiId;
547
583
  if (!amiId) {
548
584
  const amiType = ((_a = args.amiType) !== null && _a !== void 0 ? _a : args.gpu) ? "amazon-linux-2-gpu" : "amazon-linux-2";
549
- amiId = version.apply(v => {
585
+ amiId = version.apply((v) => {
550
586
  const parameterName = `/aws/service/eks/optimized-ami/${v}/${amiType}/recommended/image_id`;
551
587
  return pulumi.output(aws.ssm.getParameter({ name: parameterName }, { parent, async: true })).value;
552
588
  });
@@ -558,7 +594,7 @@ ${customUserData}
558
594
  if (args.nodeAssociatePublicIpAddress !== undefined) {
559
595
  nodeAssociatePublicIpAddress = args.nodeAssociatePublicIpAddress;
560
596
  }
561
- const numeric = new RegExp("^\d+$");
597
+ const numeric = new RegExp("^d+$");
562
598
  if (args.nodeRootVolumeIops && args.nodeRootVolumeType !== "io1") {
563
599
  throw new Error("Cannot create a cluster node root volume of non-io1 type with provisioned IOPS (nodeRootVolumeIops).");
564
600
  }
@@ -575,13 +611,15 @@ ${customUserData}
575
611
  throw new Error("Cannot create a cluster node root volume of gp3 type without provisioned throughput (nodeRootVolumeThroughput) as integer value.");
576
612
  }
577
613
  }
578
- const marketOptions = args.spotPrice ? {
579
- marketType: "spot",
580
- spotOptions: {
581
- maxPrice: args.spotPrice,
582
- },
583
- } : {};
584
- const device = pulumi.output(amiId).apply(id => aws.ec2.getAmi({
614
+ const marketOptions = args.spotPrice
615
+ ? {
616
+ marketType: "spot",
617
+ spotOptions: {
618
+ maxPrice: args.spotPrice,
619
+ },
620
+ }
621
+ : {};
622
+ const device = pulumi.output(amiId).apply((id) => aws.ec2.getAmi({
585
623
  owners: ["self", "amazon"],
586
624
  filters: [
587
625
  {
@@ -596,7 +634,8 @@ ${customUserData}
596
634
  iamInstanceProfile: { arn: instanceProfileArn },
597
635
  keyName: keyName,
598
636
  instanceMarketOptions: marketOptions,
599
- blockDeviceMappings: [{
637
+ blockDeviceMappings: [
638
+ {
600
639
  deviceName: device,
601
640
  ebs: {
602
641
  encrypted: ((_d = args.nodeRootVolumeEncrypted) !== null && _d !== void 0 ? _d : false) ? "true" : "false",
@@ -606,25 +645,31 @@ ${customUserData}
606
645
  throughput: args.nodeRootVolumeThroughput,
607
646
  deleteOnTermination: ((_g = args.nodeRootVolumeDeleteOnTermination) !== null && _g !== void 0 ? _g : true) ? "true" : "false",
608
647
  },
609
- }],
610
- networkInterfaces: [{
648
+ },
649
+ ],
650
+ networkInterfaces: [
651
+ {
611
652
  associatePublicIpAddress: String(nodeAssociatePublicIpAddress),
612
653
  securityGroups: [nodeSecurityGroupId, ...extraNodeSecurityGroupIds],
613
- }],
654
+ },
655
+ ],
614
656
  userData: userdata,
615
657
  tagSpecifications: args.launchTemplateTagSpecifications,
616
658
  }, { parent, provider });
617
659
  // Compute the worker node group subnets to use from the various approaches.
618
660
  let workerSubnetIds;
619
- if (args.nodeSubnetIds !== undefined) { // Use the specified override subnetIds.
661
+ if (args.nodeSubnetIds !== undefined) {
662
+ // Use the specified override subnetIds.
620
663
  workerSubnetIds = pulumi.output(args.nodeSubnetIds);
621
664
  }
622
665
  else {
623
- workerSubnetIds = core.apply(c => {
624
- if (c.privateSubnetIds !== undefined) { // Use the specified private subnetIds.
666
+ workerSubnetIds = core.apply((c) => {
667
+ if (c.privateSubnetIds !== undefined) {
668
+ // Use the specified private subnetIds.
625
669
  return Promise.resolve(c.privateSubnetIds);
626
670
  }
627
- else if (c.publicSubnetIds !== undefined) { // Use the specified public subnetIds.
671
+ else if (c.publicSubnetIds !== undefined) {
672
+ // Use the specified public subnetIds.
628
673
  return Promise.resolve(c.publicSubnetIds);
629
674
  }
630
675
  else {
@@ -633,8 +678,10 @@ ${customUserData}
633
678
  }
634
679
  });
635
680
  }
636
- const asgTags = pulumi.all([eksCluster.name, args.autoScalingGroupTags]).apply(([clusterName, tags]) => inputTagsToASGTags(clusterName, tags));
637
- const launchTemplateVersion = nodeLaunchTemplate.latestVersion.apply(v => v.toString());
681
+ const asgTags = pulumi
682
+ .all([eksCluster.name, args.autoScalingGroupTags])
683
+ .apply(([clusterName, tags]) => inputTagsToASGTags(clusterName, tags));
684
+ const launchTemplateVersion = nodeLaunchTemplate.latestVersion.apply((v) => v.toString());
638
685
  const asGroup = new aws.autoscaling.Group(name, {
639
686
  name: name,
640
687
  minSize: (_h = args === null || args === void 0 ? void 0 : args.minSize) !== null && _h !== void 0 ? _h : 1,
@@ -695,8 +742,8 @@ function computeWorkerSubnets(parent, subnetIds) {
695
742
  // Fetch the route table for this subnet.
696
743
  const routeTable = yield getRouteTableAsync(parent, subnetId);
697
744
  // Once we have the route table, check its list of routes for a route to an internet gateway.
698
- const hasInternetGatewayRoute = routeTable.routes
699
- .find(r => !!r.gatewayId && !isPrivateCIDRBlock(r.cidrBlock)) !== undefined;
745
+ const hasInternetGatewayRoute = routeTable.routes.find((r) => !!r.gatewayId && !isPrivateCIDRBlock(r.cidrBlock)) !==
746
+ undefined;
700
747
  if (hasInternetGatewayRoute) {
701
748
  publicSubnets.push(subnetId);
702
749
  }
@@ -723,10 +770,12 @@ function getRouteTableAsync(parent, subnetId) {
723
770
  const subnet = yield aws.ec2.getSubnet({ id: subnetId }, invokeOpts);
724
771
  const mainRouteTableInfo = yield aws.ec2.getRouteTables({
725
772
  vpcId: subnet.vpcId,
726
- filters: [{
773
+ filters: [
774
+ {
727
775
  name: "association.main",
728
776
  values: ["true"],
729
- }],
777
+ },
778
+ ],
730
779
  }, invokeOpts);
731
780
  return yield aws.ec2.getRouteTable({ routeTableId: mainRouteTableInfo.ids[0] }, invokeOpts);
732
781
  }
@@ -740,13 +789,13 @@ function isPrivateCIDRBlock(cidrBlock) {
740
789
  const privateA = new netmask.Netmask("10.0.0.0/8");
741
790
  const privateB = new netmask.Netmask("172.16.0.0/12");
742
791
  const privateC = new netmask.Netmask("192.168.0.0/16");
743
- return privateA.contains(cidrBlock) || privateB.contains(cidrBlock) || privateC.contains(cidrBlock);
792
+ return (privateA.contains(cidrBlock) || privateB.contains(cidrBlock) || privateC.contains(cidrBlock));
744
793
  }
745
794
  /**
746
795
  * Iterates through the tags map creating AWS ASG-style tags
747
796
  */
748
797
  function tagsToAsgTags(tagsInput) {
749
- return pulumi.output(tagsInput).apply(tags => {
798
+ return pulumi.output(tagsInput).apply((tags) => {
750
799
  let output = "";
751
800
  for (const tag of Object.keys(tags)) {
752
801
  output += `
@@ -796,8 +845,9 @@ class ManagedNodeGroupInternal extends pulumi.ComponentResource {
796
845
  return;
797
846
  }
798
847
  super(type, name, args, opts);
799
- const core = pulumi.output(args.cluster)
800
- .apply(c => c instanceof cluster_1.ClusterInternal ? c.core : c);
848
+ const core = pulumi
849
+ .output(args.cluster)
850
+ .apply((c) => (c instanceof cluster_1.ClusterInternal ? c.core : c));
801
851
  const group = createManagedNodeGroupInternal(name, args, core, this, opts === null || opts === void 0 ? void 0 : opts.provider);
802
852
  this.nodeGroup = pulumi.output(group);
803
853
  this.registerOutputs({
@@ -830,30 +880,24 @@ function createManagedNodeGroupInternal(name, args, core, parent, provider) {
830
880
  roleArn = args.nodeRoleArn;
831
881
  }
832
882
  else if (args.nodeRole) {
833
- roleArn = pulumi.output(args.nodeRole).apply(r => r.arn);
883
+ roleArn = pulumi.output(args.nodeRole).apply((r) => r.arn);
834
884
  }
835
885
  else {
836
886
  throw new Error("The managed node group role provided is undefined");
837
887
  }
838
888
  // Check that the nodegroup role has been set on the cluster to
839
889
  // ensure that the aws-auth configmap was properly formed.
840
- const nodegroupRole = pulumi.all([
841
- core.instanceRoles,
842
- roleArn,
843
- ]).apply(([roles, rArn]) => {
890
+ const nodegroupRole = pulumi.all([core.instanceRoles, roleArn]).apply(([roles, rArn]) => {
844
891
  // Map out the ARNs of all of the instanceRoles.
845
- const roleArns = roles.map(role => {
892
+ const roleArns = roles.map((role) => {
846
893
  return role.arn;
847
894
  });
848
895
  // Try finding the nodeRole in the ARNs array.
849
- return pulumi.all([
850
- roleArns,
851
- rArn,
852
- ]).apply(([arns, arn]) => {
853
- return arns.find(a => a === arn);
896
+ return pulumi.all([roleArns, rArn]).apply(([arns, arn]) => {
897
+ return arns.find((a) => a === arn);
854
898
  });
855
899
  });
856
- nodegroupRole.apply(role => {
900
+ nodegroupRole.apply((role) => {
857
901
  if (!role) {
858
902
  throw new Error(`A managed node group cannot be created without first setting its role in the cluster's instanceRoles`);
859
903
  }
@@ -864,7 +908,7 @@ function createManagedNodeGroupInternal(name, args, core, parent, provider) {
864
908
  subnetIds = pulumi.output(args.subnetIds);
865
909
  }
866
910
  else {
867
- subnetIds = core.apply(c => {
911
+ subnetIds = core.apply((c) => {
868
912
  if (c.subnetIds !== undefined) {
869
913
  return c.subnetIds;
870
914
  }
@@ -885,11 +929,9 @@ function createManagedNodeGroupInternal(name, args, core, parent, provider) {
885
929
  delete nodeGroupArgs.cluster;
886
930
  }
887
931
  // Make the aws-auth configmap a dependency of the node group.
888
- const ngDeps = core.apply(c => c.eksNodeAccess !== undefined ? [c.eksNodeAccess] : []);
932
+ const ngDeps = core.apply((c) => (c.eksNodeAccess !== undefined ? [c.eksNodeAccess] : []));
889
933
  // Create the managed node group.
890
- const nodeGroup = new aws.eks.NodeGroup(name, Object.assign(Object.assign({}, nodeGroupArgs), { clusterName: args.clusterName || core.cluster.name, nodeRoleArn: roleArn, scalingConfig: pulumi.all([
891
- args.scalingConfig,
892
- ]).apply(([config]) => {
934
+ const nodeGroup = new aws.eks.NodeGroup(name, Object.assign(Object.assign({}, nodeGroupArgs), { clusterName: args.clusterName || core.cluster.name, nodeRoleArn: roleArn, scalingConfig: pulumi.all([args.scalingConfig]).apply(([config]) => {
893
935
  var _a, _b, _c;
894
936
  const desiredSize = (_a = config === null || config === void 0 ? void 0 : config.desiredSize) !== null && _a !== void 0 ? _a : 2;
895
937
  const minSize = (_b = config === null || config === void 0 ? void 0 : config.minSize) !== null && _b !== void 0 ? _b : 1;