@kensio/yulin 1.19.1 → 1.19.2
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/service/cloudformation/deploy/sim-cfn-cdk-out-deployer.d.ts +2 -2
- package/dist/service/cloudformation/deploy/sim-cfn-cdk-out-deployer.d.ts.map +1 -1
- package/dist/service/cloudformation/deploy/sim-cfn-cdk-out-deployer.js.map +1 -1
- package/dist/service/cloudformation/deploy/sim-cfn-cdk-out-stack-options.d.ts +3 -3
- package/dist/service/cloudformation/deploy/sim-cfn-cdk-out-stack-options.d.ts.map +1 -1
- package/dist/service/cloudformation/deploy/sim-cfn-cdk-out-stack-options.js.map +1 -1
- package/dist/service/cloudformation/deploy/sim-cfn-template-deployer.d.ts +5 -4
- package/dist/service/cloudformation/deploy/sim-cfn-template-deployer.d.ts.map +1 -1
- package/dist/service/cloudformation/deploy/sim-cfn-template-deployer.js.map +1 -1
- package/dist/service/cloudformation/index.d.ts +7 -0
- package/dist/service/cloudformation/index.d.ts.map +1 -1
- package/dist/service/cloudformation/resource/sim-cfn-deployed-resource.type.d.ts +59 -0
- package/dist/service/cloudformation/resource/sim-cfn-deployed-resource.type.d.ts.map +1 -0
- package/dist/service/cloudformation/resource/sim-cfn-deployed-resource.type.js +2 -0
- package/dist/service/cloudformation/resource/sim-cfn-deployed-resource.type.js.map +1 -0
- package/dist/service/cloudformation/sim-cloudformation.d.ts +8 -9
- package/dist/service/cloudformation/sim-cloudformation.d.ts.map +1 -1
- package/dist/service/cloudformation/sim-cloudformation.js +1 -3
- package/dist/service/cloudformation/sim-cloudformation.js.map +1 -1
- package/dist/service/cloudformation/stack/sim-cfn-deployed-stack.type.d.ts +68 -0
- package/dist/service/cloudformation/stack/sim-cfn-deployed-stack.type.d.ts.map +1 -0
- package/dist/service/cloudformation/stack/sim-cfn-deployed-stack.type.js +2 -0
- package/dist/service/cloudformation/stack/sim-cfn-deployed-stack.type.js.map +1 -0
- package/dist/service/cloudformation/stack/sim-cfn-stack.d.ts +2 -1
- package/dist/service/cloudformation/stack/sim-cfn-stack.d.ts.map +1 -1
- package/dist/service/cloudformation/stack/sim-cfn-stack.fixture.d.ts +21 -0
- package/dist/service/cloudformation/stack/sim-cfn-stack.fixture.d.ts.map +1 -0
- package/dist/service/cloudformation/stack/sim-cfn-stack.fixture.js +21 -0
- package/dist/service/cloudformation/stack/sim-cfn-stack.fixture.js.map +1 -0
- package/dist/service/cloudformation/stack/sim-cfn-stack.js.map +1 -1
- package/dist/service/cloudformation/terraform/sim-tf-attribute-reads.d.ts +12 -0
- package/dist/service/cloudformation/terraform/sim-tf-attribute-reads.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-attribute-reads.js +60 -0
- package/dist/service/cloudformation/terraform/sim-tf-attribute-reads.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-attributes.d.ts +60 -0
- package/dist/service/cloudformation/terraform/sim-tf-attributes.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-attributes.js +121 -0
- package/dist/service/cloudformation/terraform/sim-tf-attributes.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-config.d.ts +14 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-config.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-config.js +36 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-config.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-dynamodb.d.ts +15 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-dynamodb.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-dynamodb.js +74 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-dynamodb.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-http-api-route.d.ts +5 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-http-api-route.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-http-api-route.js +32 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-http-api-route.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-http-api.d.ts +12 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-http-api.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-http-api.js +52 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-http-api.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-iam.d.ts +9 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-iam.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-iam.js +80 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-iam.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-lambda.d.ts +19 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-lambda.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-lambda.js +90 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-lambda.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-s3-cors.d.ts +5 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-s3-cors.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-s3-cors.js +12 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-s3-cors.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-s3-encryption.d.ts +5 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-s3-encryption.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-s3-encryption.js +32 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-s3-encryption.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-s3-folds.d.ts +9 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-s3-folds.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-s3-folds.js +48 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-s3-folds.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-s3.d.ts +5 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-s3.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-s3.js +18 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-s3.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-sns.d.ts +15 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-sns.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-sns.js +40 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-sns.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-sqs.d.ts +5 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-sqs.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-sqs.js +56 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-sqs.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-mapping.type.d.ts +41 -0
- package/dist/service/cloudformation/terraform/sim-tf-mapping.type.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-mapping.type.js +2 -0
- package/dist/service/cloudformation/terraform/sim-tf-mapping.type.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-module-outputs.d.ts +19 -0
- package/dist/service/cloudformation/terraform/sim-tf-module-outputs.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-module-outputs.js +63 -0
- package/dist/service/cloudformation/terraform/sim-tf-module-outputs.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-plan-index.d.ts +26 -0
- package/dist/service/cloudformation/terraform/sim-tf-plan-index.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-plan-index.js +45 -0
- package/dist/service/cloudformation/terraform/sim-tf-plan-index.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-plan-resources.d.ts +39 -0
- package/dist/service/cloudformation/terraform/sim-tf-plan-resources.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-plan-resources.js +44 -0
- package/dist/service/cloudformation/terraform/sim-tf-plan-resources.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-plan.type.d.ts +94 -0
- package/dist/service/cloudformation/terraform/sim-tf-plan.type.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-plan.type.js +2 -0
- package/dist/service/cloudformation/terraform/sim-tf-plan.type.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-reference-address.d.ts +27 -0
- package/dist/service/cloudformation/terraform/sim-tf-reference-address.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-reference-address.js +58 -0
- package/dist/service/cloudformation/terraform/sim-tf-reference-address.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-reference.d.ts +64 -0
- package/dist/service/cloudformation/terraform/sim-tf-reference.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-reference.js +122 -0
- package/dist/service/cloudformation/terraform/sim-tf-reference.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-registry.d.ts +14 -0
- package/dist/service/cloudformation/terraform/sim-tf-registry.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-registry.js +40 -0
- package/dist/service/cloudformation/terraform/sim-tf-registry.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-report.type.d.ts +31 -0
- package/dist/service/cloudformation/terraform/sim-tf-report.type.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-report.type.js +2 -0
- package/dist/service/cloudformation/terraform/sim-tf-report.type.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-folds.d.ts +20 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-folds.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-folds.js +28 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-folds.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-graph.d.ts +29 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-graph.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-graph.js +71 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-graph.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-mappings.d.ts +23 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-mappings.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-mappings.js +72 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-mappings.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-merge.d.ts +21 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-merge.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-merge.js +33 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-merge.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-prune.d.ts +21 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-prune.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-prune.js +51 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-prune.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-pruned.d.ts +18 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-pruned.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-pruned.js +23 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-pruned.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-references.d.ts +10 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-references.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-references.js +39 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-references.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-resolver.d.ts +12 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-resolver.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-resolver.js +17 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-resolver.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-template.d.ts +26 -0
- package/dist/service/cloudformation/terraform/sim-tf-template.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-template.js +54 -0
- package/dist/service/cloudformation/terraform/sim-tf-template.js.map +1 -0
- package/dist/service/elbv2/cfn/sim-cfn-elbv2.fixture.d.ts +2 -2
- package/dist/service/elbv2/cfn/sim-cfn-elbv2.fixture.d.ts.map +1 -1
- package/dist/service/elbv2/cfn/sim-cfn-elbv2.fixture.js.map +1 -1
- package/dist/util/filesystem/test-terraform-project.d.ts +56 -0
- package/dist/util/filesystem/test-terraform-project.d.ts.map +1 -0
- package/dist/util/filesystem/test-terraform-project.js +83 -0
- package/dist/util/filesystem/test-terraform-project.js.map +1 -0
- package/package.json +3 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-tf-template-resolver.js","sourceRoot":"","sources":["../../../../src/service/cloudformation/terraform/sim-tf-template-resolver.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAEjE,MAAM,WAAW,GAAG,eAAe,CAAC;AAEpC;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAC9B,IAAmB,EACnB,SAAuC;IAEvC,MAAM,QAAQ,GAAG,SAAS,CAAC,MAAM,CAC/B,CAAC,QAAQ,EAAE,EAAE,CACX,QAAQ,CAAC,QAAQ,KAAK,WAAW;QACjC,yBAAyB,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,CAC/C,CAAC;IAEF,OAAO,IAAI,0BAA0B,CAAC,QAAQ,EAAE,sBAAsB,CAAC,IAAI,CAAC,CAAC,CAAC;AAChF,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { CfnTemplateBodyRecord } from "../template/sim-cfn-template.js";
|
|
2
|
+
import type { TerraformPlan } from "./sim-tf-plan.type.js";
|
|
3
|
+
import type { TerraformImportReport } from "./sim-tf-report.type.js";
|
|
4
|
+
export interface TerraformImportResult {
|
|
5
|
+
readonly template: CfnTemplateBodyRecord;
|
|
6
|
+
readonly report: TerraformImportReport;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* A CloudFormation template body built from a Terraform plan.
|
|
10
|
+
*
|
|
11
|
+
* The plan is the JSON `terraform show -json` writes for a saved plan file.
|
|
12
|
+
* What comes back is the body `deployTemplate` takes, so everything downstream
|
|
13
|
+
* of the template is the machinery a CloudFormation or SAM deployment already
|
|
14
|
+
* goes through.
|
|
15
|
+
*
|
|
16
|
+
* The report alongside it says what happened to every resource of the plan. A
|
|
17
|
+
* type with no mapping is skipped and named, in the same spirit as the skipped
|
|
18
|
+
* Resources a Stack records for a CloudFormation type no simulated service
|
|
19
|
+
* models.
|
|
20
|
+
*
|
|
21
|
+
* This is spike code, kept so the measurement behind it stays reproducible.
|
|
22
|
+
* The README beside it says what is known to need work before this is a
|
|
23
|
+
* feature, and nothing here is exported from the package.
|
|
24
|
+
*/
|
|
25
|
+
export declare function cfnTemplateFromTerraformPlan(plan: TerraformPlan): TerraformImportResult;
|
|
26
|
+
//# sourceMappingURL=sim-tf-template.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-tf-template.d.ts","sourceRoot":"","sources":["../../../../src/service/cloudformation/terraform/sim-tf-template.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAC7E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAM3D,OAAO,KAAK,EACV,qBAAqB,EAItB,MAAM,yBAAyB,CAAC;AAEjC,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,QAAQ,EAAE,qBAAqB,CAAC;IACzC,QAAQ,CAAC,MAAM,EAAE,qBAAqB,CAAC;CACxC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,4BAA4B,CAC1C,IAAI,EAAE,aAAa,GAClB,qBAAqB,CAoCvB"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { terraformPlanResources } from "./sim-tf-plan-resources.js";
|
|
2
|
+
import { mappableResolver } from "./sim-tf-template-resolver.js";
|
|
3
|
+
import { applyMappings } from "./sim-tf-template-mappings.js";
|
|
4
|
+
import { recordPrunedResources } from "./sim-tf-template-pruned.js";
|
|
5
|
+
import { applyFolds } from "./sim-tf-template-folds.js";
|
|
6
|
+
/**
|
|
7
|
+
* A CloudFormation template body built from a Terraform plan.
|
|
8
|
+
*
|
|
9
|
+
* The plan is the JSON `terraform show -json` writes for a saved plan file.
|
|
10
|
+
* What comes back is the body `deployTemplate` takes, so everything downstream
|
|
11
|
+
* of the template is the machinery a CloudFormation or SAM deployment already
|
|
12
|
+
* goes through.
|
|
13
|
+
*
|
|
14
|
+
* The report alongside it says what happened to every resource of the plan. A
|
|
15
|
+
* type with no mapping is skipped and named, in the same spirit as the skipped
|
|
16
|
+
* Resources a Stack records for a CloudFormation type no simulated service
|
|
17
|
+
* models.
|
|
18
|
+
*
|
|
19
|
+
* This is spike code, kept so the measurement behind it stays reproducible.
|
|
20
|
+
* The README beside it says what is known to need work before this is a
|
|
21
|
+
* feature, and nothing here is exported from the package.
|
|
22
|
+
*/
|
|
23
|
+
export function cfnTemplateFromTerraformPlan(plan) {
|
|
24
|
+
const resources = terraformPlanResources(plan);
|
|
25
|
+
const resolver = mappableResolver(plan, resources);
|
|
26
|
+
const mapped = [];
|
|
27
|
+
const folded = [];
|
|
28
|
+
const skipped = [];
|
|
29
|
+
const lost = [];
|
|
30
|
+
const templates = new Map();
|
|
31
|
+
const claimedBy = new Map();
|
|
32
|
+
applyMappings({
|
|
33
|
+
resources,
|
|
34
|
+
resolver,
|
|
35
|
+
templates,
|
|
36
|
+
claimedBy,
|
|
37
|
+
mapped,
|
|
38
|
+
skipped,
|
|
39
|
+
lost,
|
|
40
|
+
});
|
|
41
|
+
applyFolds({ resources, resolver, templates, folded, skipped });
|
|
42
|
+
recordPrunedResources({ templates, claimedBy, mapped, skipped });
|
|
43
|
+
return {
|
|
44
|
+
template: { Resources: Object.fromEntries(templates) },
|
|
45
|
+
report: {
|
|
46
|
+
total: resources.length,
|
|
47
|
+
mapped,
|
|
48
|
+
folded,
|
|
49
|
+
skipped,
|
|
50
|
+
lost,
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=sim-tf-template.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-tf-template.js","sourceRoot":"","sources":["../../../../src/service/cloudformation/terraform/sim-tf-template.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAaxD;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,4BAA4B,CAC1C,IAAmB;IAEnB,MAAM,SAAS,GAAG,sBAAsB,CAAC,IAAI,CAAC,CAAC;IAE/C,MAAM,QAAQ,GAAG,gBAAgB,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IAEnD,MAAM,MAAM,GAAgC,EAAE,CAAC;IAC/C,MAAM,MAAM,GAAgC,EAAE,CAAC;IAC/C,MAAM,OAAO,GAA+B,EAAE,CAAC;IAC/C,MAAM,IAAI,GAA6B,EAAE,CAAC;IAC1C,MAAM,SAAS,GAAG,IAAI,GAAG,EAAqC,CAAC;IAC/D,MAAM,SAAS,GAAG,IAAI,GAAG,EAAkB,CAAC;IAE5C,aAAa,CAAC;QACZ,SAAS;QACT,QAAQ;QACR,SAAS;QACT,SAAS;QACT,MAAM;QACN,OAAO;QACP,IAAI;KACL,CAAC,CAAC;IAEH,UAAU,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC;IAEhE,qBAAqB,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC;IAEjE,OAAO;QACL,QAAQ,EAAE,EAAE,SAAS,EAAE,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,EAAE;QACtD,MAAM,EAAE;YACN,KAAK,EAAE,SAAS,CAAC,MAAM;YACvB,MAAM;YACN,MAAM;YACN,OAAO;YACP,IAAI;SACL;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { SimCfnDeployedStack } from "../../cloudformation/stack/sim-cfn-deployed-stack.type.js";
|
|
2
2
|
/**
|
|
3
3
|
* One stack Output, as the string an ELBv2 Resource answers with.
|
|
4
4
|
*
|
|
@@ -6,5 +6,5 @@ import type { SimCfnStack } from "../../cloudformation/stack/sim-cfn-stack.js";
|
|
|
6
6
|
* asking for it as a string here keeps each assertion about the value rather
|
|
7
7
|
* than about what shape it came out in.
|
|
8
8
|
*/
|
|
9
|
-
export declare function simCfnElbV2Output(stack:
|
|
9
|
+
export declare function simCfnElbV2Output(stack: SimCfnDeployedStack, name: string): string;
|
|
10
10
|
//# sourceMappingURL=sim-cfn-elbv2.fixture.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sim-cfn-elbv2.fixture.d.ts","sourceRoot":"","sources":["../../../../src/service/elbv2/cfn/sim-cfn-elbv2.fixture.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"sim-cfn-elbv2.fixture.d.ts","sourceRoot":"","sources":["../../../../src/service/elbv2/cfn/sim-cfn-elbv2.fixture.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2DAA2D,CAAC;AAErG;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,mBAAmB,EAC1B,IAAI,EAAE,MAAM,GACX,MAAM,CAMR"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sim-cfn-elbv2.fixture.js","sourceRoot":"","sources":["../../../../src/service/elbv2/cfn/sim-cfn-elbv2.fixture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAIpD;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,
|
|
1
|
+
{"version":3,"file":"sim-cfn-elbv2.fixture.js","sourceRoot":"","sources":["../../../../src/service/elbv2/cfn/sim-cfn-elbv2.fixture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAIpD;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAC/B,KAA0B,EAC1B,IAAY;IAEZ,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC;IAE7C,gBAAgB,CAAC,KAAK,CAAC,CAAC;IAExB,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export interface TestTerraformProjectProperties {
|
|
2
|
+
/**
|
|
3
|
+
* Whether this configuration is expected to fail its `data` blocks.
|
|
4
|
+
*
|
|
5
|
+
* Only a configuration known to read AWS at plan time sets this, and it
|
|
6
|
+
* limits the tolerance to that one. Every other configuration treats a
|
|
7
|
+
* non-zero exit as the failure it is.
|
|
8
|
+
*/
|
|
9
|
+
readonly toleratesDataSourceErrors?: boolean;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* A Terraform configuration under `test/terraform`, planned on demand.
|
|
13
|
+
*
|
|
14
|
+
* The plan JSON a Terraform import reads runs to thousands of lines, and the
|
|
15
|
+
* configuration behind it runs to tens. Only the configuration is in the
|
|
16
|
+
* repository, and this produces the plan from it the way `TestCdkProject`
|
|
17
|
+
* produces a cloud assembly from a CDK app.
|
|
18
|
+
*
|
|
19
|
+
* `terraform init` downloads the AWS provider, which is one binary of about
|
|
20
|
+
* 650MB. That is far too slow to sit inside a test, so it is left to
|
|
21
|
+
* `pnpm tf:init` and to the workflow step that caches it. A configuration that
|
|
22
|
+
* has never been initialised is reported rather than initialised here.
|
|
23
|
+
*/
|
|
24
|
+
export declare class TestTerraformProject {
|
|
25
|
+
readonly name: string;
|
|
26
|
+
private readonly directory;
|
|
27
|
+
private readonly toleratesDataSourceErrors;
|
|
28
|
+
constructor(name: string, properties?: TestTerraformProjectProperties);
|
|
29
|
+
/**
|
|
30
|
+
* The plan JSON for this configuration, as `terraform show -json` writes it.
|
|
31
|
+
*
|
|
32
|
+
* The plan file goes to a temporary directory rather than into the
|
|
33
|
+
* configuration, so a run leaves the repository as it found it.
|
|
34
|
+
*/
|
|
35
|
+
planJson(): Promise<unknown>;
|
|
36
|
+
/**
|
|
37
|
+
* Write the plan file.
|
|
38
|
+
*
|
|
39
|
+
* A configuration reading a `data` block that calls AWS cannot be planned
|
|
40
|
+
* offline. Terraform reports each one as an error and exits non-zero, and it
|
|
41
|
+
* still writes a plan covering the managed resources, which are what an
|
|
42
|
+
* import reads. A configuration expecting that says so. Every other failure
|
|
43
|
+
* is a failure, so a broken configuration cannot pass as a partial plan.
|
|
44
|
+
*/
|
|
45
|
+
private plan;
|
|
46
|
+
private show;
|
|
47
|
+
/**
|
|
48
|
+
* Fail with what to run, rather than with what Terraform says.
|
|
49
|
+
*
|
|
50
|
+
* Terraform's own message for an uninitialised directory names a command
|
|
51
|
+
* that would work and say nothing about the provider cache this repository
|
|
52
|
+
* shares between its two configurations.
|
|
53
|
+
*/
|
|
54
|
+
private requireInitialised;
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=test-terraform-project.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-terraform-project.d.ts","sourceRoot":"","sources":["../../../src/util/filesystem/test-terraform-project.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,8BAA8B;IAC7C;;;;;;OAMG;IACH,QAAQ,CAAC,yBAAyB,CAAC,EAAE,OAAO,CAAC;CAC9C;AAED;;;;;;;;;;;;GAYG;AACH,qBAAa,oBAAoB;aAKb,IAAI,EAAE,MAAM;IAJ9B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,yBAAyB,CAAU;IAEpD,YACkB,IAAI,EAAE,MAAM,EAC5B,UAAU,GAAE,8BAAmC,EAKhD;IAED;;;;;OAKG;IACG,QAAQ,IAAI,OAAO,CAAC,OAAO,CAAC,CAUjC;IAED;;;;;;;;OAQG;YACW,IAAI;YAmBJ,IAAI;IAUlB;;;;;;OAMG;IACH,OAAO,CAAC,kBAAkB;CAY3B"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import { execa } from "execa";
|
|
3
|
+
import { repoPath } from "./path.js";
|
|
4
|
+
import { TemporaryDirectory } from "./temporary-directory.js";
|
|
5
|
+
/**
|
|
6
|
+
* A Terraform configuration under `test/terraform`, planned on demand.
|
|
7
|
+
*
|
|
8
|
+
* The plan JSON a Terraform import reads runs to thousands of lines, and the
|
|
9
|
+
* configuration behind it runs to tens. Only the configuration is in the
|
|
10
|
+
* repository, and this produces the plan from it the way `TestCdkProject`
|
|
11
|
+
* produces a cloud assembly from a CDK app.
|
|
12
|
+
*
|
|
13
|
+
* `terraform init` downloads the AWS provider, which is one binary of about
|
|
14
|
+
* 650MB. That is far too slow to sit inside a test, so it is left to
|
|
15
|
+
* `pnpm tf:init` and to the workflow step that caches it. A configuration that
|
|
16
|
+
* has never been initialised is reported rather than initialised here.
|
|
17
|
+
*/
|
|
18
|
+
export class TestTerraformProject {
|
|
19
|
+
name;
|
|
20
|
+
directory;
|
|
21
|
+
toleratesDataSourceErrors;
|
|
22
|
+
constructor(name, properties = {}) {
|
|
23
|
+
this.name = name;
|
|
24
|
+
this.directory = repoPath(`test/terraform/${name}`);
|
|
25
|
+
this.toleratesDataSourceErrors =
|
|
26
|
+
properties.toleratesDataSourceErrors ?? false;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The plan JSON for this configuration, as `terraform show -json` writes it.
|
|
30
|
+
*
|
|
31
|
+
* The plan file goes to a temporary directory rather than into the
|
|
32
|
+
* configuration, so a run leaves the repository as it found it.
|
|
33
|
+
*/
|
|
34
|
+
async planJson() {
|
|
35
|
+
this.requireInitialised();
|
|
36
|
+
const output = new TemporaryDirectory();
|
|
37
|
+
await output.resolvePath();
|
|
38
|
+
const planFile = output.join(`${this.name}.tfplan`);
|
|
39
|
+
await this.plan(planFile);
|
|
40
|
+
return JSON.parse(await this.show(planFile));
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Write the plan file.
|
|
44
|
+
*
|
|
45
|
+
* A configuration reading a `data` block that calls AWS cannot be planned
|
|
46
|
+
* offline. Terraform reports each one as an error and exits non-zero, and it
|
|
47
|
+
* still writes a plan covering the managed resources, which are what an
|
|
48
|
+
* import reads. A configuration expecting that says so. Every other failure
|
|
49
|
+
* is a failure, so a broken configuration cannot pass as a partial plan.
|
|
50
|
+
*/
|
|
51
|
+
async plan(planFile) {
|
|
52
|
+
const result = await execa("terraform", [`-chdir=${this.directory}`, "plan", "-input=false", "-out", planFile], { env: { TF_IN_AUTOMATION: "1" }, reject: false });
|
|
53
|
+
if (result.exitCode === 0) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
// oxlint-disable-next-line security/detect-non-literal-fs-filename
|
|
57
|
+
if (this.toleratesDataSourceErrors && existsSync(planFile)) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
throw new Error(`terraform plan failed for ${this.name}: ${result.stderr}`);
|
|
61
|
+
}
|
|
62
|
+
async show(planFile) {
|
|
63
|
+
const { stdout } = await execa("terraform", [`-chdir=${this.directory}`, "show", "-json", planFile], { env: { TF_IN_AUTOMATION: "1" } });
|
|
64
|
+
return stdout;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Fail with what to run, rather than with what Terraform says.
|
|
68
|
+
*
|
|
69
|
+
* Terraform's own message for an uninitialised directory names a command
|
|
70
|
+
* that would work and say nothing about the provider cache this repository
|
|
71
|
+
* shares between its two configurations.
|
|
72
|
+
*/
|
|
73
|
+
requireInitialised() {
|
|
74
|
+
// oxlint-disable-next-line security/detect-non-literal-fs-filename
|
|
75
|
+
if (existsSync(`${this.directory}/.terraform`)) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
throw new Error(`Terraform configuration ${this.name} is not initialised. ` +
|
|
79
|
+
`Run \`pnpm tf:init\` first. It downloads the AWS provider, which ` +
|
|
80
|
+
`takes a few minutes the first time and nothing afterwards.`);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=test-terraform-project.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-terraform-project.js","sourceRoot":"","sources":["../../../src/util/filesystem/test-terraform-project.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAC9B,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAa9D;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,oBAAoB;IAKb,IAAI;IAJL,SAAS,CAAS;IAClB,yBAAyB,CAAU;IAEpD,YACkB,IAAY,EAC5B,UAAU,GAAmC,EAAE;oBAD/B,IAAI;QAGpB,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC,kBAAkB,IAAI,EAAE,CAAC,CAAC;QACpD,IAAI,CAAC,yBAAyB;YAC5B,UAAU,CAAC,yBAAyB,IAAI,KAAK,CAAC;IAClD,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,QAAQ;QACZ,IAAI,CAAC,kBAAkB,EAAE,CAAC;QAE1B,MAAM,MAAM,GAAG,IAAI,kBAAkB,EAAE,CAAC;QACxC,MAAM,MAAM,CAAC,WAAW,EAAE,CAAC;QAC3B,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,SAAS,CAAC,CAAC;QAEpD,MAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAE1B,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAY,CAAC;IAC1D,CAAC;IAED;;;;;;;;OAQG;IACK,KAAK,CAAC,IAAI,CAAC,QAAgB;QACjC,MAAM,MAAM,GAAG,MAAM,KAAK,CACxB,WAAW,EACX,CAAC,UAAU,IAAI,CAAC,SAAS,EAAE,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,QAAQ,CAAC,EACtE,EAAE,GAAG,EAAE,EAAE,gBAAgB,EAAE,GAAG,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,CAClD,CAAC;QAEF,IAAI,MAAM,CAAC,QAAQ,KAAK,CAAC,EAAE,CAAC;YAC1B,OAAO;QACT,CAAC;QAED,mEAAmE;QACnE,IAAI,IAAI,CAAC,yBAAyB,IAAI,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC3D,OAAO;QACT,CAAC;QAED,MAAM,IAAI,KAAK,CAAC,6BAA6B,IAAI,CAAC,IAAI,KAAK,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;IAC9E,CAAC;IAEO,KAAK,CAAC,IAAI,CAAC,QAAgB;QACjC,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,KAAK,CAC5B,WAAW,EACX,CAAC,UAAU,IAAI,CAAC,SAAS,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAC,EACvD,EAAE,GAAG,EAAE,EAAE,gBAAgB,EAAE,GAAG,EAAE,EAAE,CACnC,CAAC;QAEF,OAAO,MAAM,CAAC;IAChB,CAAC;IAED;;;;;;OAMG;IACK,kBAAkB;QACxB,mEAAmE;QACnE,IAAI,UAAU,CAAC,GAAG,IAAI,CAAC,SAAS,aAAa,CAAC,EAAE,CAAC;YAC/C,OAAO;QACT,CAAC;QAED,MAAM,IAAI,KAAK,CACb,2BAA2B,IAAI,CAAC,IAAI,uBAAuB;YACzD,mEAAmE;YACnE,4DAA4D,CAC/D,CAAC;IACJ,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kensio/yulin",
|
|
3
|
-
"version": "1.19.
|
|
3
|
+
"version": "1.19.2",
|
|
4
4
|
"description": "AWS system behaviour simulation for isolated unit testing",
|
|
5
5
|
"repository": "https://github.com/KensioSoftware/yulin",
|
|
6
6
|
"homepage": "https://yulinsim.dev/",
|
|
@@ -28,7 +28,8 @@
|
|
|
28
28
|
"examples:lint": "oxlint --type-aware --max-warnings=0 docs",
|
|
29
29
|
"examples:check": "pnpm examples:extract && pnpm examples:tsc && pnpm examples:lint",
|
|
30
30
|
"fta": "./scripts/sh/fta.sh",
|
|
31
|
-
"check": "pnpm fmt && pnpm fta && pnpm build:check && pnpm examples:check && pnpm test:coverage"
|
|
31
|
+
"check": "pnpm fmt && pnpm fta && pnpm build:check && pnpm examples:check && pnpm test:coverage",
|
|
32
|
+
"tf:init": "./scripts/sh/tf-init.sh"
|
|
32
33
|
},
|
|
33
34
|
"keywords": [
|
|
34
35
|
"aws",
|