@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-plan-index.d.ts","sourceRoot":"","sources":["../../../../src/service/cloudformation/terraform/sim-tf-plan-index.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,qBAAqB,EACrB,uBAAuB,EACvB,aAAa,EACd,MAAM,uBAAuB,CAAC;AAE/B,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC3C;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,aAAa,GAClB,WAAW,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAS3C;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,qBAAqB,GAAG,SAAS,GACxC,WAAW,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAS9C;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,UAAU,EAAE,SAAS,MAAM,EAAE,GAC5B,MAAM,CAMR;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,YAAY,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAQ1E"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Each resource's `after_unknown`, keyed by the address it belongs to.\n *\n * `planned_values` says what a value is and `resource_changes` says whether\n * the plan knew it, so reading a resource means having both to hand.
|
|
3
|
+
*/
|
|
4
|
+
export function changesByAddress(plan) {
|
|
5
|
+
const entries = (plan.resource_changes ?? []).map((change) => [
|
|
6
|
+
change.address,
|
|
7
|
+
{ unknown: change.change?.after_unknown ?? {} },
|
|
8
|
+
]);
|
|
9
|
+
return new Map(entries);
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* The declared configuration of one module's resources, keyed by type and\n * name.\n *\n * Configuration addresses are relative to the module that declares them, while\n * `planned_values` addresses are fully qualified, so the two are joined per\n * module rather than across the whole plan.
|
|
13
|
+
*/
|
|
14
|
+
export function configResourcesByKey(config) {
|
|
15
|
+
const entries = (config?.resources ?? []).map((resource) => [
|
|
16
|
+
`${resource.type}.${resource.name}`,
|
|
17
|
+
resource,
|
|
18
|
+
]);
|
|
19
|
+
return new Map(entries);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The call name of a child module, taken off its fully qualified address.
|
|
23
|
+
*
|
|
24
|
+
* A child module address repeats its parents, so `module.a.module.b` under
|
|
25
|
+
* `["a"]` is the call named `b`. A module called with `for_each` carries the
|
|
26
|
+
* key on the address, and the key belongs to the instance rather than to the
|
|
27
|
+
* call the configuration is filed under.
|
|
28
|
+
*/
|
|
29
|
+
export function childModuleCallName(address, modulePath) {
|
|
30
|
+
const segments = (address ?? "").split(".");
|
|
31
|
+
const own = segments.slice(modulePath.length * 2);
|
|
32
|
+
const called = own[1] ?? "";
|
|
33
|
+
return called.replace(/\[.*]$/, "");
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* The provider that owns a resource type, without the registry it came from.
|
|
37
|
+
*/
|
|
38
|
+
export function providerShortName(providerName) {
|
|
39
|
+
if (providerName === undefined) {
|
|
40
|
+
return "unknown";
|
|
41
|
+
}
|
|
42
|
+
const [name] = providerName.split("registry.terraform.io/").slice(-1);
|
|
43
|
+
return name ?? providerName;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=sim-tf-plan-index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-tf-plan-index.js","sourceRoot":"","sources":["../../../../src/service/cloudformation/terraform/sim-tf-plan-index.ts"],"names":[],"mappings":"AAgBA;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAC9B,IAAmB;IAEnB,MAAM,OAAO,GAAG,CAAC,IAAI,CAAC,gBAAgB,IAAI,EAAE,CAAC,CAAC,GAAG,CAC/C,CAAC,MAAM,EAAkC,EAAE,CAAC;QAC1C,MAAM,CAAC,OAAO;QACd,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,IAAI,EAAE,EAAE;KAChD,CACF,CAAC;IAEF,OAAO,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC;AAC1B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAClC,MAAyC;IAEzC,MAAM,OAAO,GAAG,CAAC,MAAM,EAAE,SAAS,IAAI,EAAE,CAAC,CAAC,GAAG,CAC3C,CAAC,QAAQ,EAAqC,EAAE,CAAC;QAC/C,GAAG,QAAQ,CAAC,IAAI,IAAI,QAAQ,CAAC,IAAI,EAAE;QACnC,QAAQ;KACT,CACF,CAAC;IAEF,OAAO,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC;AAC1B,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,mBAAmB,CACjC,OAA2B,EAC3B,UAA6B;IAE7B,MAAM,QAAQ,GAAG,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC5C,MAAM,GAAG,GAAG,QAAQ,CAAC,KAAK,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAClD,MAAM,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IAE5B,OAAO,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;AACtC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,YAAgC;IAChE,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;QAC/B,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,CAAC,IAAI,CAAC,GAAG,YAAY,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAEtE,OAAO,IAAI,IAAI,YAAY,CAAC;AAC9B,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { TerraformPlan } from "./sim-tf-plan.type.js";
|
|
2
|
+
/**
|
|
3
|
+
* One resource of a plan, with everything the import needs about it in one
|
|
4
|
+
* place.
|
|
5
|
+
*
|
|
6
|
+
* A plan splits what it knows about a resource across three sections.
|
|
7
|
+
* `planned_values` holds resolved attributes, `resource_changes` marks the
|
|
8
|
+
* attributes that stayed unknown, and `configuration` holds what the resource
|
|
9
|
+
* refers to. This is the three joined up.
|
|
10
|
+
*/
|
|
11
|
+
export interface TerraformResource {
|
|
12
|
+
/** The fully qualified address, such as `module.uploads.aws_s3_bucket.this`. */
|
|
13
|
+
readonly address: string;
|
|
14
|
+
readonly type: string;
|
|
15
|
+
readonly name: string;
|
|
16
|
+
readonly index: string | number | undefined;
|
|
17
|
+
/** The provider that owns the type, such as `hashicorp/aws`. */
|
|
18
|
+
readonly provider: string;
|
|
19
|
+
/** Attributes the plan resolved to a value. */
|
|
20
|
+
readonly values: Record<string, unknown>;
|
|
21
|
+
/** `after_unknown`, whose `true` leaves mark attributes still to be decided. */
|
|
22
|
+
readonly unknown: Record<string, unknown>;
|
|
23
|
+
/** Declared expressions, holding the `references` this resource reads. */
|
|
24
|
+
readonly expressions: Record<string, unknown>;
|
|
25
|
+
/** Explicit `depends_on` addresses, relative to the declaring module. */
|
|
26
|
+
readonly dependsOn: readonly string[];
|
|
27
|
+
/** The module call path this resource was declared under. */
|
|
28
|
+
readonly modulePath: readonly string[];
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Every managed AWS resource a plan will create, in declaration order.
|
|
32
|
+
*
|
|
33
|
+
* Data sources are left out, because a data source reads infrastructure that
|
|
34
|
+
* already exists and creates nothing. Resources from another provider are left
|
|
35
|
+
* in, carrying their provider name, so the caller can report them rather than
|
|
36
|
+
* silently lose them.
|
|
37
|
+
*/
|
|
38
|
+
export declare function terraformPlanResources(plan: TerraformPlan): readonly TerraformResource[];
|
|
39
|
+
//# sourceMappingURL=sim-tf-plan-resources.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-tf-plan-resources.d.ts","sourceRoot":"","sources":["../../../../src/service/cloudformation/terraform/sim-tf-plan-resources.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAGV,aAAa,EAGd,MAAM,uBAAuB,CAAC;AAS/B;;;;;;;;GAQG;AACH,MAAM,WAAW,iBAAiB;IAChC,gFAAgF;IAChF,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IAC5C,gEAAgE;IAChE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,+CAA+C;IAC/C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACzC,gFAAgF;IAChF,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC1C,0EAA0E;IAC1E,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9C,yEAAyE;IACzE,QAAQ,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;IACtC,6DAA6D;IAC7D,QAAQ,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,CAAC;CACxC;AAED;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,aAAa,GAClB,SAAS,iBAAiB,EAAE,CAa9B"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { changesByAddress, childModuleCallName, configResourcesByKey, providerShortName, } from "./sim-tf-plan-index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Every managed AWS resource a plan will create, in declaration order.
|
|
4
|
+
*
|
|
5
|
+
* Data sources are left out, because a data source reads infrastructure that
|
|
6
|
+
* already exists and creates nothing. Resources from another provider are left
|
|
7
|
+
* in, carrying their provider name, so the caller can report them rather than
|
|
8
|
+
* silently lose them.
|
|
9
|
+
*/
|
|
10
|
+
export function terraformPlanResources(plan) {
|
|
11
|
+
const rootValues = plan.planned_values?.root_module;
|
|
12
|
+
if (rootValues === undefined) {
|
|
13
|
+
return [];
|
|
14
|
+
}
|
|
15
|
+
return collectModule(rootValues, plan.configuration?.root_module, [], changesByAddress(plan));
|
|
16
|
+
}
|
|
17
|
+
function collectModule(values, config, modulePath, changes) {
|
|
18
|
+
const configResources = configResourcesByKey(config);
|
|
19
|
+
const own = (values.resources ?? [])
|
|
20
|
+
.filter((resource) => (resource.mode ?? "managed") === "managed")
|
|
21
|
+
.map((resource) => joinedResource(resource, configResources, modulePath, changes));
|
|
22
|
+
const nested = (values.child_modules ?? []).flatMap((child) => {
|
|
23
|
+
const callName = childModuleCallName(child.address, modulePath);
|
|
24
|
+
return collectModule(child, config?.module_calls?.[callName]?.module, [...modulePath, callName], changes);
|
|
25
|
+
});
|
|
26
|
+
return [...own, ...nested];
|
|
27
|
+
}
|
|
28
|
+
function joinedResource(resource, configResources, modulePath, changes) {
|
|
29
|
+
const config = configResources.get(`${resource.type}.${resource.name}`);
|
|
30
|
+
const change = changes.get(resource.address);
|
|
31
|
+
return {
|
|
32
|
+
address: resource.address,
|
|
33
|
+
type: resource.type,
|
|
34
|
+
name: resource.name,
|
|
35
|
+
index: resource.index,
|
|
36
|
+
provider: providerShortName(resource.provider_name),
|
|
37
|
+
values: resource.values ?? {},
|
|
38
|
+
unknown: change?.unknown ?? {},
|
|
39
|
+
expressions: config?.expressions ?? {},
|
|
40
|
+
dependsOn: config?.depends_on ?? [],
|
|
41
|
+
modulePath,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=sim-tf-plan-resources.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-tf-plan-resources.js","sourceRoot":"","sources":["../../../../src/service/cloudformation/terraform/sim-tf-plan-resources.ts"],"names":[],"mappings":"AAaA,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,oBAAoB,EACpB,iBAAiB,GAElB,MAAM,wBAAwB,CAAC;AA+BhC;;;;;;;GAOG;AACH,MAAM,UAAU,sBAAsB,CACpC,IAAmB;IAEnB,MAAM,UAAU,GAAG,IAAI,CAAC,cAAc,EAAE,WAAW,CAAC;IAEpD,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;QAC7B,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,OAAO,aAAa,CAClB,UAAU,EACV,IAAI,CAAC,aAAa,EAAE,WAAW,EAC/B,EAAE,EACF,gBAAgB,CAAC,IAAI,CAAC,CACvB,CAAC;AACJ,CAAC;AAED,SAAS,aAAa,CACpB,MAA8B,EAC9B,MAAyC,EACzC,UAA6B,EAC7B,OAAkD;IAElD,MAAM,eAAe,GAAG,oBAAoB,CAAC,MAAM,CAAC,CAAC;IAErD,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,SAAS,IAAI,EAAE,CAAC;SACjC,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC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,WAAW,IAAI,EAAE;QACtC,SAAS,EAAE,MAAM,EAAE,UAAU,IAAI,EAAE;QACnC,UAAU;KACX,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The parts of a `terraform show -json <planfile>` document this import reads.
|
|
3
|
+
*
|
|
4
|
+
* Terraform documents this as the plan representation, and its `format_version`
|
|
5
|
+
* has been `1.x` since Terraform 0.12. Only the members the import uses are
|
|
6
|
+
* described here. A plan carries a great deal more.
|
|
7
|
+
*/
|
|
8
|
+
export interface TerraformPlan {
|
|
9
|
+
readonly format_version?: string;
|
|
10
|
+
readonly terraform_version?: string;
|
|
11
|
+
readonly planned_values?: {
|
|
12
|
+
readonly root_module?: TerraformPlannedModule;
|
|
13
|
+
};
|
|
14
|
+
readonly resource_changes?: readonly TerraformResourceChange[];
|
|
15
|
+
readonly configuration?: {
|
|
16
|
+
readonly root_module?: TerraformConfigModule;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* One module's resolved resources, and the modules it calls.
|
|
21
|
+
*
|
|
22
|
+
* `count` and `for_each` are already expanded here. A resource declared with
|
|
23
|
+
* `count = 3` appears as three entries carrying `index` 0, 1 and 2.
|
|
24
|
+
*/
|
|
25
|
+
export interface TerraformPlannedModule {
|
|
26
|
+
readonly resources?: readonly TerraformPlannedResource[];
|
|
27
|
+
readonly child_modules?: readonly TerraformPlannedChildModule[];
|
|
28
|
+
}
|
|
29
|
+
export interface TerraformPlannedChildModule extends TerraformPlannedModule {
|
|
30
|
+
/** The fully qualified call address, such as `module.uploads_bucket`. */
|
|
31
|
+
readonly address?: string;
|
|
32
|
+
}
|
|
33
|
+
export interface TerraformPlannedResource {
|
|
34
|
+
readonly address: string;
|
|
35
|
+
readonly mode?: string;
|
|
36
|
+
readonly type: string;
|
|
37
|
+
readonly name: string;
|
|
38
|
+
readonly index?: string | number;
|
|
39
|
+
readonly provider_name?: string;
|
|
40
|
+
readonly values?: Record<string, unknown>;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* What a plan says it will do to one resource.
|
|
44
|
+
*
|
|
45
|
+
* `after` holds the attributes whose values the plan resolved, and
|
|
46
|
+
* `after_unknown` marks the ones it could not. An attribute unknown at plan
|
|
47
|
+
* time is absent from `after` and carries `true` in `after_unknown`, so the two
|
|
48
|
+
* have to be read together to tell "no value" from "not known yet".
|
|
49
|
+
*/
|
|
50
|
+
export interface TerraformResourceChange {
|
|
51
|
+
readonly address: string;
|
|
52
|
+
readonly mode?: string;
|
|
53
|
+
readonly type: string;
|
|
54
|
+
readonly name: string;
|
|
55
|
+
readonly change?: {
|
|
56
|
+
readonly actions?: readonly string[];
|
|
57
|
+
readonly after?: Record<string, unknown> | null;
|
|
58
|
+
readonly after_unknown?: Record<string, unknown> | null;
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* The declared configuration, holding the reference graph.
|
|
63
|
+
*
|
|
64
|
+
* Addresses here are relative to the module the resource is declared in, while
|
|
65
|
+
* `planned_values` addresses are fully qualified. Joining the two means walking
|
|
66
|
+
* both trees together rather than matching on address.
|
|
67
|
+
*/
|
|
68
|
+
export interface TerraformConfigModule {
|
|
69
|
+
readonly resources?: readonly TerraformConfigResource[];
|
|
70
|
+
readonly module_calls?: Record<string, {
|
|
71
|
+
readonly module?: TerraformConfigModule;
|
|
72
|
+
}>;
|
|
73
|
+
}
|
|
74
|
+
export interface TerraformConfigResource {
|
|
75
|
+
readonly address: string;
|
|
76
|
+
readonly mode?: string;
|
|
77
|
+
readonly type: string;
|
|
78
|
+
readonly name: string;
|
|
79
|
+
readonly expressions?: Record<string, unknown>;
|
|
80
|
+
readonly depends_on?: readonly string[];
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* A `references` entry, which is a resource address optionally followed by the
|
|
84
|
+
* attribute being read off it.
|
|
85
|
+
*
|
|
86
|
+
* Terraform lists both forms for one reference. `aws_iam_role.processor.arn`
|
|
87
|
+
* names the attribute and `aws_iam_role.processor` names the resource, and both
|
|
88
|
+
* appear in the same array.
|
|
89
|
+
*/
|
|
90
|
+
export interface TerraformExpression {
|
|
91
|
+
readonly constant_value?: unknown;
|
|
92
|
+
readonly references?: readonly string[];
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=sim-tf-plan.type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-tf-plan.type.d.ts","sourceRoot":"","sources":["../../../../src/service/cloudformation/terraform/sim-tf-plan.type.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IACpC,QAAQ,CAAC,cAAc,CAAC,EAAE;QAAE,QAAQ,CAAC,WAAW,CAAC,EAAE,sBAAsB,CAAA;KAAE,CAAC;IAC5E,QAAQ,CAAC,gBAAgB,CAAC,EAAE,SAAS,uBAAuB,EAAE,CAAC;IAC/D,QAAQ,CAAC,aAAa,CAAC,EAAE;QAAE,QAAQ,CAAC,WAAW,CAAC,EAAE,qBAAqB,CAAA;KAAE,CAAC;CAC3E;AAED;;;;;GAKG;AACH,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,wBAAwB,EAAE,CAAC;IACzD,QAAQ,CAAC,aAAa,CAAC,EAAE,SAAS,2BAA2B,EAAE,CAAC;CACjE;AAED,MAAM,WAAW,2BAA4B,SAAQ,sBAAsB;IACzE,yEAAyE;IACzE,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,MA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CAAC,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/C,QAAQ,CAAC,UAAU,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACzC;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC;IAClC,QAAQ,CAAC,UAAU,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACzC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-tf-plan.type.js","sourceRoot":"","sources":["../../../../src/service/cloudformation/terraform/sim-tf-plan.type.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { TerraformModuleOutput } from "./sim-tf-module-outputs.js";
|
|
2
|
+
/**
|
|
3
|
+
* References ordered longest first.
|
|
4
|
+
*
|
|
5
|
+
* Terraform lists the attribute form and the bare resource form of one
|
|
6
|
+
* reference. The attribute form is longer, and it is the one that resolves to
|
|
7
|
+
* the value being read rather than to the resource as a whole.
|
|
8
|
+
*/
|
|
9
|
+
export declare function longestFirst(references: readonly string[]): readonly string[];
|
|
10
|
+
/**
|
|
11
|
+
* The attribute a module output reads off the resource behind it.
|
|
12
|
+
*
|
|
13
|
+
* The output names it, such as `aws_lambda_function.this[0].arn` behind
|
|
14
|
+
* `lambda_function_arn`, and the read table is keyed on that rather than on the
|
|
15
|
+
* output's own name.
|
|
16
|
+
*/
|
|
17
|
+
export declare function moduleOutputAttribute(qualified: string, output: TerraformModuleOutput | undefined): string;
|
|
18
|
+
/**
|
|
19
|
+
* A module-relative reference turned into a plan-wide address.
|
|
20
|
+
*
|
|
21
|
+
* References inside a module name their own module's resources without the
|
|
22
|
+
* module prefix that `planned_values` puts on them. A reference to another
|
|
23
|
+
* module's output is qualified the same way, because the output index is keyed
|
|
24
|
+
* by the full call path and a nested call would otherwise miss it.
|
|
25
|
+
*/
|
|
26
|
+
export declare function qualifiedReference(reference: string, modulePath: readonly string[]): string;
|
|
27
|
+
//# sourceMappingURL=sim-tf-reference-address.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-tf-reference-address.d.ts","sourceRoot":"","sources":["../../../../src/service/cloudformation/terraform/sim-tf-reference-address.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAExE;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,MAAM,EAAE,CAE7E;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACnC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,qBAAqB,GAAG,SAAS,GACxC,MAAM,CAMR;AAoBD;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,SAAS,MAAM,EAAE,GAC5B,MAAM,CAYR"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* References ordered longest first.
|
|
3
|
+
*
|
|
4
|
+
* Terraform lists the attribute form and the bare resource form of one
|
|
5
|
+
* reference. The attribute form is longer, and it is the one that resolves to
|
|
6
|
+
* the value being read rather than to the resource as a whole.
|
|
7
|
+
*/
|
|
8
|
+
export function longestFirst(references) {
|
|
9
|
+
return references.toSorted((a, b) => b.length - a.length);
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* The attribute a module output reads off the resource behind it.
|
|
13
|
+
*
|
|
14
|
+
* The output names it, such as `aws_lambda_function.this[0].arn` behind
|
|
15
|
+
* `lambda_function_arn`, and the read table is keyed on that rather than on the
|
|
16
|
+
* output's own name.
|
|
17
|
+
*/
|
|
18
|
+
export function moduleOutputAttribute(qualified, output) {
|
|
19
|
+
const [longest] = longestFirst(output?.references ?? []);
|
|
20
|
+
void qualified;
|
|
21
|
+
return longest === undefined ? "" : (longest.split(".").pop() ?? "");
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Scopes that name something other than a resource of the same module.
|
|
25
|
+
*
|
|
26
|
+
* A reference under one of these is resolved by Terraform rather than by an
|
|
27
|
+
* address lookup, and prefixing it with the module path would invent an
|
|
28
|
+
* address no resource has.
|
|
29
|
+
*/
|
|
30
|
+
const unqualifiedScopes = [
|
|
31
|
+
"var.",
|
|
32
|
+
"local.",
|
|
33
|
+
"each.",
|
|
34
|
+
"count.",
|
|
35
|
+
"self.",
|
|
36
|
+
"data.",
|
|
37
|
+
"path.",
|
|
38
|
+
"terraform.",
|
|
39
|
+
];
|
|
40
|
+
/**
|
|
41
|
+
* A module-relative reference turned into a plan-wide address.
|
|
42
|
+
*
|
|
43
|
+
* References inside a module name their own module's resources without the
|
|
44
|
+
* module prefix that `planned_values` puts on them. A reference to another
|
|
45
|
+
* module's output is qualified the same way, because the output index is keyed
|
|
46
|
+
* by the full call path and a nested call would otherwise miss it.
|
|
47
|
+
*/
|
|
48
|
+
export function qualifiedReference(reference, modulePath) {
|
|
49
|
+
if (modulePath.length === 0) {
|
|
50
|
+
return reference;
|
|
51
|
+
}
|
|
52
|
+
if (unqualifiedScopes.some((scope) => reference.startsWith(scope))) {
|
|
53
|
+
return reference;
|
|
54
|
+
}
|
|
55
|
+
const prefix = modulePath.map((call) => `module.${call}`).join(".");
|
|
56
|
+
return `${prefix}.${reference}`;
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=sim-tf-reference-address.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-tf-reference-address.js","sourceRoot":"","sources":["../../../../src/service/cloudformation/terraform/sim-tf-reference-address.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAAC,UAA6B;IACxD,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC;AAC5D,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,qBAAqB,CACnC,SAAiB,EACjB,MAAyC;IAEzC,MAAM,CAAC,OAAO,CAAC,GAAG,YAAY,CAAC,MAAM,EAAE,UAAU,IAAI,EAAE,CAAC,CAAC;IAEzD,KAAK,SAAS,CAAC;IAEf,OAAO,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC;AACvE,CAAC;AAED;;;;;;GAMG;AACH,MAAM,iBAAiB,GAAG;IACxB,MAAM;IACN,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,OAAO;IACP,OAAO;IACP,OAAO;IACP,YAAY;CACb,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,UAAU,kBAAkB,CAChC,SAAiB,EACjB,UAA6B;IAE7B,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC5B,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,IAAI,iBAAiB,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,SAAS,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;QACnE,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,MAAM,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,UAAU,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAEpE,OAAO,GAAG,MAAM,IAAI,SAAS,EAAE,CAAC;AAClC,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { SimCfnTemplateValue } from "../template/value/sim-cfn-template-value.js";
|
|
2
|
+
import type { TerraformResource } from "./sim-tf-plan-resources.js";
|
|
3
|
+
import type { TerraformModuleOutput } from "./sim-tf-module-outputs.js";
|
|
4
|
+
/**
|
|
5
|
+
* The CloudFormation logical ID standing for one Terraform address.
|
|
6
|
+
*
|
|
7
|
+
* A logical ID is alphanumeric, so the module path, the resource type, the name
|
|
8
|
+
* and any `count` or `for_each` key are folded into one camel-run.
|
|
9
|
+
*
|
|
10
|
+
* Folding loses the separators, and two addresses can therefore arrive at one
|
|
11
|
+
* ID. `aws_s3_bucket.foo_bar` and `aws_s3_bucket.fooBar` both give
|
|
12
|
+
* `AwsS3BucketFooBar`, and so do the `for_each` keys `a-b` and `a_b`. Every
|
|
13
|
+
* caller derives the ID from the address alone, so a suffix here would have to
|
|
14
|
+
* be agreed between them. The template builder refuses a plan where two
|
|
15
|
+
* addresses collide instead, because the alternative is one Resource silently
|
|
16
|
+
* standing for two.
|
|
17
|
+
*/
|
|
18
|
+
export declare function terraformLogicalId(address: string): string;
|
|
19
|
+
/**
|
|
20
|
+
* Resolves a Terraform reference against the resources of one plan.
|
|
21
|
+
*
|
|
22
|
+
* A reference is an address optionally followed by the attribute being read.
|
|
23
|
+
* Terraform lists both forms for the same reference, so the longest address
|
|
24
|
+
* matching a resource wins and what is left over is the attribute.
|
|
25
|
+
*/
|
|
26
|
+
export declare class TerraformReferenceResolver {
|
|
27
|
+
private readonly byAddress;
|
|
28
|
+
private readonly moduleOutputs;
|
|
29
|
+
constructor(resources: readonly TerraformResource[], moduleOutputs?: ReadonlyMap<string, TerraformModuleOutput>);
|
|
30
|
+
/**
|
|
31
|
+
* The CloudFormation value one reference stands for.
|
|
32
|
+
*
|
|
33
|
+
* A reference to a resource this plan does not hold returns undefined, and so
|
|
34
|
+
* does one whose attribute has no entry in the read table. The caller decides
|
|
35
|
+
* what an unresolvable reference means for the Resource holding it.
|
|
36
|
+
*/
|
|
37
|
+
resolve(reference: string, modulePath: readonly string[]): SimCfnTemplateValue | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* The address of the resource one reference names.
|
|
40
|
+
*
|
|
41
|
+
* A fold needs the resource a reference points at rather than the value read
|
|
42
|
+
* off it, because it is merging properties into that resource's template.
|
|
43
|
+
*/
|
|
44
|
+
targetAddress(reference: string, modulePath: readonly string[]): string | undefined;
|
|
45
|
+
/**
|
|
46
|
+
* The resource a module output leads to.
|
|
47
|
+
*
|
|
48
|
+
* The output's own expression names it, in terms of the module declaring the
|
|
49
|
+
* output, so following one is resolving that expression again one module
|
|
50
|
+
* down. An output built out of several resources returns the first that
|
|
51
|
+
* resolves, and the depth limit stops a module whose outputs refer to each
|
|
52
|
+
* other from looping.
|
|
53
|
+
*/
|
|
54
|
+
private throughModuleOutput;
|
|
55
|
+
/**
|
|
56
|
+
* The resource whose address is the longest prefix of this reference.
|
|
57
|
+
*
|
|
58
|
+
* `aws_iam_role.processor.arn` has to find `aws_iam_role.processor` and leave
|
|
59
|
+
* `arn` behind, and a `for_each` instance address carries a bracketed key
|
|
60
|
+
* that is part of the address rather than an attribute.
|
|
61
|
+
*/
|
|
62
|
+
private longestMatch;
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=sim-tf-reference.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-tf-reference.d.ts","sourceRoot":"","sources":["../../../../src/service/cloudformation/terraform/sim-tf-reference.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAC;AACvF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAQxE;;;;;;;;;;;;;GAaG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAQ1D;AAED;;;;;;GAMG;AACH,qBAAa,0BAA0B;IACrC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAyC;IACnE,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA6C;IAE3E,YACE,SAAS,EAAE,SAAS,iBAAiB,EAAE,EACvC,aAAa,GAAE,WAAW,CAAC,MAAM,EAAE,qBAAqB,CAAa,EAMtE;IAED;;;;;;OAMG;IACI,OAAO,CACZ,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,SAAS,MAAM,EAAE,GAC5B,mBAAmB,GAAG,SAAS,CA0BjC;IAED;;;;;OAKG;IACI,aAAa,CAClB,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,SAAS,MAAM,EAAE,GAC5B,MAAM,GAAG,SAAS,CAKpB;IAED;;;;;;;;OAQG;IACH,OAAO,CAAC,mBAAmB;IA0B3B;;;;;;OAMG;IACH,OAAO,CAAC,YAAY;CAerB"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { terraformAttributeReads } from "./sim-tf-attribute-reads.js";
|
|
2
|
+
import { longestFirst, moduleOutputAttribute, qualifiedReference, } from "./sim-tf-reference-address.js";
|
|
3
|
+
/**
|
|
4
|
+
* The CloudFormation logical ID standing for one Terraform address.
|
|
5
|
+
*
|
|
6
|
+
* A logical ID is alphanumeric, so the module path, the resource type, the name
|
|
7
|
+
* and any `count` or `for_each` key are folded into one camel-run.
|
|
8
|
+
*
|
|
9
|
+
* Folding loses the separators, and two addresses can therefore arrive at one
|
|
10
|
+
* ID. `aws_s3_bucket.foo_bar` and `aws_s3_bucket.fooBar` both give
|
|
11
|
+
* `AwsS3BucketFooBar`, and so do the `for_each` keys `a-b` and `a_b`. Every
|
|
12
|
+
* caller derives the ID from the address alone, so a suffix here would have to
|
|
13
|
+
* be agreed between them. The template builder refuses a plan where two
|
|
14
|
+
* addresses collide instead, because the alternative is one Resource silently
|
|
15
|
+
* standing for two.
|
|
16
|
+
*/
|
|
17
|
+
export function terraformLogicalId(address) {
|
|
18
|
+
const alphanumeric = address
|
|
19
|
+
.split(/[^A-Za-z0-9]+/)
|
|
20
|
+
.filter((part) => part.length > 0)
|
|
21
|
+
.map((part) => part.charAt(0).toUpperCase() + part.slice(1))
|
|
22
|
+
.join("");
|
|
23
|
+
return alphanumeric.length > 0 ? alphanumeric : "Resource";
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Resolves a Terraform reference against the resources of one plan.
|
|
27
|
+
*
|
|
28
|
+
* A reference is an address optionally followed by the attribute being read.
|
|
29
|
+
* Terraform lists both forms for the same reference, so the longest address
|
|
30
|
+
* matching a resource wins and what is left over is the attribute.
|
|
31
|
+
*/
|
|
32
|
+
export class TerraformReferenceResolver {
|
|
33
|
+
byAddress;
|
|
34
|
+
moduleOutputs;
|
|
35
|
+
constructor(resources, moduleOutputs = new Map()) {
|
|
36
|
+
this.byAddress = new Map(resources.map((resource) => [resource.address, resource]));
|
|
37
|
+
this.moduleOutputs = moduleOutputs;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* The CloudFormation value one reference stands for.
|
|
41
|
+
*
|
|
42
|
+
* A reference to a resource this plan does not hold returns undefined, and so
|
|
43
|
+
* does one whose attribute has no entry in the read table. The caller decides
|
|
44
|
+
* what an unresolvable reference means for the Resource holding it.
|
|
45
|
+
*/
|
|
46
|
+
resolve(reference, modulePath) {
|
|
47
|
+
const qualified = qualifiedReference(reference, modulePath);
|
|
48
|
+
const target = this.longestMatch(qualified) ?? this.throughModuleOutput(qualified);
|
|
49
|
+
if (target === undefined) {
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
const attribute = qualified.startsWith(`${target.address}.`)
|
|
53
|
+
? qualified.slice(target.address.length + 1)
|
|
54
|
+
: moduleOutputAttribute(qualified, this.moduleOutputs.get(qualified));
|
|
55
|
+
const read = attribute === ""
|
|
56
|
+
? "Ref"
|
|
57
|
+
: terraformAttributeReads.get(`${target.type}.${attribute}`);
|
|
58
|
+
if (read === undefined) {
|
|
59
|
+
return undefined;
|
|
60
|
+
}
|
|
61
|
+
const logicalId = terraformLogicalId(target.address);
|
|
62
|
+
return read === "Ref"
|
|
63
|
+
? { Ref: logicalId }
|
|
64
|
+
: { "Fn::GetAtt": [logicalId, read] };
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* The address of the resource one reference names.
|
|
68
|
+
*
|
|
69
|
+
* A fold needs the resource a reference points at rather than the value read
|
|
70
|
+
* off it, because it is merging properties into that resource's template.
|
|
71
|
+
*/
|
|
72
|
+
targetAddress(reference, modulePath) {
|
|
73
|
+
const qualified = qualifiedReference(reference, modulePath);
|
|
74
|
+
return (this.longestMatch(qualified) ?? this.throughModuleOutput(qualified))
|
|
75
|
+
?.address;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* The resource a module output leads to.
|
|
79
|
+
*
|
|
80
|
+
* The output's own expression names it, in terms of the module declaring the
|
|
81
|
+
* output, so following one is resolving that expression again one module
|
|
82
|
+
* down. An output built out of several resources returns the first that
|
|
83
|
+
* resolves, and the depth limit stops a module whose outputs refer to each
|
|
84
|
+
* other from looping.
|
|
85
|
+
*/
|
|
86
|
+
throughModuleOutput(qualified, depth = 0) {
|
|
87
|
+
const output = this.moduleOutputs.get(qualified);
|
|
88
|
+
if (output === undefined || depth > 8) {
|
|
89
|
+
return undefined;
|
|
90
|
+
}
|
|
91
|
+
const references = longestFirst(output.references);
|
|
92
|
+
for (const reference of references) {
|
|
93
|
+
const nested = qualifiedReference(reference, output.modulePath);
|
|
94
|
+
const target = this.longestMatch(nested) ??
|
|
95
|
+
this.throughModuleOutput(nested, depth + 1);
|
|
96
|
+
if (target !== undefined) {
|
|
97
|
+
return target;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return undefined;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* The resource whose address is the longest prefix of this reference.
|
|
104
|
+
*
|
|
105
|
+
* `aws_iam_role.processor.arn` has to find `aws_iam_role.processor` and leave
|
|
106
|
+
* `arn` behind, and a `for_each` instance address carries a bracketed key
|
|
107
|
+
* that is part of the address rather than an attribute.
|
|
108
|
+
*/
|
|
109
|
+
longestMatch(qualified) {
|
|
110
|
+
let best;
|
|
111
|
+
for (const [address, resource] of this.byAddress) {
|
|
112
|
+
if (qualified !== address && !qualified.startsWith(`${address}.`)) {
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
if (best === undefined || address.length > best.address.length) {
|
|
116
|
+
best = resource;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return best;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=sim-tf-reference.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-tf-reference.js","sourceRoot":"","sources":["../../../../src/service/cloudformation/terraform/sim-tf-reference.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EACL,YAAY,EACZ,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,+BAA+B,CAAC;AAEvC;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAAe;IAChD,MAAM,YAAY,GAAG,OAAO;SACzB,KAAK,CAAC,eAAe,CAAC;SACtB,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;SACjC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;SAC3D,IAAI,CAAC,EAAE,CAAC,CAAC;IAEZ,OAAO,YAAY,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,UAAU,CAAC;AAC7D,CAAC;AAED;;;;;;GAMG;AACH,MAAM,OAAO,0BAA0B;IACpB,SAAS,CAAyC;IAClD,aAAa,CAA6C;IAE3E,YACE,SAAuC,EACvC,aAAa,GAA+C,IAAI,GAAG,EAAE;QAErE,IAAI,CAAC,SAAS,GAAG,IAAI,GAAG,CACtB,SAAS,CAAC,GAAG,CAAC,CA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C;YAED,IAAI,IAAI,KAAK,SAAS,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;gBAC/D,IAAI,GAAG,QAAQ,CAAC;YAClB,CAAC;QACH,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { TerraformResourceFold, TerraformResourceMapping } from "./sim-tf-mapping.type.js";
|
|
2
|
+
/**
|
|
3
|
+
* The Terraform resource types this import turns into CloudFormation Resources.
|
|
4
|
+
*
|
|
5
|
+
* A type with no entry is recorded as skipped, which is what the stack already
|
|
6
|
+
* does with a CloudFormation Resource type no simulated service models.
|
|
7
|
+
*/
|
|
8
|
+
export declare const terraformResourceMappings: ReadonlyMap<string, TerraformResourceMapping>;
|
|
9
|
+
/**
|
|
10
|
+
* The Terraform resource types that configure another resource rather than
|
|
11
|
+
* creating one of their own.
|
|
12
|
+
*/
|
|
13
|
+
export declare const terraformResourceFolds: ReadonlyMap<string, TerraformResourceFold>;
|
|
14
|
+
//# sourceMappingURL=sim-tf-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-tf-registry.d.ts","sourceRoot":"","sources":["../../../../src/service/cloudformation/terraform/sim-tf-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,wBAAwB,EACzB,MAAM,0BAA0B,CAAC;AAwBlC;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,EAAE,WAAW,CACjD,MAAM,EACN,wBAAwB,CAkBxB,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,sBAAsB,EAAE,WAAW,CAC9C,MAAM,EACN,qBAAqB,CACiD,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { dynamodbTable } from "./sim-tf-map-dynamodb.js";
|
|
2
|
+
import { s3Bucket } from "./sim-tf-map-s3.js";
|
|
3
|
+
import { s3BucketFolds } from "./sim-tf-map-s3-folds.js";
|
|
4
|
+
import { sqsQueue } from "./sim-tf-map-sqs.js";
|
|
5
|
+
import { iamRole, iamRoleFolds, logGroup } from "./sim-tf-map-iam.js";
|
|
6
|
+
import { lambdaEventSourceMapping, lambdaFunction, lambdaPermission, } from "./sim-tf-map-lambda.js";
|
|
7
|
+
import { httpApi, httpApiIntegration, httpApiStage, } from "./sim-tf-map-http-api.js";
|
|
8
|
+
import { httpApiRoute } from "./sim-tf-map-http-api-route.js";
|
|
9
|
+
import { snsSubscription, snsTopic } from "./sim-tf-map-sns.js";
|
|
10
|
+
import { secretsManagerFolds, secretsManagerSecret, ssmParameter, } from "./sim-tf-map-config.js";
|
|
11
|
+
/**
|
|
12
|
+
* The Terraform resource types this import turns into CloudFormation Resources.
|
|
13
|
+
*
|
|
14
|
+
* A type with no entry is recorded as skipped, which is what the stack already
|
|
15
|
+
* does with a CloudFormation Resource type no simulated service models.
|
|
16
|
+
*/
|
|
17
|
+
export const terraformResourceMappings = new Map([
|
|
18
|
+
["aws_s3_bucket", s3Bucket],
|
|
19
|
+
["aws_dynamodb_table", dynamodbTable],
|
|
20
|
+
["aws_sqs_queue", sqsQueue],
|
|
21
|
+
["aws_sns_topic", snsTopic],
|
|
22
|
+
["aws_sns_topic_subscription", snsSubscription],
|
|
23
|
+
["aws_lambda_function", lambdaFunction],
|
|
24
|
+
["aws_lambda_permission", lambdaPermission],
|
|
25
|
+
["aws_lambda_event_source_mapping", lambdaEventSourceMapping],
|
|
26
|
+
["aws_iam_role", iamRole],
|
|
27
|
+
["aws_cloudwatch_log_group", logGroup],
|
|
28
|
+
["aws_apigatewayv2_api", httpApi],
|
|
29
|
+
["aws_apigatewayv2_integration", httpApiIntegration],
|
|
30
|
+
["aws_apigatewayv2_route", httpApiRoute],
|
|
31
|
+
["aws_apigatewayv2_stage", httpApiStage],
|
|
32
|
+
["aws_ssm_parameter", ssmParameter],
|
|
33
|
+
["aws_secretsmanager_secret", secretsManagerSecret],
|
|
34
|
+
]);
|
|
35
|
+
/**
|
|
36
|
+
* The Terraform resource types that configure another resource rather than
|
|
37
|
+
* creating one of their own.
|
|
38
|
+
*/
|
|
39
|
+
export const terraformResourceFolds = new Map([...s3BucketFolds, ...iamRoleFolds, ...secretsManagerFolds]);
|
|
40
|
+
//# sourceMappingURL=sim-tf-registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-tf-registry.js","sourceRoot":"","sources":["../../../../src/service/cloudformation/terraform/sim-tf-registry.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,EACL,wBAAwB,EACxB,cAAc,EACd,gBAAgB,GACjB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,OAAO,EACP,kBAAkB,EAClB,YAAY,GACb,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EACL,mBAAmB,EACnB,oBAAoB,EACpB,YAAY,GACb,MAAM,wBAAwB,CAAC;AAEhC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAGlC,IAAI,GAAG,CAAC;IACV,CAAC,eAAe,EAAE,QAAQ,CAAC;IAC3B,CAAC,oBAAoB,EAAE,aAAa,CAAC;IACrC,CAAC,eAAe,EAAE,QAAQ,CAAC;IAC3B,CAAC,eAAe,EAAE,QAAQ,CAAC;IAC3B,CAAC,4BAA4B,EAAE,eA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