@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.
Files changed (166) hide show
  1. package/dist/service/cloudformation/deploy/sim-cfn-cdk-out-deployer.d.ts +2 -2
  2. package/dist/service/cloudformation/deploy/sim-cfn-cdk-out-deployer.d.ts.map +1 -1
  3. package/dist/service/cloudformation/deploy/sim-cfn-cdk-out-deployer.js.map +1 -1
  4. package/dist/service/cloudformation/deploy/sim-cfn-cdk-out-stack-options.d.ts +3 -3
  5. package/dist/service/cloudformation/deploy/sim-cfn-cdk-out-stack-options.d.ts.map +1 -1
  6. package/dist/service/cloudformation/deploy/sim-cfn-cdk-out-stack-options.js.map +1 -1
  7. package/dist/service/cloudformation/deploy/sim-cfn-template-deployer.d.ts +5 -4
  8. package/dist/service/cloudformation/deploy/sim-cfn-template-deployer.d.ts.map +1 -1
  9. package/dist/service/cloudformation/deploy/sim-cfn-template-deployer.js.map +1 -1
  10. package/dist/service/cloudformation/index.d.ts +7 -0
  11. package/dist/service/cloudformation/index.d.ts.map +1 -1
  12. package/dist/service/cloudformation/resource/sim-cfn-deployed-resource.type.d.ts +59 -0
  13. package/dist/service/cloudformation/resource/sim-cfn-deployed-resource.type.d.ts.map +1 -0
  14. package/dist/service/cloudformation/resource/sim-cfn-deployed-resource.type.js +2 -0
  15. package/dist/service/cloudformation/resource/sim-cfn-deployed-resource.type.js.map +1 -0
  16. package/dist/service/cloudformation/sim-cloudformation.d.ts +8 -9
  17. package/dist/service/cloudformation/sim-cloudformation.d.ts.map +1 -1
  18. package/dist/service/cloudformation/sim-cloudformation.js +1 -3
  19. package/dist/service/cloudformation/sim-cloudformation.js.map +1 -1
  20. package/dist/service/cloudformation/stack/sim-cfn-deployed-stack.type.d.ts +68 -0
  21. package/dist/service/cloudformation/stack/sim-cfn-deployed-stack.type.d.ts.map +1 -0
  22. package/dist/service/cloudformation/stack/sim-cfn-deployed-stack.type.js +2 -0
  23. package/dist/service/cloudformation/stack/sim-cfn-deployed-stack.type.js.map +1 -0
  24. package/dist/service/cloudformation/stack/sim-cfn-stack.d.ts +2 -1
  25. package/dist/service/cloudformation/stack/sim-cfn-stack.d.ts.map +1 -1
  26. package/dist/service/cloudformation/stack/sim-cfn-stack.fixture.d.ts +21 -0
  27. package/dist/service/cloudformation/stack/sim-cfn-stack.fixture.d.ts.map +1 -0
  28. package/dist/service/cloudformation/stack/sim-cfn-stack.fixture.js +21 -0
  29. package/dist/service/cloudformation/stack/sim-cfn-stack.fixture.js.map +1 -0
  30. package/dist/service/cloudformation/stack/sim-cfn-stack.js.map +1 -1
  31. package/dist/service/cloudformation/terraform/sim-tf-attribute-reads.d.ts +12 -0
  32. package/dist/service/cloudformation/terraform/sim-tf-attribute-reads.d.ts.map +1 -0
  33. package/dist/service/cloudformation/terraform/sim-tf-attribute-reads.js +60 -0
  34. package/dist/service/cloudformation/terraform/sim-tf-attribute-reads.js.map +1 -0
  35. package/dist/service/cloudformation/terraform/sim-tf-attributes.d.ts +60 -0
  36. package/dist/service/cloudformation/terraform/sim-tf-attributes.d.ts.map +1 -0
  37. package/dist/service/cloudformation/terraform/sim-tf-attributes.js +121 -0
  38. package/dist/service/cloudformation/terraform/sim-tf-attributes.js.map +1 -0
  39. package/dist/service/cloudformation/terraform/sim-tf-map-config.d.ts +14 -0
  40. package/dist/service/cloudformation/terraform/sim-tf-map-config.d.ts.map +1 -0
  41. package/dist/service/cloudformation/terraform/sim-tf-map-config.js +36 -0
  42. package/dist/service/cloudformation/terraform/sim-tf-map-config.js.map +1 -0
  43. package/dist/service/cloudformation/terraform/sim-tf-map-dynamodb.d.ts +15 -0
  44. package/dist/service/cloudformation/terraform/sim-tf-map-dynamodb.d.ts.map +1 -0
  45. package/dist/service/cloudformation/terraform/sim-tf-map-dynamodb.js +74 -0
  46. package/dist/service/cloudformation/terraform/sim-tf-map-dynamodb.js.map +1 -0
  47. package/dist/service/cloudformation/terraform/sim-tf-map-http-api-route.d.ts +5 -0
  48. package/dist/service/cloudformation/terraform/sim-tf-map-http-api-route.d.ts.map +1 -0
  49. package/dist/service/cloudformation/terraform/sim-tf-map-http-api-route.js +32 -0
  50. package/dist/service/cloudformation/terraform/sim-tf-map-http-api-route.js.map +1 -0
  51. package/dist/service/cloudformation/terraform/sim-tf-map-http-api.d.ts +12 -0
  52. package/dist/service/cloudformation/terraform/sim-tf-map-http-api.d.ts.map +1 -0
  53. package/dist/service/cloudformation/terraform/sim-tf-map-http-api.js +52 -0
  54. package/dist/service/cloudformation/terraform/sim-tf-map-http-api.js.map +1 -0
  55. package/dist/service/cloudformation/terraform/sim-tf-map-iam.d.ts +9 -0
  56. package/dist/service/cloudformation/terraform/sim-tf-map-iam.d.ts.map +1 -0
  57. package/dist/service/cloudformation/terraform/sim-tf-map-iam.js +80 -0
  58. package/dist/service/cloudformation/terraform/sim-tf-map-iam.js.map +1 -0
  59. package/dist/service/cloudformation/terraform/sim-tf-map-lambda.d.ts +19 -0
  60. package/dist/service/cloudformation/terraform/sim-tf-map-lambda.d.ts.map +1 -0
  61. package/dist/service/cloudformation/terraform/sim-tf-map-lambda.js +90 -0
  62. package/dist/service/cloudformation/terraform/sim-tf-map-lambda.js.map +1 -0
  63. package/dist/service/cloudformation/terraform/sim-tf-map-s3-cors.d.ts +5 -0
  64. package/dist/service/cloudformation/terraform/sim-tf-map-s3-cors.d.ts.map +1 -0
  65. package/dist/service/cloudformation/terraform/sim-tf-map-s3-cors.js +12 -0
  66. package/dist/service/cloudformation/terraform/sim-tf-map-s3-cors.js.map +1 -0
  67. package/dist/service/cloudformation/terraform/sim-tf-map-s3-encryption.d.ts +5 -0
  68. package/dist/service/cloudformation/terraform/sim-tf-map-s3-encryption.d.ts.map +1 -0
  69. package/dist/service/cloudformation/terraform/sim-tf-map-s3-encryption.js +32 -0
  70. package/dist/service/cloudformation/terraform/sim-tf-map-s3-encryption.js.map +1 -0
  71. package/dist/service/cloudformation/terraform/sim-tf-map-s3-folds.d.ts +9 -0
  72. package/dist/service/cloudformation/terraform/sim-tf-map-s3-folds.d.ts.map +1 -0
  73. package/dist/service/cloudformation/terraform/sim-tf-map-s3-folds.js +48 -0
  74. package/dist/service/cloudformation/terraform/sim-tf-map-s3-folds.js.map +1 -0
  75. package/dist/service/cloudformation/terraform/sim-tf-map-s3.d.ts +5 -0
  76. package/dist/service/cloudformation/terraform/sim-tf-map-s3.d.ts.map +1 -0
  77. package/dist/service/cloudformation/terraform/sim-tf-map-s3.js +18 -0
  78. package/dist/service/cloudformation/terraform/sim-tf-map-s3.js.map +1 -0
  79. package/dist/service/cloudformation/terraform/sim-tf-map-sns.d.ts +15 -0
  80. package/dist/service/cloudformation/terraform/sim-tf-map-sns.d.ts.map +1 -0
  81. package/dist/service/cloudformation/terraform/sim-tf-map-sns.js +40 -0
  82. package/dist/service/cloudformation/terraform/sim-tf-map-sns.js.map +1 -0
  83. package/dist/service/cloudformation/terraform/sim-tf-map-sqs.d.ts +5 -0
  84. package/dist/service/cloudformation/terraform/sim-tf-map-sqs.d.ts.map +1 -0
  85. package/dist/service/cloudformation/terraform/sim-tf-map-sqs.js +56 -0
  86. package/dist/service/cloudformation/terraform/sim-tf-map-sqs.js.map +1 -0
  87. package/dist/service/cloudformation/terraform/sim-tf-mapping.type.d.ts +41 -0
  88. package/dist/service/cloudformation/terraform/sim-tf-mapping.type.d.ts.map +1 -0
  89. package/dist/service/cloudformation/terraform/sim-tf-mapping.type.js +2 -0
  90. package/dist/service/cloudformation/terraform/sim-tf-mapping.type.js.map +1 -0
  91. package/dist/service/cloudformation/terraform/sim-tf-module-outputs.d.ts +19 -0
  92. package/dist/service/cloudformation/terraform/sim-tf-module-outputs.d.ts.map +1 -0
  93. package/dist/service/cloudformation/terraform/sim-tf-module-outputs.js +63 -0
  94. package/dist/service/cloudformation/terraform/sim-tf-module-outputs.js.map +1 -0
  95. package/dist/service/cloudformation/terraform/sim-tf-plan-index.d.ts +26 -0
  96. package/dist/service/cloudformation/terraform/sim-tf-plan-index.d.ts.map +1 -0
  97. package/dist/service/cloudformation/terraform/sim-tf-plan-index.js +45 -0
  98. package/dist/service/cloudformation/terraform/sim-tf-plan-index.js.map +1 -0
  99. package/dist/service/cloudformation/terraform/sim-tf-plan-resources.d.ts +39 -0
  100. package/dist/service/cloudformation/terraform/sim-tf-plan-resources.d.ts.map +1 -0
  101. package/dist/service/cloudformation/terraform/sim-tf-plan-resources.js +44 -0
  102. package/dist/service/cloudformation/terraform/sim-tf-plan-resources.js.map +1 -0
  103. package/dist/service/cloudformation/terraform/sim-tf-plan.type.d.ts +94 -0
  104. package/dist/service/cloudformation/terraform/sim-tf-plan.type.d.ts.map +1 -0
  105. package/dist/service/cloudformation/terraform/sim-tf-plan.type.js +2 -0
  106. package/dist/service/cloudformation/terraform/sim-tf-plan.type.js.map +1 -0
  107. package/dist/service/cloudformation/terraform/sim-tf-reference-address.d.ts +27 -0
  108. package/dist/service/cloudformation/terraform/sim-tf-reference-address.d.ts.map +1 -0
  109. package/dist/service/cloudformation/terraform/sim-tf-reference-address.js +58 -0
  110. package/dist/service/cloudformation/terraform/sim-tf-reference-address.js.map +1 -0
  111. package/dist/service/cloudformation/terraform/sim-tf-reference.d.ts +64 -0
  112. package/dist/service/cloudformation/terraform/sim-tf-reference.d.ts.map +1 -0
  113. package/dist/service/cloudformation/terraform/sim-tf-reference.js +122 -0
  114. package/dist/service/cloudformation/terraform/sim-tf-reference.js.map +1 -0
  115. package/dist/service/cloudformation/terraform/sim-tf-registry.d.ts +14 -0
  116. package/dist/service/cloudformation/terraform/sim-tf-registry.d.ts.map +1 -0
  117. package/dist/service/cloudformation/terraform/sim-tf-registry.js +40 -0
  118. package/dist/service/cloudformation/terraform/sim-tf-registry.js.map +1 -0
  119. package/dist/service/cloudformation/terraform/sim-tf-report.type.d.ts +31 -0
  120. package/dist/service/cloudformation/terraform/sim-tf-report.type.d.ts.map +1 -0
  121. package/dist/service/cloudformation/terraform/sim-tf-report.type.js +2 -0
  122. package/dist/service/cloudformation/terraform/sim-tf-report.type.js.map +1 -0
  123. package/dist/service/cloudformation/terraform/sim-tf-template-folds.d.ts +20 -0
  124. package/dist/service/cloudformation/terraform/sim-tf-template-folds.d.ts.map +1 -0
  125. package/dist/service/cloudformation/terraform/sim-tf-template-folds.js +28 -0
  126. package/dist/service/cloudformation/terraform/sim-tf-template-folds.js.map +1 -0
  127. package/dist/service/cloudformation/terraform/sim-tf-template-graph.d.ts +29 -0
  128. package/dist/service/cloudformation/terraform/sim-tf-template-graph.d.ts.map +1 -0
  129. package/dist/service/cloudformation/terraform/sim-tf-template-graph.js +71 -0
  130. package/dist/service/cloudformation/terraform/sim-tf-template-graph.js.map +1 -0
  131. package/dist/service/cloudformation/terraform/sim-tf-template-mappings.d.ts +23 -0
  132. package/dist/service/cloudformation/terraform/sim-tf-template-mappings.d.ts.map +1 -0
  133. package/dist/service/cloudformation/terraform/sim-tf-template-mappings.js +72 -0
  134. package/dist/service/cloudformation/terraform/sim-tf-template-mappings.js.map +1 -0
  135. package/dist/service/cloudformation/terraform/sim-tf-template-merge.d.ts +21 -0
  136. package/dist/service/cloudformation/terraform/sim-tf-template-merge.d.ts.map +1 -0
  137. package/dist/service/cloudformation/terraform/sim-tf-template-merge.js +33 -0
  138. package/dist/service/cloudformation/terraform/sim-tf-template-merge.js.map +1 -0
  139. package/dist/service/cloudformation/terraform/sim-tf-template-prune.d.ts +21 -0
  140. package/dist/service/cloudformation/terraform/sim-tf-template-prune.d.ts.map +1 -0
  141. package/dist/service/cloudformation/terraform/sim-tf-template-prune.js +51 -0
  142. package/dist/service/cloudformation/terraform/sim-tf-template-prune.js.map +1 -0
  143. package/dist/service/cloudformation/terraform/sim-tf-template-pruned.d.ts +18 -0
  144. package/dist/service/cloudformation/terraform/sim-tf-template-pruned.d.ts.map +1 -0
  145. package/dist/service/cloudformation/terraform/sim-tf-template-pruned.js +23 -0
  146. package/dist/service/cloudformation/terraform/sim-tf-template-pruned.js.map +1 -0
  147. package/dist/service/cloudformation/terraform/sim-tf-template-references.d.ts +10 -0
  148. package/dist/service/cloudformation/terraform/sim-tf-template-references.d.ts.map +1 -0
  149. package/dist/service/cloudformation/terraform/sim-tf-template-references.js +39 -0
  150. package/dist/service/cloudformation/terraform/sim-tf-template-references.js.map +1 -0
  151. package/dist/service/cloudformation/terraform/sim-tf-template-resolver.d.ts +12 -0
  152. package/dist/service/cloudformation/terraform/sim-tf-template-resolver.d.ts.map +1 -0
  153. package/dist/service/cloudformation/terraform/sim-tf-template-resolver.js +17 -0
  154. package/dist/service/cloudformation/terraform/sim-tf-template-resolver.js.map +1 -0
  155. package/dist/service/cloudformation/terraform/sim-tf-template.d.ts +26 -0
  156. package/dist/service/cloudformation/terraform/sim-tf-template.d.ts.map +1 -0
  157. package/dist/service/cloudformation/terraform/sim-tf-template.js +54 -0
  158. package/dist/service/cloudformation/terraform/sim-tf-template.js.map +1 -0
  159. package/dist/service/elbv2/cfn/sim-cfn-elbv2.fixture.d.ts +2 -2
  160. package/dist/service/elbv2/cfn/sim-cfn-elbv2.fixture.d.ts.map +1 -1
  161. package/dist/service/elbv2/cfn/sim-cfn-elbv2.fixture.js.map +1 -1
  162. package/dist/util/filesystem/test-terraform-project.d.ts +56 -0
  163. package/dist/util/filesystem/test-terraform-project.d.ts.map +1 -0
  164. package/dist/util/filesystem/test-terraform-project.js +83 -0
  165. package/dist/util/filesystem/test-terraform-project.js.map +1 -0
  166. package/package.json +3 -2
