@awsless/cli 0.0.8 → 0.0.10

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/dist/bin.js CHANGED
@@ -7237,6 +7237,7 @@ var iconFeature = defineFeature({
7237
7237
  import { Group as Group26, Output as Output7, resolveInputs as resolveInputs4, findInputDeps as findInputDeps4 } from "@terraforge/core";
7238
7238
  import { aws as aws27 } from "@terraforge/aws";
7239
7239
  import { camelCase as camelCase8 } from "change-case";
7240
+ import deepmerge5 from "deepmerge";
7240
7241
  import { relative as relative8 } from "path";
7241
7242
 
7242
7243
  // src/feature/job/util.ts
@@ -7461,59 +7462,30 @@ var createFargateJob = (parentGroup, ctx, ns, id, local) => {
7461
7462
  const variableDeps = /* @__PURE__ */ new Set();
7462
7463
  const taskDependsOn = [code];
7463
7464
  const accessPoint = props.persistentStorage ? (() => {
7464
- const persistentStorageSecurityGroup = new aws26.security.Group(
7465
+ const fileSystemId = ctx.shared.get("job", "persistent-storage-file-system-id");
7466
+ const accessPoint2 = new aws26.efs.AccessPoint(
7465
7467
  group,
7466
- "persistent-storage-security-group",
7468
+ "access-point",
7467
7469
  {
7468
- name: shortId(`${shortName}:storage-sg`),
7469
- description: name,
7470
- vpcId: ctx.shared.get("vpc", "id"),
7471
- revokeRulesOnDelete: true,
7470
+ fileSystemId,
7471
+ rootDirectory: {
7472
+ path: `/jobs/${name}`,
7473
+ creationInfo: {
7474
+ ownerUid: 0,
7475
+ ownerGid: 0,
7476
+ permissions: "755"
7477
+ }
7478
+ },
7472
7479
  tags
7480
+ },
7481
+ {
7482
+ replaceOnChanges: ["fileSystemId"]
7473
7483
  }
7474
7484
  );
7475
- new aws26.vpc.SecurityGroupIngressRule(group, "persistent-storage-ingress-rule", {
7476
- securityGroupId: persistentStorageSecurityGroup.id,
7477
- referencedSecurityGroupId: ctx.shared.get("job", "security-group-id"),
7478
- description: "Allow NFS traffic from this job",
7479
- ipProtocol: "tcp",
7480
- fromPort: 2049,
7481
- toPort: 2049,
7482
- tags
7483
- });
7484
- const fileSystem = new aws26.efs.FileSystem(group, "persistent-storage-file-system", {
7485
- encrypted: true,
7486
- performanceMode: "generalPurpose",
7487
- throughputMode: "elastic",
7488
- tags: {
7489
- ...tags,
7490
- Name: `${name}-storage`
7491
- }
7492
- });
7493
- for (const [index, subnetId] of ctx.shared.get("vpc", "public-subnets").entries()) {
7494
- const mountTarget = new aws26.efs.MountTarget(group, `mount-target-${index + 1}`, {
7495
- fileSystemId: fileSystem.id,
7496
- subnetId,
7497
- securityGroups: [persistentStorageSecurityGroup.id]
7498
- });
7499
- taskDependsOn.push(mountTarget);
7500
- }
7501
- const accessPoint2 = new aws26.efs.AccessPoint(group, "access-point", {
7502
- fileSystemId: fileSystem.id,
7503
- rootDirectory: {
7504
- path: `/jobs/${name}`,
7505
- creationInfo: {
7506
- ownerUid: 0,
7507
- ownerGid: 0,
7508
- permissions: "755"
7509
- }
7510
- },
7511
- tags
7512
- });
7513
- taskDependsOn.push(fileSystem, accessPoint2);
7485
+ taskDependsOn.push(accessPoint2);
7514
7486
  return {
7515
7487
  accessPoint: accessPoint2,
7516
- fileSystem
7488
+ fileSystemId
7517
7489
  };
7518
7490
  })() : void 0;
7519
7491
  const task2 = new aws26.ecs.TaskDefinition(
@@ -7537,7 +7509,7 @@ var createFargateJob = (parentGroup, ctx, ns, id, local) => {
7537
7509
  {
7538
7510
  name: "persistent-storage",
7539
7511
  efsVolumeConfiguration: {
7540
- fileSystemId: accessPoint.fileSystem.id,
7512
+ fileSystemId: accessPoint.fileSystemId,
7541
7513
  transitEncryption: "ENABLED",
7542
7514
  authorizationConfig: {
7543
7515
  accessPointId: accessPoint.accessPoint.id
@@ -7760,6 +7732,43 @@ var jobFeature = defineFeature({
7760
7732
  }
7761
7733
  });
7762
7734
  ctx.shared.set("job", "security-group-id", securityGroup.id);
7735
+ const needsPersistentStorage = ctx.stackConfigs.some(
7736
+ (stack) => Object.values(stack.jobs ?? {}).some((job) => {
7737
+ const merged = deepmerge5(ctx.appConfig.defaults.job, job);
7738
+ return merged.persistentStorage;
7739
+ })
7740
+ );
7741
+ if (needsPersistentStorage) {
7742
+ const storageGroup = new Group26(ctx.base, "job", "persistent-storage");
7743
+ new aws27.vpc.SecurityGroupIngressRule(storageGroup, "ingress-rule", {
7744
+ securityGroupId: securityGroup.id,
7745
+ referencedSecurityGroupId: securityGroup.id,
7746
+ description: "Allow NFS traffic from jobs",
7747
+ ipProtocol: "tcp",
7748
+ fromPort: 2049,
7749
+ toPort: 2049,
7750
+ tags: {
7751
+ APP: ctx.appConfig.name
7752
+ }
7753
+ });
7754
+ const fileSystem = new aws27.efs.FileSystem(storageGroup, "file-system", {
7755
+ encrypted: true,
7756
+ performanceMode: "generalPurpose",
7757
+ throughputMode: "elastic",
7758
+ tags: {
7759
+ APP: ctx.appConfig.name,
7760
+ Name: `${ctx.app.name}-job-storage`
7761
+ }
7762
+ });
7763
+ for (const [index, subnetId] of ctx.shared.get("vpc", "public-subnets").entries()) {
7764
+ new aws27.efs.MountTarget(storageGroup, `mount-target-${index + 1}`, {
7765
+ fileSystemId: fileSystem.id,
7766
+ subnetId,
7767
+ securityGroups: [securityGroup.id]
7768
+ });
7769
+ }
7770
+ ctx.shared.set("job", "persistent-storage-file-system-id", fileSystem.id);
7771
+ }
7763
7772
  },
7764
7773
  onStack(ctx) {
7765
7774
  const jobs = Object.entries(ctx.stackConfig.jobs ?? {});
@@ -7820,7 +7829,7 @@ import { aws as aws28 } from "@terraforge/aws";
7820
7829
  import { Group as Group27, Output as Output8, findInputDeps as findInputDeps5, resolveInputs as resolveInputs5 } from "@terraforge/core";
7821
7830
  import { constantCase as constantCase13, pascalCase as pascalCase4 } from "change-case";
7822
7831
  import { createHash as createHash6 } from "crypto";
7823
- import deepmerge5 from "deepmerge";
7832
+ import deepmerge6 from "deepmerge";
7824
7833
  import { join as join19 } from "path";
7825
7834
 
7826
7835
  // src/feature/instance/build/executable.ts
@@ -7883,7 +7892,7 @@ var createFargateTask = (parentGroup, ctx, ns, id, local) => {
7883
7892
  resourceName: id
7884
7893
  });
7885
7894
  const shortName = shortId(`${ctx.app.name}:${ctx.stack.name}:${ns}:${id}:${ctx.appId}`);
7886
- const props = deepmerge5(ctx.appConfig.defaults.instance, local);
7895
+ const props = deepmerge6(ctx.appConfig.defaults.instance, local);
7887
7896
  const image2 = props.image || (props.architecture === "arm64" ? "public.ecr.aws/aws-cli/aws-cli:arm64" : "public.ecr.aws/aws-cli/aws-cli:amd64");
7888
7897
  ctx.registerBuild("instance", name, async (build3, { workspace }) => {
7889
7898
  const fingerprint = await generateFileHash3(workspace, local.code.file);
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awsless/cli",
3
- "version": "0.0.8",
3
+ "version": "0.0.10",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -88,9 +88,9 @@
88
88
  "zod-to-json-schema": "^3.24.3",
89
89
  "@awsless/big-float": "^0.1.6",
90
90
  "@awsless/clui": "^0.0.8",
91
- "@awsless/dynamodb": "^0.3.20",
92
91
  "@awsless/cloudwatch": "^0.0.1",
93
92
  "@awsless/duration": "^0.0.4",
93
+ "@awsless/dynamodb": "^0.3.20",
94
94
  "@awsless/iot": "^0.0.5",
95
95
  "@awsless/json": "^0.0.11",
96
96
  "@awsless/lambda": "^0.0.42",
@@ -99,9 +99,9 @@
99
99
  "@awsless/size": "^0.0.2",
100
100
  "@awsless/sns": "^0.0.10",
101
101
  "@awsless/sqs": "^0.0.21",
102
+ "@awsless/ts-file-cache": "^0.0.13",
102
103
  "@awsless/s3": "^0.0.21",
103
104
  "@awsless/validate": "^0.1.7",
104
- "@awsless/ts-file-cache": "^0.0.13",
105
105
  "@awsless/weak-cache": "^0.0.1",
106
106
  "awsless": "^0.0.3"
107
107
  },