@@ -0,0 +1,31 @@
1
+ /**
2
+ * What one import of a plan did with every resource in it.
3
+ *
4
+ * A resource is mapped, folded into another resource, or skipped. The three
5
+ * add up to the plan's managed resource count, which is what makes the
6
+ * mapped fraction a fraction of something.
7
+ */
8
+ export interface TerraformImportReport {
9
+ readonly total: number;
10
+ readonly mapped: readonly TerraformImportedResource[];
11
+ readonly folded: readonly TerraformImportedResource[];
12
+ readonly skipped: readonly TerraformSkippedResource[];
13
+ /** Attributes a mapping could not carry across, named per resource. */
14
+ readonly lost: readonly TerraformLostAttribute[];
15
+ }
16
+ export interface TerraformImportedResource {
17
+ readonly address: string;
18
+ readonly type: string;
19
+ readonly cfnType?: string;
20
+ }
21
+ export interface TerraformSkippedResource {
22
+ readonly address: string;
23
+ readonly type: string;
24
+ readonly reason: TerraformSkipReason;
25
+ }
26
+ export type TerraformSkipReason = "no mapping for resource type" | "not an AWS provider resource" | "fold target not found" | "unresolved required attribute" | "references a resource that was skipped";
27
+ export interface TerraformLostAttribute {
28
+ readonly address: string;
29
+ readonly attribute: string;
30
+ }
31
+ //# sourceMappingURL=sim-tf-report.type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sim-tf-report.type.d.ts","sourceRoot":"","sources":["../../../../src/service/cloudformation/terraform/sim-tf-report.type.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,SAAS,yBAAyB,EAAE,CAAC;IACtD,QAAQ,CAAC,MAAM,EAAE,SAAS,yBAAyB,EAAE,CAAC;IACtD,QAAQ,CAAC,OAAO,EAAE,SAAS,wBAAwB,EAAE,CAAC;IACtD,uEAAuE;IACvE,QAAQ,CAAC,IAAI,EAAE,SAAS,sBAAsB,EAAE,CAAC;CAClD;AAED,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,mBAAmB,CAAC;CACtC;AAED,MAAM,MAAM,mBAAmB,GAC3B,8BAA8B,GAC9B,8BAA8B,GAC9B,uBAAuB,GACvB,+BAA+B,GAC/B,wCAAwC,CAAC;AAE7C,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=sim-tf-report.type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sim-tf-report.type.js","sourceRoot":"","sources":["../../../../src/service/cloudformation/terraform/sim-tf-report.type.ts"],"names":[],"mappings":""}
@@ -0,0 +1,20 @@
1
+ import type { SimCfnTemplateValueRecord } from "../template/value/sim-cfn-template-value.js";
2
+ import type { TerraformResource } from "./sim-tf-plan-resources.js";
3
+ import type { TerraformReferenceResolver } from "./sim-tf-reference.js";
4
+ import type { TerraformImportedResource, TerraformSkippedResource } from "./sim-tf-report.type.js";
5
+ export interface TerraformFoldPass {
6
+ readonly resources: readonly TerraformResource[];
7
+ readonly resolver: TerraformReferenceResolver;
8
+ readonly templates: Map<string, SimCfnTemplateValueRecord>;
9
+ readonly folded: TerraformImportedResource[];
10
+ readonly skipped: TerraformSkippedResource[];
11
+ }
12
+ /**
13
+ * Merge every folding resource into the Resource it configures.
14
+ *
15
+ * This runs after the mapping pass, because a fold has nothing to merge into
16
+ * until its parent is in the template. A fold whose parent was skipped is
17
+ * recorded rather than dropped, so the report still adds up.
18
+ */
19
+ export declare function applyFolds(pass: TerraformFoldPass): void;
20
+ //# sourceMappingURL=sim-tf-template-folds.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sim-tf-template-folds.d.ts","sourceRoot":"","sources":["../../../../src/service/cloudformation/terraform/sim-tf-template-folds.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,6CAA6C,CAAC;AAC7F,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AAIxE,OAAO,KAAK,EACV,yBAAyB,EACzB,wBAAwB,EACzB,MAAM,yBAAyB,CAAC;AAEjC,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,SAAS,EAAE,SAAS,iBAAiB,EAAE,CAAC;IACjD,QAAQ,CAAC,QAAQ,EAAE,0BAA0B,CAAC;IAC9C,QAAQ,CAAC,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,yBAAyB,CAAC,CAAC;IAC3D,QAAQ,CAAC,MAAM,EAAE,yBAAyB,EAAE,CAAC;IAC7C,QAAQ,CAAC,OAAO,EAAE,wBAAwB,EAAE,CAAC;CAC9C;AAID;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,iBAAiB,GAAG,IAAI,CA8BxD"}
@@ -0,0 +1,28 @@
1
+ import { terraformResourceFolds } from "./sim-tf-registry.js";
2
+ import { foldTargetLogicalId } from "./sim-tf-template-graph.js";
3
+ import { mergedParent, skip } from "./sim-tf-template-merge.js";
4
+ const awsProvider = "hashicorp/aws";
5
+ /**
6
+ * Merge every folding resource into the Resource it configures.
7
+ *
8
+ * This runs after the mapping pass, because a fold has nothing to merge into
9
+ * until its parent is in the template. A fold whose parent was skipped is
10
+ * recorded rather than dropped, so the report still adds up.
11
+ */
12
+ export function applyFolds(pass) {
13
+ for (const resource of pass.resources) {
14
+ const fold = terraformResourceFolds.get(resource.type);
15
+ if (fold === undefined || resource.provider !== awsProvider) {
16
+ continue;
17
+ }
18
+ const parentId = foldTargetLogicalId(resource, fold.parentAttribute, pass.resolver);
19
+ const parent = parentId === undefined ? undefined : pass.templates.get(parentId);
20
+ if (parent === undefined || parentId === undefined) {
21
+ pass.skipped.push(skip(resource, "fold target not found"));
22
+ continue;
23
+ }
24
+ pass.templates.set(parentId, mergedParent(parent, fold.properties({ resource, resolver: pass.resolver })));
25
+ pass.folded.push({ address: resource.address, type: resource.type });
26
+ }
27
+ }
28
+ //# sourceMappingURL=sim-tf-template-folds.js.map
@@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;QACF,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,OAAO,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;IACvE,CAAC;AACH,CAAC"}
@@ -0,0 +1,29 @@
1
+ import type { TerraformResource } from "./sim-tf-plan-resources.js";
2
+ import { type TerraformReferenceResolver } from "./sim-tf-reference.js";
3
+ /**
4
+ * The logical ID of the resource a fold belongs to.
5
+ *
6
+ * The fold's parent attribute holds a reference rather than a value, because a
7
+ * bucket or a role being created by the same plan has no name until it exists.
8
+ * The reference names the resource directly, which is what a fold needs.
9
+ */
10
+ export declare function foldTargetLogicalId(resource: TerraformResource, parentAttribute: string, resolver: TerraformReferenceResolver): string | undefined;
11
+ /**
12
+ * The Resources one Resource has to be created after.
13
+ *
14
+ * A CloudFormation template orders itself, because a property that needs
15
+ * another Resource holds a `Ref` or an `Fn::GetAtt` naming it. A plan holds no
16
+ * such thing. Terraform resolves what it can before writing the plan, so a
17
+ * Lambda permission naming a function it creates in the same plan carries the
18
+ * function's name as a plain string, and the edge that ordering depends on is
19
+ * gone from the value.
20
+ *
21
+ * The edge survives in `configuration`, which records every reference the
22
+ * resource declares whether or not the value was resolved. Turning those back
23
+ * into `DependsOn` gives the Stack the graph it would have read off a template
24
+ * written by hand.
25
+ */
26
+ export declare function dependsOn(resource: TerraformResource, resolver: TerraformReferenceResolver): {
27
+ DependsOn?: string[];
28
+ };
29
+ //# sourceMappingURL=sim-tf-template-graph.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sim-tf-template-graph.d.ts","sourceRoot":"","sources":["../../../../src/service/cloudformation/terraform/sim-tf-template-graph.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EACL,KAAK,0BAA0B,EAEhC,MAAM,uBAAuB,CAAC;AAG/B;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,iBAAiB,EAC3B,eAAe,EAAE,MAAM,EACvB,QAAQ,EAAE,0BAA0B,GACnC,MAAM,GAAG,SAAS,CAoBpB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,SAAS,CACvB,QAAQ,EAAE,iBAAiB,EAC3B,QAAQ,EAAE,0BAA0B,GACnC;IAAE,SAAS,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,CAe1B"}
@@ -0,0 +1,71 @@
1
+ /*
2
+ * Reading a plan means reading records whose keys come from the document
3
+ * rather than from this code, so the object-injection rule fires on every
4
+ * lookup. The records are parsed JSON with no prototype of their own.
5
+ */
6
+ // oxlint-disable security/detect-object-injection
7
+ import { isRecord } from "../../../util/type-guard/record.js";
8
+ import { terraformLogicalId, } from "./sim-tf-reference.js";
9
+ import { longestFirst } from "./sim-tf-reference-address.js";
10
+ /**
11
+ * The logical ID of the resource a fold belongs to.
12
+ *
13
+ * The fold's parent attribute holds a reference rather than a value, because a
14
+ * bucket or a role being created by the same plan has no name until it exists.
15
+ * The reference names the resource directly, which is what a fold needs.
16
+ */
17
+ export function foldTargetLogicalId(resource, parentAttribute, resolver) {
18
+ const expression = resource.expressions[parentAttribute];
19
+ if (!isRecord(expression)) {
20
+ return undefined;
21
+ }
22
+ const references = longestFirst(expression.references ?? []);
23
+ for (const reference of references) {
24
+ const address = resolver.targetAddress(reference, resource.modulePath);
25
+ if (address !== undefined) {
26
+ return terraformLogicalId(address);
27
+ }
28
+ }
29
+ return undefined;
30
+ }
31
+ /**
32
+ * The Resources one Resource has to be created after.
33
+ *
34
+ * A CloudFormation template orders itself, because a property that needs
35
+ * another Resource holds a `Ref` or an `Fn::GetAtt` naming it. A plan holds no
36
+ * such thing. Terraform resolves what it can before writing the plan, so a
37
+ * Lambda permission naming a function it creates in the same plan carries the
38
+ * function's name as a plain string, and the edge that ordering depends on is
39
+ * gone from the value.
40
+ *
41
+ * The edge survives in `configuration`, which records every reference the
42
+ * resource declares whether or not the value was resolved. Turning those back
43
+ * into `DependsOn` gives the Stack the graph it would have read off a template
44
+ * written by hand.
45
+ */
46
+ export function dependsOn(resource, resolver) {
47
+ const own = terraformLogicalId(resource.address);
48
+ const referenced = [
49
+ ...resource.dependsOn,
50
+ ...expressionReferences(resource.expressions),
51
+ ]
52
+ .map((reference) => resolver.targetAddress(reference, resource.modulePath))
53
+ .filter((address) => address !== undefined)
54
+ .map((address) => terraformLogicalId(address))
55
+ .filter((logicalId) => logicalId !== own);
56
+ const declared = [...new Set(referenced)];
57
+ return declared.length === 0 ? {} : { DependsOn: declared };
58
+ }
59
+ /** Every `references` entry anywhere inside a resource's expressions. */
60
+ function expressionReferences(value) {
61
+ if (Array.isArray(value)) {
62
+ return value.flatMap((entry) => expressionReferences(entry));
63
+ }
64
+ if (!isRecord(value)) {
65
+ return [];
66
+ }
67
+ return Object.entries(value).flatMap(([key, nested]) => key === "references" && Array.isArray(nested)
68
+ ? nested.filter((entry) => typeof entry === "string")
69
+ : expressionReferences(nested));
70
+ }
71
+ //# sourceMappingURL=sim-tf-template-graph.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sim-tf-template-graph.js","sourceRoot":"","sources":["../../../../src/service/cloudformation/terraform/sim-tf-template-graph.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,kDAAkD;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAG9D,OAAO,EAEL,kBAAkB,GACnB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAE7D;;;;;;GAMG;AACH,MAAM,UAAU,mBAAmB,CACjC,QAA2B,EAC3B,eAAuB,EACvB,QAAoC;IAEpC,MAAM,UAAU,GAAG,QAAQ,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC;IAEzD,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;QAC1B,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM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Ac;IAC1C,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,KAAK,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,oBAAoB,CAAC,KAAK,CAAC,CAAC,CAAC;IAC/D,CAAC;IAED,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QACrB,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,OAAO,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,MAAM,CAAC,EAAE,EAAE,CACrD,GAAG,KAAK,YAAY,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;QAC3C,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,EAAmB,EAAE,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC;QACtE,CAAC,CAAC,oBAAoB,CAAC,MAAM,CAAC,CACjC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,23 @@
1
+ import type { SimCfnTemplateValueRecord } from "../template/value/sim-cfn-template-value.js";
2
+ import type { TerraformResource } from "./sim-tf-plan-resources.js";
3
+ import type { TerraformReferenceResolver } from "./sim-tf-reference.js";
4
+ import type { TerraformImportedResource, TerraformLostAttribute, TerraformSkippedResource } from "./sim-tf-report.type.js";
5
+ export interface TerraformMappingPass {
6
+ readonly resources: readonly TerraformResource[];
7
+ readonly resolver: TerraformReferenceResolver;
8
+ readonly templates: Map<string, SimCfnTemplateValueRecord>;
9
+ readonly claimedBy: Map<string, string>;
10
+ readonly mapped: TerraformImportedResource[];
11
+ readonly skipped: TerraformSkippedResource[];
12
+ readonly lost: TerraformLostAttribute[];
13
+ }
14
+ /**
15
+ * Turn every resource that has a mapping into a CloudFormation Resource.
16
+ *
17
+ * A resource from another provider, one whose type has no mapping, and one
18
+ * whose target service requires a property the plan could not resolve are all
19
+ * recorded and stepped over, so a plan Yulin only partly understands still
20
+ * deploys the part it does.
21
+ */
22
+ export declare function applyMappings(pass: TerraformMappingPass): void;
23
+ //# sourceMappingURL=sim-tf-template-mappings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sim-tf-template-mappings.d.ts","sourceRoot":"","sources":["../../../../src/service/cloudformation/terraform/sim-tf-template-mappings.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,6CAA6C,CAAC;AAC7F,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AAQxE,OAAO,KAAK,EACV,yBAAyB,EACzB,sBAAsB,EACtB,wBAAwB,EACzB,MAAM,yBAAyB,CAAC;AAIjC,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,SAAS,EAAE,SAAS,iBAAiB,EAAE,CAAC;IACjD,QAAQ,CAAC,QAAQ,EAAE,0BAA0B,CAAC;IAC9C,QAAQ,CAAC,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,yBAAyB,CAAC,CAAC;IAC3D,QAAQ,CAAC,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACxC,QAAQ,CAAC,MAAM,EAAE,yBAAyB,EAAE,CAAC;IAC7C,QAAQ,CAAC,OAAO,EAAE,wBAAwB,EAAE,CAAC;IAC7C,QAAQ,CAAC,IAAI,EAAE,sBAAsB,EAAE,CAAC;CACzC;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,oBAAoB,GAAG,IAAI,CAI9D"}
@@ -0,0 +1,72 @@
1
+ import { terraformLogicalId } from "./sim-tf-reference.js";
2
+ import { skip } from "./sim-tf-template-merge.js";
3
+ import { dependsOn } from "./sim-tf-template-graph.js";
4
+ import { terraformResourceFolds, terraformResourceMappings, } from "./sim-tf-registry.js";
5
+ const awsProvider = "hashicorp/aws";
6
+ /**
7
+ * Turn every resource that has a mapping into a CloudFormation Resource.
8
+ *
9
+ * A resource from another provider, one whose type has no mapping, and one
10
+ * whose target service requires a property the plan could not resolve are all
11
+ * recorded and stepped over, so a plan Yulin only partly understands still
12
+ * deploys the part it does.
13
+ */
14
+ export function applyMappings(pass) {
15
+ for (const resource of pass.resources) {
16
+ mapOne(resource, pass);
17
+ }
18
+ }
19
+ function mapOne(resource, pass) {
20
+ if (resource.provider !== awsProvider) {
21
+ pass.skipped.push(skip(resource, "not an AWS provider resource"));
22
+ return;
23
+ }
24
+ const mapping = terraformResourceMappings.get(resource.type);
25
+ if (mapping === undefined) {
26
+ if (!terraformResourceFolds.has(resource.type)) {
27
+ pass.skipped.push(skip(resource, "no mapping for resource type"));
28
+ }
29
+ return;
30
+ }
31
+ const built = mapping({ resource, resolver: pass.resolver });
32
+ const missing = (built.requires ?? []).filter((name) => built.Properties[name] === undefined);
33
+ if (missing.length > 0) {
34
+ pass.skipped.push(skip(resource, "unresolved required attribute"));
35
+ pass.lost.push(...missing.map((name) => ({
36
+ address: resource.address,
37
+ attribute: name,
38
+ })));
39
+ return;
40
+ }
41
+ declare(resource, built.Type, built.Properties, pass);
42
+ pass.lost.push(...(built.lost ?? []).map((attribute) => ({
43
+ address: resource.address,
44
+ attribute,
45
+ })));
46
+ }
47
+ /**
48
+ * Put one Resource in the template under the logical ID its address gives.
49
+ *
50
+ * Two addresses reaching one logical ID is refused rather than resolved, since
51
+ * the alternative is one Resource silently standing for two.
52
+ */
53
+ function declare(resource, type, resourceProperties, pass) {
54
+ const logicalId = terraformLogicalId(resource.address);
55
+ const claimed = pass.claimedBy.get(logicalId);
56
+ if (claimed !== undefined) {
57
+ throw new Error(`Terraform addresses ${claimed} and ${resource.address} both give the ` +
58
+ `CloudFormation logical ID ${logicalId}`);
59
+ }
60
+ pass.claimedBy.set(logicalId, resource.address);
61
+ pass.templates.set(logicalId, {
62
+ Type: type,
63
+ Properties: resourceProperties,
64
+ ...dependsOn(resource, pass.resolver),
65
+ });
66
+ pass.mapped.push({
67
+ address: resource.address,
68
+ type: resource.type,
69
+ cfnType: type,
70
+ });
71
+ }
72
+ //# sourceMappingURL=sim-tf-template-mappings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sim-tf-template-mappings.js","sourceRoot":"","sources":["../../../../src/service/cloudformation/terraform/sim-tf-template-mappings.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EACL,sBAAsB,EACtB,yBAAyB,GAC1B,MAAM,sBAAsB,CAAC;AAO9B,MAAM,WAAW,GAAG,eAAe,CAAC;AAYpC;;;;;;;GAOG;AACH,MAAM,UAAU,aAAa,CAAC,IAA0B;IACtD,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;QACtC,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IACzB,CAAC;AACH,CAAC;AAED,SAAS,MAAM,CAAC,QAA2B,EAAE,IAA0B;IACrE,IAAI,QAAQ,CAAC,QAAQ,KAAK,WAAW,EAAE,CAAC;QACtC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,8BAA8B,CAAC,CAAC,CAAC;QAClE,OAAO;IACT,CAAC;IAED,MAAM,OAAO,GAAG,yBAAyB,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAE7D,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC1B,IAAI,CAAC,sBAAsB,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;YAC/C,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,8BAA8B,CAAC,CAAC,CAAC;QACpE,CAAC;QACD,OAAO;IACT,C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,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CACb,uBAAuB,OAAO,QAAQ,QAAQ,CAAC,OAAO,iBAAiB;YACrE,6BAA6B,SAAS,EAAE,CAC3C,CAAC;IACJ,CAAC;IAED,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,SAAS,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC;IAChD,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,SAAS,EAAE;QAC5B,IAAI,EAAE,IAAI;QACV,UAAU,EAAE,kBAA+C;QAC3D,GAAG,SAAS,CAAC,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC;KACtC,CAAC,CAAC;IACH,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;QACf,OAAO,EAAE,QAAQ,CAAC,OAAO;QACzB,IAAI,EAAE,QAAQ,CAAC,IAAI;QACnB,OAAO,EAAE,IAAI;KACd,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,21 @@
1
+ import type { SimCfnTemplateValueRecord } from "../template/value/sim-cfn-template-value.js";
2
+ import type { TerraformResource } from "./sim-tf-plan-resources.js";
3
+ import type { TerraformSkippedResource } from "./sim-tf-report.type.js";
4
+ /** One resource of the plan recorded as skipped, with the reason it was. */
5
+ export declare function skip(resource: TerraformResource, reason: TerraformSkippedResource["reason"]): TerraformSkippedResource;
6
+ /**
7
+ * A resource template with a fold's properties merged into it.
8
+ *
9
+ * The fold contributes whole CloudFormation properties, so a later fold on the
10
+ * same parent replaces a property an earlier one set rather than merging into
11
+ * it. No two folds of one resource type write the same property.
12
+ */
13
+ export declare function mergedParent(parent: SimCfnTemplateValueRecord, added: SimCfnTemplateValueRecord): SimCfnTemplateValueRecord;
14
+ /**
15
+ * The logical ID of the resource a fold belongs to.
16
+ *
17
+ * The fold's parent attribute holds a reference rather than a value, because a
18
+ * bucket or a role being created by the same plan has no name until it exists.
19
+ * The reference names the resource directly, which is what a fold needs.
20
+ */
21
+ //# sourceMappingURL=sim-tf-template-merge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sim-tf-template-merge.d.ts","sourceRoot":"","sources":["../../../../src/service/cloudformation/terraform/sim-tf-template-merge.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,6CAA6C,CAAC;AAC7F,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AAExE,4EAA4E;AAC5E,wBAAgB,IAAI,CAClB,QAAQ,EAAE,iBAAiB,EAC3B,MAAM,EAAE,wBAAwB,CAAC,QAAQ,CAAC,GACzC,wBAAwB,CAE1B;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAC1B,MAAM,EAAE,yBAAyB,EACjC,KAAK,EAAE,yBAAyB,GAC/B,yBAAyB,CAO3B;AAED;;;;;;GAMG"}
@@ -0,0 +1,33 @@
1
+ /*
2
+ * Reading a plan means reading records whose keys come from the document
3
+ * rather than from this code, so the object-injection rule fires on every
4
+ * lookup. The records are parsed JSON with no prototype of their own.
5
+ */
6
+ // oxlint-disable security/detect-object-injection
7
+ import { isRecord } from "../../../util/type-guard/record.js";
8
+ /** One resource of the plan recorded as skipped, with the reason it was. */
9
+ export function skip(resource, reason) {
10
+ return { address: resource.address, type: resource.type, reason };
11
+ }
12
+ /**
13
+ * A resource template with a fold's properties merged into it.
14
+ *
15
+ * The fold contributes whole CloudFormation properties, so a later fold on the
16
+ * same parent replaces a property an earlier one set rather than merging into
17
+ * it. No two folds of one resource type write the same property.
18
+ */
19
+ export function mergedParent(parent, added) {
20
+ const existing = parent["Properties"];
21
+ return {
22
+ ...parent,
23
+ Properties: { ...(isRecord(existing) && existing), ...added },
24
+ };
25
+ }
26
+ /**
27
+ * The logical ID of the resource a fold belongs to.
28
+ *
29
+ * The fold's parent attribute holds a reference rather than a value, because a
30
+ * bucket or a role being created by the same plan has no name until it exists.
31
+ * The reference names the resource directly, which is what a fold needs.
32
+ */
33
+ //# sourceMappingURL=sim-tf-template-merge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sim-tf-template-merge.js","sourceRoot":"","sources":["../../../../src/service/cloudformation/terraform/sim-tf-template-merge.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,kDAAkD;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAK9D,4EAA4E;AAC5E,MAAM,UAAU,IAAI,CAClB,QAA2B,EAC3B,MAA0C;IAE1C,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC,OAAO,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC;AACpE,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAC1B,MAAiC,EACjC,KAAgC;IAEhC,MAAM,QAAQ,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC;IAEtC,OAAO;QACL,GAAG,MAAM;QACT,UAAU,EAAE,EAAE,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC,EAAE,GAAG,KAAK,EAAE;KAC9D,CAAC;AACJ,CAAC;AAED;;;;;;GAMG"}
@@ -0,0 +1,21 @@
1
+ import type { SimCfnTemplateValueRecord } from "../template/value/sim-cfn-template-value.js";
2
+ export interface TerraformPruneResult {
3
+ /** The logical IDs removed, in the order they were found. */
4
+ readonly removed: readonly string[];
5
+ }
6
+ /**
7
+ * Take out what points at a Resource the template does not declare.
8
+ *
9
+ * A Resource can be mapped and then dropped, because a property the service
10
+ * requires turned out to be unresolvable. Anything that already resolved a
11
+ * reference against it is left naming a logical ID the template never declares,
12
+ * and CloudFormation refuses the whole template for one of those.
13
+ *
14
+ * The two forms are treated differently on purpose. A `DependsOn` entry is an
15
+ * ordering hint, so a dangling one is dropped and its Resource stays. A `Ref`
16
+ * or an `Fn::GetAtt` in a property is a value the Resource needs, so a
17
+ * Resource holding a dangling one goes as well. That removal can strand
18
+ * another Resource in turn, which is why this runs until nothing changes.
19
+ */
20
+ export declare function pruneDanglingReferences(templates: Map<string, SimCfnTemplateValueRecord>): TerraformPruneResult;
21
+ //# sourceMappingURL=sim-tf-template-prune.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sim-tf-template-prune.d.ts","sourceRoot":"","sources":["../../../../src/service/cloudformation/terraform/sim-tf-template-prune.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,6CAA6C,CAAC;AAG7F,MAAM,WAAW,oBAAoB;IACnC,6DAA6D;IAC7D,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;CACrC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,yBAAyB,CAAC,GAChD,oBAAoB,CAmBtB"}
@@ -0,0 +1,51 @@
1
+ import { referencedLogicalIds } from "./sim-tf-template-references.js";
2
+ /**
3
+ * Take out what points at a Resource the template does not declare.
4
+ *
5
+ * A Resource can be mapped and then dropped, because a property the service
6
+ * requires turned out to be unresolvable. Anything that already resolved a
7
+ * reference against it is left naming a logical ID the template never declares,
8
+ * and CloudFormation refuses the whole template for one of those.
9
+ *
10
+ * The two forms are treated differently on purpose. A `DependsOn` entry is an
11
+ * ordering hint, so a dangling one is dropped and its Resource stays. A `Ref`
12
+ * or an `Fn::GetAtt` in a property is a value the Resource needs, so a
13
+ * Resource holding a dangling one goes as well. That removal can strand
14
+ * another Resource in turn, which is why this runs until nothing changes.
15
+ */
16
+ export function pruneDanglingReferences(templates) {
17
+ const removed = [];
18
+ for (let stranded = strandedLogicalIds(templates); stranded.length > 0; stranded = strandedLogicalIds(templates)) {
19
+ for (const logicalId of stranded) {
20
+ templates.delete(logicalId);
21
+ removed.push(logicalId);
22
+ }
23
+ }
24
+ for (const [logicalId, template] of templates) {
25
+ templates.set(logicalId, withoutDanglingDependsOn(template, templates));
26
+ }
27
+ return { removed };
28
+ }
29
+ /** The Resources holding a property that names a Resource nothing declares. */
30
+ function strandedLogicalIds(templates) {
31
+ return [...templates]
32
+ .filter(([, template]) => referencedLogicalIds(template["Properties"]).some((named) => !templates.has(named)))
33
+ .map(([logicalId]) => logicalId);
34
+ }
35
+ function withoutDanglingDependsOn(template, templates) {
36
+ const declared = template["DependsOn"];
37
+ if (!Array.isArray(declared)) {
38
+ return template;
39
+ }
40
+ const kept = declared.filter((entry) => typeof entry === "string" && templates.has(entry));
41
+ if (kept.length === declared.length) {
42
+ return template;
43
+ }
44
+ return kept.length === 0
45
+ ? withoutKey(template, "DependsOn")
46
+ : { ...template, DependsOn: kept };
47
+ }
48
+ function withoutKey(template, key) {
49
+ return Object.fromEntries(Object.entries(template).filter(([name]) => name !== key));
50
+ }
51
+ //# sourceMappingURL=sim-tf-template-prune.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sim-tf-template-prune.js","sourceRoot":"","sources":["../../../../src/service/cloudformation/terraform/sim-tf-template-prune.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAOvE;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,uBAAuB,CACrC,SAAiD;IAEjD,MAAM,OAAO,GAAa,EAAE,CAAC;IAE7B,KACE,IAAI,QAAQ,GAAG,kBAAkB,CAAC,SAAS,CAAC,EAC5C,QAAQ,CAAC,MAAM,GAAG,CAAC,EACnB,QAAQ,GAAG,kBAAkB,CAAC,SAAS,CAAC,EACxC,CAAC;QACD,KAAK,MAAM,SAAS,IAAI,QAAQ,EAAE,CAAC;YACjC,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;YAC5B,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC;IAED,KAAK,MAAM,CAAC,SAAS,EAAE,QAAQ,CAAC,IAAI,SAAS,EAAE,CA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AAmC,EACnC,GAAW;IAEX,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,IAAI,KAAK,GAAG,CAAC,CAC1D,CAAC;AACJ,CAAC"}
@@ -0,0 +1,18 @@
1
+ import type { SimCfnTemplateValueRecord } from "../template/value/sim-cfn-template-value.js";
2
+ import type { TerraformImportedResource, TerraformSkippedResource } from "./sim-tf-report.type.js";
3
+ export interface TerraformPruneBookkeeping {
4
+ readonly templates: Map<string, SimCfnTemplateValueRecord>;
5
+ readonly claimedBy: ReadonlyMap<string, string>;
6
+ readonly mapped: TerraformImportedResource[];
7
+ readonly skipped: TerraformSkippedResource[];
8
+ }
9
+ /**
10
+ * Prune the template, and move what went from mapped to skipped.
11
+ *
12
+ * A Resource dropped for an unresolvable required property leaves whatever
13
+ * referred to it naming a logical ID the template does not declare. Those go
14
+ * here rather than reaching CloudFormation as a template it would refuse, and
15
+ * the report follows them so the counts still add up to the plan.
16
+ */
17
+ export declare function recordPrunedResources(bookkeeping: TerraformPruneBookkeeping): void;
18
+ //# sourceMappingURL=sim-tf-template-pruned.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sim-tf-template-pruned.d.ts","sourceRoot":"","sources":["../../../../src/service/cloudformation/terraform/sim-tf-template-pruned.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,6CAA6C,CAAC;AAE7F,OAAO,KAAK,EACV,yBAAyB,EACzB,wBAAwB,EACzB,MAAM,yBAAyB,CAAC;AAEjC,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,yBAAyB,CAAC,CAAC;IAC3D,QAAQ,CAAC,SAAS,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChD,QAAQ,CAAC,MAAM,EAAE,yBAAyB,EAAE,CAAC;IAC7C,QAAQ,CAAC,OAAO,EAAE,wBAAwB,EAAE,CAAC;CAC9C;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACnC,WAAW,EAAE,yBAAyB,GACrC,IAAI,CAcN"}
@@ -0,0 +1,23 @@
1
+ import { pruneDanglingReferences } from "./sim-tf-template-prune.js";
2
+ /**
3
+ * Prune the template, and move what went from mapped to skipped.
4
+ *
5
+ * A Resource dropped for an unresolvable required property leaves whatever
6
+ * referred to it naming a logical ID the template does not declare. Those go
7
+ * here rather than reaching CloudFormation as a template it would refuse, and
8
+ * the report follows them so the counts still add up to the plan.
9
+ */
10
+ export function recordPrunedResources(bookkeeping) {
11
+ const { templates, claimedBy, mapped, skipped } = bookkeeping;
12
+ for (const logicalId of pruneDanglingReferences(templates).removed) {
13
+ const address = claimedBy.get(logicalId) ?? logicalId;
14
+ const index = mapped.findIndex((entry) => entry.address === address);
15
+ const [entry] = index === -1 ? [] : mapped.splice(index, 1);
16
+ skipped.push({
17
+ address,
18
+ type: entry?.type ?? "unknown",
19
+ reason: "references a resource that was skipped",
20
+ });
21
+ }
22
+ }
23
+ //# sourceMappingURL=sim-tf-template-pruned.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sim-tf-template-pruned.js","sourceRoot":"","sources":["../../../../src/service/cloudformation/terraform/sim-tf-template-pruned.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAarE;;;;;;;GAOG;AACH,MAAM,UAAU,qBAAqB,CACnC,WAAsC;IAEtC,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,WAAW,CAAC;IAE9D,KAAK,MAAM,SAAS,IAAI,uBAAuB,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,CAAC;QACnE,MAAM,OAAO,GAAG,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,SAAS,CAAC;QACtD,MAAM,KAAK,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,KAAK,OAAO,CAAC,CAAC;QACrE,MAAM,CAAC,KAAK,CAAC,GAAG,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QAE5D,OAAO,CAAC,IAAI,CAAC;YACX,OAAO;YACP,IAAI,EAAE,KAAK,EAAE,IAAI,IAAI,SAAS;YAC9B,MAAM,EAAE,wCAAwC;SACjD,CAAC,CAAC;IACL,CAAC;AACH,CAAC"}
@@ -0,0 +1,10 @@
1
+ import type { SimCfnTemplateValue } from "../template/value/sim-cfn-template-value.js";
2
+ /**
3
+ * The logical IDs an intrinsic somewhere in this value names.
4
+ *
5
+ * A `Ref` names one in its value and an `Fn::GetAtt` names one in the first
6
+ * element of its list. Anything else is walked into, because an intrinsic can
7
+ * sit at any depth of a property.
8
+ */
9
+ export declare function referencedLogicalIds(value: SimCfnTemplateValue | undefined): readonly string[];
10
+ //# sourceMappingURL=sim-tf-template-references.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sim-tf-template-references.d.ts","sourceRoot":"","sources":["../../../../src/service/cloudformation/terraform/sim-tf-template-references.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAC;AAEvF;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,mBAAmB,GAAG,SAAS,GACrC,SAAS,MAAM,EAAE,CAgBnB"}
@@ -0,0 +1,39 @@
1
+ /*
2
+ * Reading a plan means reading records whose keys come from the document
3
+ * rather than from this code, so the object-injection rule fires on every
4
+ * lookup. The records are parsed JSON with no prototype of their own.
5
+ */
6
+ // oxlint-disable security/detect-object-injection
7
+ import { isRecord } from "../../../util/type-guard/record.js";
8
+ /**
9
+ * The logical IDs an intrinsic somewhere in this value names.
10
+ *
11
+ * A `Ref` names one in its value and an `Fn::GetAtt` names one in the first
12
+ * element of its list. Anything else is walked into, because an intrinsic can
13
+ * sit at any depth of a property.
14
+ */
15
+ export function referencedLogicalIds(value) {
16
+ if (Array.isArray(value)) {
17
+ return value.flatMap((entry) => referencedLogicalIds(entry));
18
+ }
19
+ if (!isRecord(value)) {
20
+ return [];
21
+ }
22
+ const named = intrinsicTarget(value);
23
+ if (named !== undefined) {
24
+ return [named];
25
+ }
26
+ return Object.values(value).flatMap((nested) => referencedLogicalIds(nested));
27
+ }
28
+ function intrinsicTarget(value) {
29
+ const referenced = value["Ref"];
30
+ if (typeof referenced === "string") {
31
+ return referenced;
32
+ }
33
+ const attribute = value["Fn::GetAtt"];
34
+ if (Array.isArray(attribute) && typeof attribute[0] === "string") {
35
+ return attribute[0];
36
+ }
37
+ return undefined;
38
+ }
39
+ //# sourceMappingURL=sim-tf-template-references.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sim-tf-template-references.js","sourceRoot":"","sources":["../../../../src/service/cloudformation/terraform/sim-tf-template-references.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,kDAAkD;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAG9D;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB,CAClC,KAAsC;IAEtC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,KAAK,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,oBAAoB,CAAC,KAAK,CAAC,CAAC,CAAC;IAC/D,CAAC;IAED,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QACrB,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,KAAK,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC;IAErC,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,OAAO,CAAC,KAAK,CAAC,CAAC;IACjB,CAAC;IAED,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC;AAChF,CAAC;AAED,SAAS,eAAe,CAAC,KAA8B;IACrD,MAAM,UAAU,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;IAEhC,IAAI,OAAO,UAAU,KAAK,QAAQ,EAAE,CAAC;QACnC,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,MAAM,SAAS,GAAG,KAAK,CAAC,YAAY,CAAC,CAAC;IAEtC,IAAI,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,OAAO,SAAS,CAAC,CAAC,CAAC,KAAK,QAAQ,EAAE,CAAC;QACjE,OAAO,SAAS,CAAC,CAAC,CAAC,CAAC;IACtB,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC"}
@@ -0,0 +1,12 @@
1
+ import type { TerraformPlan } from "./sim-tf-plan.type.js";
2
+ import type { TerraformResource } from "./sim-tf-plan-resources.js";
3
+ import { TerraformReferenceResolver } from "./sim-tf-reference.js";
4
+ /**
5
+ * A resolver over the resources that become a CloudFormation Resource.
6
+ *
7
+ * A reference to a type with no mapping would otherwise produce an intrinsic
8
+ * naming a logical ID the template never declares, and the property carrying it
9
+ * would reach the service factory as an object where a string was wanted.
10
+ */
11
+ export declare function mappableResolver(plan: TerraformPlan, resources: readonly TerraformResource[]): TerraformReferenceResolver;
12
+ //# sourceMappingURL=sim-tf-template-resolver.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sim-tf-template-resolver.d.ts","sourceRoot":"","sources":["../../../../src/service/cloudformation/terraform/sim-tf-template-resolver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AAMnE;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,aAAa,EACnB,SAAS,EAAE,SAAS,iBAAiB,EAAE,GACtC,0BAA0B,CAQ5B"}
@@ -0,0 +1,17 @@
1
+ import { TerraformReferenceResolver } from "./sim-tf-reference.js";
2
+ import { terraformModuleOutputs } from "./sim-tf-module-outputs.js";
3
+ import { terraformResourceMappings } from "./sim-tf-registry.js";
4
+ const awsProvider = "hashicorp/aws";
5
+ /**
6
+ * A resolver over the resources that become a CloudFormation Resource.
7
+ *
8
+ * A reference to a type with no mapping would otherwise produce an intrinsic
9
+ * naming a logical ID the template never declares, and the property carrying it
10
+ * would reach the service factory as an object where a string was wanted.
11
+ */
12
+ export function mappableResolver(plan, resources) {
13
+ const mappable = resources.filter((resource) => resource.provider === awsProvider &&
14
+ terraformResourceMappings.has(resource.type));
15
+ return new TerraformReferenceResolver(mappable, terraformModuleOutputs(plan));
16
+ }
17
+ //# sourceMappingURL=sim-tf-template-resolver.js.map