@kensio/yulin 1.19.3 → 1.19.4

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 (184) hide show
  1. package/dist/serve/http/local-server/sim-aws-local-server.d.ts +7 -5
  2. package/dist/serve/http/local-server/sim-aws-local-server.d.ts.map +1 -1
  3. package/dist/serve/http/local-server/sim-aws-local-server.js.map +1 -1
  4. package/dist/serve/message/sim-email-log-block.d.ts +35 -0
  5. package/dist/serve/message/sim-email-log-block.d.ts.map +1 -0
  6. package/dist/serve/message/sim-email-log-block.js +111 -0
  7. package/dist/serve/message/sim-email-log-block.js.map +1 -0
  8. package/dist/serve/message/sim-local-message-logging.d.ts.map +1 -1
  9. package/dist/serve/message/sim-local-message-logging.js +4 -1
  10. package/dist/serve/message/sim-local-message-logging.js.map +1 -1
  11. package/dist/serve/message/sim-message-indent.d.ts +10 -0
  12. package/dist/serve/message/sim-message-indent.d.ts.map +1 -0
  13. package/dist/serve/message/sim-message-indent.js +12 -0
  14. package/dist/serve/message/sim-message-indent.js.map +1 -0
  15. package/dist/serve/message/sim-message-log-console.d.ts +17 -1
  16. package/dist/serve/message/sim-message-log-console.d.ts.map +1 -1
  17. package/dist/serve/message/sim-message-log-console.js +25 -17
  18. package/dist/serve/message/sim-message-log-console.js.map +1 -1
  19. package/dist/serve/message/sim-message-logging.d.ts +16 -3
  20. package/dist/serve/message/sim-message-logging.d.ts.map +1 -1
  21. package/dist/serve/message/sim-message-logging.js +28 -7
  22. package/dist/serve/message/sim-message-logging.js.map +1 -1
  23. package/dist/service/aws/factory/sim-aws-account-region-service-builder.d.ts +10 -0
  24. package/dist/service/aws/factory/sim-aws-account-region-service-builder.d.ts.map +1 -1
  25. package/dist/service/aws/factory/sim-aws-account-region-service-builder.js +15 -0
  26. package/dist/service/aws/factory/sim-aws-account-region-service-builder.js.map +1 -1
  27. package/dist/service/aws/factory/sim-aws-self-contained-service-builder.d.ts +0 -9
  28. package/dist/service/aws/factory/sim-aws-self-contained-service-builder.d.ts.map +1 -1
  29. package/dist/service/aws/factory/sim-aws-self-contained-service-builder.js +0 -11
  30. package/dist/service/aws/factory/sim-aws-self-contained-service-builder.js.map +1 -1
  31. package/dist/service/aws/factory/sim-aws-service-factory.js +1 -1
  32. package/dist/service/aws/message/sim-aws-logged-message.d.ts +25 -5
  33. package/dist/service/aws/message/sim-aws-logged-message.d.ts.map +1 -1
  34. package/dist/service/cloudformation/bind/{sim-cfn-deploy-binding.d.ts → sim-cfn-binding.d.ts} +11 -4
  35. package/dist/service/cloudformation/bind/sim-cfn-binding.d.ts.map +1 -0
  36. package/dist/service/cloudformation/bind/{sim-cfn-deploy-binding.js → sim-cfn-binding.js} +1 -1
  37. package/dist/service/cloudformation/bind/sim-cfn-binding.js.map +1 -0
  38. package/dist/service/cloudformation/bind/sim-cfn-exec-binding.type.d.ts +32 -35
  39. package/dist/service/cloudformation/bind/sim-cfn-exec-binding.type.d.ts.map +1 -1
  40. package/dist/service/cloudformation/bind/validate/sim-cfn-exec-binding-finder.d.ts +2 -2
  41. package/dist/service/cloudformation/bind/validate/sim-cfn-exec-binding-finder.d.ts.map +1 -1
  42. package/dist/service/cloudformation/bind/validate/sim-cfn-exec-binding-finder.js +1 -1
  43. package/dist/service/cloudformation/bind/validate/sim-cfn-exec-binding-finder.js.map +1 -1
  44. package/dist/service/cloudformation/bind/validate/sim-cfn-exec-binding-validator.d.ts +2 -2
  45. package/dist/service/cloudformation/bind/validate/sim-cfn-exec-binding-validator.d.ts.map +1 -1
  46. package/dist/service/cloudformation/bind/validate/sim-cfn-exec-binding-validator.js +1 -1
  47. package/dist/service/cloudformation/bind/validate/sim-cfn-exec-binding-validator.js.map +1 -1
  48. package/dist/service/cloudformation/command/create-stack/create-stack.handler.d.ts +2 -2
  49. package/dist/service/cloudformation/command/create-stack/create-stack.handler.d.ts.map +1 -1
  50. package/dist/service/cloudformation/command/create-stack/create-stack.handler.js.map +1 -1
  51. package/dist/service/cloudformation/deploy/sim-cfn-cdk-out-stack-options.d.ts +2 -2
  52. package/dist/service/cloudformation/deploy/sim-cfn-cdk-out-stack-options.d.ts.map +1 -1
  53. package/dist/service/cloudformation/deploy/sim-cfn-template-deployer.d.ts +2 -2
  54. package/dist/service/cloudformation/deploy/sim-cfn-template-deployer.d.ts.map +1 -1
  55. package/dist/service/cloudformation/deploy/sim-cfn-template-deployer.js.map +1 -1
  56. package/dist/service/cloudformation/deploy/sim-cfn-template-file-loader.d.ts +3 -3
  57. package/dist/service/cloudformation/deploy/sim-cfn-template-file-loader.d.ts.map +1 -1
  58. package/dist/service/cloudformation/index.d.ts +3 -0
  59. package/dist/service/cloudformation/index.d.ts.map +1 -1
  60. package/dist/service/cloudformation/resource/sim-cfn-resource.type.d.ts +2 -2
  61. package/dist/service/cloudformation/resource/sim-cfn-resource.type.d.ts.map +1 -1
  62. package/dist/service/cloudformation/stack/deploy/sim-cfn-stack-resource-batch-creator.d.ts +2 -2
  63. package/dist/service/cloudformation/stack/deploy/sim-cfn-stack-resource-batch-creator.d.ts.map +1 -1
  64. package/dist/service/cloudformation/stack/deploy/sim-cfn-stack-resource-batch-creator.js.map +1 -1
  65. package/dist/service/cloudformation/stack/deploy/sim-cfn-stack-resource-creator.d.ts +2 -2
  66. package/dist/service/cloudformation/stack/deploy/sim-cfn-stack-resource-creator.d.ts.map +1 -1
  67. package/dist/service/cloudformation/stack/sim-cfn-deployed-stack.type.d.ts +8 -0
  68. package/dist/service/cloudformation/stack/sim-cfn-deployed-stack.type.d.ts.map +1 -1
  69. package/dist/service/cloudformation/stack/sim-cfn-stack-resource-operations.d.ts +2 -2
  70. package/dist/service/cloudformation/stack/sim-cfn-stack-resource-operations.d.ts.map +1 -1
  71. package/dist/service/cloudformation/stack/sim-cfn-stack-resource-operations.js.map +1 -1
  72. package/dist/service/cloudformation/stack/sim-cfn-stack.d.ts +3 -10
  73. package/dist/service/cloudformation/stack/sim-cfn-stack.d.ts.map +1 -1
  74. package/dist/service/cloudformation/stack/sim-cfn-stack.js +13 -18
  75. package/dist/service/cloudformation/stack/sim-cfn-stack.js.map +1 -1
  76. package/dist/service/cloudformation/stack/sim-cfn-stack.type.d.ts +2 -2
  77. package/dist/service/cloudformation/stack/sim-cfn-stack.type.d.ts.map +1 -1
  78. package/dist/service/cloudfront/cfn/cff/sim-cfn-cff-binding-lookup.d.ts +2 -2
  79. package/dist/service/cloudfront/cfn/cff/sim-cfn-cff-binding-lookup.d.ts.map +1 -1
  80. package/dist/service/cloudfront/cfn/cff/sim-cfn-cff-create-input-builder.d.ts +2 -2
  81. package/dist/service/cloudfront/cfn/cff/sim-cfn-cff-create-input-builder.d.ts.map +1 -1
  82. package/dist/service/cloudfront/cfn/cff/sim-cfn-cff-create-input-builder.js.map +1 -1
  83. package/dist/service/ecs/cfn/bind/sim-cfn-ecs-container-binding.type.d.ts +1 -1
  84. package/dist/service/ecs/cfn/bind/sim-cfn-ecs-container-bindings.d.ts +2 -2
  85. package/dist/service/ecs/cfn/bind/sim-cfn-ecs-container-bindings.d.ts.map +1 -1
  86. package/dist/service/ecs/cfn/bind/sim-cfn-ecs-container-bindings.js +1 -1
  87. package/dist/service/ecs/cfn/bind/sim-cfn-ecs-container-bindings.js.map +1 -1
  88. package/dist/service/ecs/cfn/task-definition/sim-cfn-ecs-task-definition-creator.d.ts +2 -2
  89. package/dist/service/ecs/cfn/task-definition/sim-cfn-ecs-task-definition-creator.d.ts.map +1 -1
  90. package/dist/service/ecs/cfn/task-definition/sim-cfn-ecs-task-definition-creator.js.map +1 -1
  91. package/dist/service/lambda/cfn/function/sim-cfn-lambda-code-input.d.ts +2 -2
  92. package/dist/service/lambda/cfn/function/sim-cfn-lambda-code-input.d.ts.map +1 -1
  93. package/dist/service/lambda/cfn/function/sim-cfn-lambda-function-creator.d.ts +2 -2
  94. package/dist/service/lambda/cfn/function/sim-cfn-lambda-function-creator.d.ts.map +1 -1
  95. package/dist/service/lambda/cfn/function/sim-cfn-lambda-function-creator.js.map +1 -1
  96. package/dist/service/ses/command/send/sim-ses-configuration-set-check.d.ts +53 -0
  97. package/dist/service/ses/command/send/sim-ses-configuration-set-check.d.ts.map +1 -0
  98. package/dist/service/ses/command/send/sim-ses-configuration-set-check.js +70 -0
  99. package/dist/service/ses/command/send/sim-ses-configuration-set-check.js.map +1 -0
  100. package/dist/service/ses/command/send/sim-ses-send-email.d.ts +5 -3
  101. package/dist/service/ses/command/send/sim-ses-send-email.d.ts.map +1 -1
  102. package/dist/service/ses/command/send/sim-ses-send-email.js +11 -4
  103. package/dist/service/ses/command/send/sim-ses-send-email.js.map +1 -1
  104. package/dist/service/ses/command/send/sim-ses-service-send.d.ts +6 -0
  105. package/dist/service/ses/command/send/sim-ses-service-send.d.ts.map +1 -1
  106. package/dist/service/ses/command/send/sim-ses-service-send.js +9 -2
  107. package/dist/service/ses/command/send/sim-ses-service-send.js.map +1 -1
  108. package/dist/service/ses/email/sim-ses-sent-email-store.d.ts +14 -0
  109. package/dist/service/ses/email/sim-ses-sent-email-store.d.ts.map +1 -1
  110. package/dist/service/ses/email/sim-ses-sent-email-store.js +21 -0
  111. package/dist/service/ses/email/sim-ses-sent-email-store.js.map +1 -1
  112. package/dist/service/ses/error/sim-ses.error.d.ts +12 -0
  113. package/dist/service/ses/error/sim-ses.error.d.ts.map +1 -1
  114. package/dist/service/ses/error/sim-ses.error.js +14 -0
  115. package/dist/service/ses/error/sim-ses.error.js.map +1 -1
  116. package/dist/service/ses/index.d.ts +1 -1
  117. package/dist/service/ses/index.d.ts.map +1 -1
  118. package/dist/service/ses/index.js +1 -1
  119. package/dist/service/ses/index.js.map +1 -1
  120. package/dist/service/ses/sim-ses-commands.d.ts +5 -0
  121. package/dist/service/ses/sim-ses-commands.d.ts.map +1 -1
  122. package/dist/service/ses/sim-ses-commands.js +10 -2
  123. package/dist/service/ses/sim-ses-commands.js.map +1 -1
  124. package/dist/terraform/sim-tf-adapter.d.ts +2 -2
  125. package/dist/terraform/sim-tf-adapter.d.ts.map +1 -1
  126. package/dist/terraform/sim-tf-attribute-intrinsic.d.ts +13 -0
  127. package/dist/terraform/sim-tf-attribute-intrinsic.d.ts.map +1 -0
  128. package/dist/terraform/sim-tf-attribute-intrinsic.js +23 -0
  129. package/dist/terraform/sim-tf-attribute-intrinsic.js.map +1 -0
  130. package/dist/terraform/sim-tf-attributes.js +1 -1
  131. package/dist/terraform/sim-tf-attributes.js.map +1 -1
  132. package/dist/terraform/sim-tf-declare.d.ts +0 -20
  133. package/dist/terraform/sim-tf-declare.d.ts.map +1 -1
  134. package/dist/terraform/sim-tf-declare.js +1 -47
  135. package/dist/terraform/sim-tf-declare.js.map +1 -1
  136. package/dist/terraform/sim-tf-depends-on.d.ts +21 -0
  137. package/dist/terraform/sim-tf-depends-on.d.ts.map +1 -0
  138. package/dist/terraform/sim-tf-depends-on.js +30 -0
  139. package/dist/terraform/sim-tf-depends-on.js.map +1 -0
  140. package/dist/terraform/sim-tf-expression-references.d.ts +11 -0
  141. package/dist/terraform/sim-tf-expression-references.d.ts.map +1 -0
  142. package/dist/terraform/sim-tf-expression-references.js +22 -0
  143. package/dist/terraform/sim-tf-expression-references.js.map +1 -0
  144. package/dist/terraform/sim-tf-module-outputs.d.ts +39 -0
  145. package/dist/terraform/sim-tf-module-outputs.d.ts.map +1 -1
  146. package/dist/terraform/sim-tf-module-outputs.js +66 -0
  147. package/dist/terraform/sim-tf-module-outputs.js.map +1 -1
  148. package/dist/terraform/sim-tf-module-variables.d.ts +16 -0
  149. package/dist/terraform/sim-tf-module-variables.d.ts.map +1 -0
  150. package/dist/terraform/sim-tf-module-variables.js +37 -0
  151. package/dist/terraform/sim-tf-module-variables.js.map +1 -0
  152. package/dist/terraform/sim-tf-nested-attributes.js +2 -2
  153. package/dist/terraform/sim-tf-nested-attributes.js.map +1 -1
  154. package/dist/terraform/sim-tf-plan-resources.d.ts.map +1 -1
  155. package/dist/terraform/sim-tf-plan-resources.js +2 -0
  156. package/dist/terraform/sim-tf-plan-resources.js.map +1 -1
  157. package/dist/terraform/sim-tf-plan.type.d.ts +20 -3
  158. package/dist/terraform/sim-tf-plan.type.d.ts.map +1 -1
  159. package/dist/terraform/sim-tf-reference-addresses.d.ts +45 -0
  160. package/dist/terraform/sim-tf-reference-addresses.d.ts.map +1 -0
  161. package/dist/terraform/sim-tf-reference-addresses.js +82 -0
  162. package/dist/terraform/sim-tf-reference-addresses.js.map +1 -0
  163. package/dist/terraform/sim-tf-reference-scope.d.ts +29 -0
  164. package/dist/terraform/sim-tf-reference-scope.d.ts.map +1 -0
  165. package/dist/terraform/sim-tf-reference-scope.js +71 -0
  166. package/dist/terraform/sim-tf-reference-scope.js.map +1 -0
  167. package/dist/terraform/sim-tf-reference.d.ts +33 -31
  168. package/dist/terraform/sim-tf-reference.d.ts.map +1 -1
  169. package/dist/terraform/sim-tf-reference.js +79 -88
  170. package/dist/terraform/sim-tf-reference.js.map +1 -1
  171. package/dist/terraform/sim-tf-referenced.js +1 -1
  172. package/dist/terraform/sim-tf-referenced.js.map +1 -1
  173. package/dist/terraform/sim-tf-resource.type.d.ts +8 -0
  174. package/dist/terraform/sim-tf-resource.type.d.ts.map +1 -1
  175. package/dist/terraform/sim-tf-settle.d.ts.map +1 -1
  176. package/dist/terraform/sim-tf-settle.js +3 -1
  177. package/dist/terraform/sim-tf-settle.js.map +1 -1
  178. package/dist/util/exactly-one.type.d.ts +14 -0
  179. package/dist/util/exactly-one.type.d.ts.map +1 -0
  180. package/dist/util/exactly-one.type.js +2 -0
  181. package/dist/util/exactly-one.type.js.map +1 -0
  182. package/package.json +1 -1
  183. package/dist/service/cloudformation/bind/sim-cfn-deploy-binding.d.ts.map +0 -1
  184. package/dist/service/cloudformation/bind/sim-cfn-deploy-binding.js.map +0 -1
@@ -0,0 +1,23 @@
1
+ import { terraformAttributeReads } from "./sim-tf-attribute-reads.js";
2
+ /**
3
+ * The CloudFormation intrinsic that reads one Terraform attribute off the
4
+ * Resource standing in for the resource producing it.
5
+ *
6
+ * A reference naming a resource and no attribute is the resource itself, and
7
+ * a `Ref` is what CloudFormation answers that with. An attribute is read
8
+ * through whichever of `Ref` and `Fn::GetAtt` carries that value, which the
9
+ * read table says and the two services often disagree about. An attribute the
10
+ * table has no entry for answers with nothing.
11
+ */
12
+ export function terraformAttributeIntrinsic(type, attribute, logicalId) {
13
+ const read = attribute === undefined
14
+ ? "Ref"
15
+ : terraformAttributeReads.get(`${type}.${attribute}`);
16
+ if (read === undefined) {
17
+ return undefined;
18
+ }
19
+ return read === "Ref"
20
+ ? { Ref: logicalId }
21
+ : { "Fn::GetAtt": [logicalId, read] };
22
+ }
23
+ //# sourceMappingURL=sim-tf-attribute-intrinsic.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sim-tf-attribute-intrinsic.js","sourceRoot":"","sources":["../../src/terraform/sim-tf-attribute-intrinsic.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAEtE;;;;;;;;;GASG;AACH,MAAM,UAAU,2BAA2B,CACzC,IAAY,EACZ,SAA6B,EAC7B,SAAiB;IAEjB,MAAM,IAAI,GACR,SAAS,KAAK,SAAS;QACrB,CAAC,CAAC,KAAK;QACP,CAAC,CAAC,uBAAuB,CAAC,GAAG,CAAC,GAAG,IAAI,IAAI,SAAS,EAAE,CAAC,CAAC;IAE1D,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO,IAAI,KAAK,KAAK;QACnB,CAAC,CAAC,EAAE,GAAG,EAAE,SAAS,EAAE;QACpB,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,SAAS,EAAE,IAAI,CAAC,EAAE,CAAC;AAC1C,CAAC"}
@@ -37,7 +37,7 @@ function referencedValue(resource, key, resolver) {
37
37
  }
38
38
  const references = longestFirst(expression.references ?? []);
39
39
  for (const reference of references) {
40
- const resolved = resolver.resolve(reference, resource.modulePath);
40
+ const resolved = resolver.resolve(reference, resource);
41
41
  if (resolved !== undefined) {
42
42
  return resolved;
43
43
  }
@@ -1 +1 @@
1
- {"version":3,"file":"sim-tf-attributes.js","sourceRoot":"","sources":["../../src/terraform/sim-tf-attributes.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,kDAAkD;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAKxD,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAoB7D;;;;;;;GAOG;AACH,MAAM,UAAU,SAAS,CACvB,OAAgC,EAChC,GAAW;IAEX,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;IAEvC,IAAI,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC;QACnC,OAAO,eAAe,CAAC,QAAQ,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAC;IAClD,CAAC;IAED,OAAO,aAAa,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;AAC7C,CAAC;AAED;;;;;;;;GAQG;AACH,SAAS,eAAe,CACtB,QAA2B,EAC3B,GAAW,EACX,QAAoC;IAEpC,MAAM,UAAU,GAAG,QAAQ,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IAE7C,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;QAC1B,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,UAAU,GAAG,YAAY,CAC5B,UAAkC,CAAC,UAAU,IAAI,EAAE,CACrD,CAAC;IAEF,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;QACnC,MAAM,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,SAAS,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAC;QAElE,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YAC3B,OAAO,QAAQ,CAAC;QAClB,CAAC;IACH,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;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C;AACrB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAC,KAAc;IAC1C,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QAC1C,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO,KAA4B,CAAC;AACtC,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,OAAO,CACrB,OAAgC,EAChC,KAAuC;IAEvC,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,GAAG,CACvC,CAAC,CAAC,QAAQ,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,QAAQ,EAAE,SAAS,CAAC,OAAO,EAAE,IAAI,CAAC,CAAU,CACpE,CAAC;IAEF,OAAO,UAAU,CAAC,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC;AACjD,CAAC;AAED,8EAA8E;AAC9E,MAAM,UAAU,UAAU,CACxB,MAAuD;IAEvD,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,CAC3B,CAAC,KAAK,EAA0C,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,SAAS,CAC1E,CACF,CAAC;AACJ,CAAC"}
@@ -1,6 +1,4 @@
1
1
  import type { SimCfnTemplateValueRecord } from "../service/cloudformation/template/value/sim-cfn-template-value.js";
2
- import type { TerraformResource } from "./sim-tf-resource.type.js";
3
- import type { TerraformReferenceResolver } from "./sim-tf-reference.js";
4
2
  import type { TerraformSettledPlan } from "./sim-tf-settle.js";
5
3
  import type { TerraformImportedResource, TerraformLostAttribute } from "./sim-tf-report.type.js";
6
4
  /** The Resources a settled plan declares, and what they could not carry. */
@@ -16,22 +14,4 @@ export interface TerraformDeclaredResources {
16
14
  * and nothing it produces is taken back afterwards.
17
15
  */
18
16
  export declare function terraformDeclaredResources(settled: TerraformSettledPlan): TerraformDeclaredResources;
19
- /**
20
- * The Resources one Resource has to be created after.
21
- *
22
- * A CloudFormation template orders itself, because a property that needs
23
- * another Resource holds a `Ref` or an `Fn::GetAtt` naming it. A plan holds no
24
- * such thing. Terraform resolves what it can before writing the plan, so a
25
- * Lambda permission naming a function it creates in the same plan carries the
26
- * function's name as a plain string, and the edge that ordering depends on is
27
- * gone from the value.
28
- *
29
- * The edge survives in `configuration`, which records every reference the
30
- * resource declares whether or not the value was resolved. Turning those back
31
- * into `DependsOn` gives the Stack the graph it would have read off a template
32
- * written by hand.
33
- */
34
- export declare function terraformDependsOn(resource: TerraformResource, resolver: TerraformReferenceResolver): {
35
- DependsOn?: string[];
36
- };
37
17
  //# sourceMappingURL=sim-tf-declare.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sim-tf-declare.d.ts","sourceRoot":"","sources":["../../src/terraform/sim-tf-declare.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,oEAAoE,CAAC;AACpH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AACxE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,KAAK,EACV,yBAAyB,EACzB,sBAAsB,EACvB,MAAM,yBAAyB,CAAC;AAEjC,4EAA4E;AAC5E,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,SAAS,EAAE,WAAW,CAAC,MAAM,EAAE,yBAAyB,CAAC,CAAC;IACnE,QAAQ,CAAC,MAAM,EAAE,SAAS,yBAAyB,EAAE,CAAC;IACtD,QAAQ,CAAC,IAAI,EAAE,SAAS,sBAAsB,EAAE,CAAC;CAClD;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,oBAAoB,GAC5B,0BAA0B,CAiC5B;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,iBAAiB,EAC3B,QAAQ,EAAE,0BAA0B,GACnC;IAAE,SAAS,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,CAe1B"}
1
+ {"version":3,"file":"sim-tf-declare.d.ts","sourceRoot":"","sources":["../../src/terraform/sim-tf-declare.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,oEAAoE,CAAC;AAEpH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,KAAK,EACV,yBAAyB,EACzB,sBAAsB,EACvB,MAAM,yBAAyB,CAAC;AAEjC,4EAA4E;AAC5E,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,SAAS,EAAE,WAAW,CAAC,MAAM,EAAE,yBAAyB,CAAC,CAAC;IACnE,QAAQ,CAAC,MAAM,EAAE,SAAS,yBAAyB,EAAE,CAAC;IACtD,QAAQ,CAAC,IAAI,EAAE,SAAS,sBAAsB,EAAE,CAAC;CAClD;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,oBAAoB,GAC5B,0BAA0B,CAiC5B"}
@@ -1,10 +1,4 @@
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";
1
+ import { terraformDependsOn } from "./sim-tf-depends-on.js";
8
2
  /**
9
3
  * Build one CloudFormation Resource for each resource the plan settled on.
10
4
  *
@@ -40,44 +34,4 @@ export function terraformDeclaredResources(settled) {
40
34
  }
41
35
  return { templates, mapped, lost };
42
36
  }
43
- /**
44
- * The Resources one Resource has to be created after.
45
- *
46
- * A CloudFormation template orders itself, because a property that needs
47
- * another Resource holds a `Ref` or an `Fn::GetAtt` naming it. A plan holds no
48
- * such thing. Terraform resolves what it can before writing the plan, so a
49
- * Lambda permission naming a function it creates in the same plan carries the
50
- * function's name as a plain string, and the edge that ordering depends on is
51
- * gone from the value.
52
- *
53
- * The edge survives in `configuration`, which records every reference the
54
- * resource declares whether or not the value was resolved. Turning those back
55
- * into `DependsOn` gives the Stack the graph it would have read off a template
56
- * written by hand.
57
- */
58
- export function terraformDependsOn(resource, resolver) {
59
- const own = resolver.logicalId(resource.address);
60
- const referenced = [
61
- ...resource.dependsOn,
62
- ...expressionReferences(resource.expressions),
63
- ]
64
- .map((reference) => resolver.targetAddress(reference, resource.modulePath))
65
- .filter((address) => address !== undefined)
66
- .map((address) => resolver.logicalId(address))
67
- .filter((logicalId) => logicalId !== own);
68
- const declared = [...new Set(referenced)];
69
- return declared.length === 0 ? {} : { DependsOn: declared };
70
- }
71
- /** Every `references` entry anywhere inside a resource's expressions. */
72
- function expressionReferences(value) {
73
- if (Array.isArray(value)) {
74
- return value.flatMap((entry) => expressionReferences(entry));
75
- }
76
- if (!isRecord(value)) {
77
- return [];
78
- }
79
- return Object.entries(value).flatMap(([key, nested]) => key === "references" && Array.isArray(nested)
80
- ? nested.filter((entry) => typeof entry === "string")
81
- : expressionReferences(nested));
82
- }
83
37
  //# sourceMappingURL=sim-tf-declare.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"sim-tf-declare.js","sourceRoot":"","sources":["../../src/terraform/sim-tf-declare.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,kDAAkD;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAiBxD;;;;;GAKG;AACH,MAAM,UAAU,0BAA0B,CACxC,OAA6B;IAE7B,MAAM,SAAS,GAAG,IAAI,GAAG,EAAqC,CAAC;IAC/D,MAAM,MAAM,GAAgC,EAAE,CAAC;IAC/C,MAAM,IAAI,GAA6B,EAAE,CAAC;IAE1C,KAAK,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;QACrD,MAAM,KAA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ACrC,CAAC"}
@@ -0,0 +1,21 @@
1
+ import type { TerraformResource } from "./sim-tf-resource.type.js";
2
+ import type { TerraformReferenceResolver } from "./sim-tf-reference.js";
3
+ /**
4
+ * The Resources one Resource has to be created after.
5
+ *
6
+ * A CloudFormation template orders itself, because a property that needs
7
+ * another Resource holds a `Ref` or an `Fn::GetAtt` naming it. A plan holds no
8
+ * such thing. Terraform resolves what it can before writing the plan, so a
9
+ * Lambda permission naming a function it creates in the same plan carries the
10
+ * function's name as a plain string, and the edge that ordering depends on is
11
+ * gone from the value.
12
+ *
13
+ * The edge survives in `configuration`, which records every reference the
14
+ * resource declares whether or not the value was resolved. Turning those back
15
+ * into `DependsOn` gives the Stack the graph it would have read off a template
16
+ * written by hand.
17
+ */
18
+ export declare function terraformDependsOn(resource: TerraformResource, resolver: TerraformReferenceResolver): {
19
+ DependsOn?: string[];
20
+ };
21
+ //# sourceMappingURL=sim-tf-depends-on.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sim-tf-depends-on.d.ts","sourceRoot":"","sources":["../../src/terraform/sim-tf-depends-on.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AAGxE;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,iBAAiB,EAC3B,QAAQ,EAAE,0BAA0B,GACnC;IAAE,SAAS,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,CAe1B"}
@@ -0,0 +1,30 @@
1
+ import { terraformExpressionReferences } from "./sim-tf-expression-references.js";
2
+ /**
3
+ * The Resources one Resource has to be created after.
4
+ *
5
+ * A CloudFormation template orders itself, because a property that needs
6
+ * another Resource holds a `Ref` or an `Fn::GetAtt` naming it. A plan holds no
7
+ * such thing. Terraform resolves what it can before writing the plan, so a
8
+ * Lambda permission naming a function it creates in the same plan carries the
9
+ * function's name as a plain string, and the edge that ordering depends on is
10
+ * gone from the value.
11
+ *
12
+ * The edge survives in `configuration`, which records every reference the
13
+ * resource declares whether or not the value was resolved. Turning those back
14
+ * into `DependsOn` gives the Stack the graph it would have read off a template
15
+ * written by hand.
16
+ */
17
+ export function terraformDependsOn(resource, resolver) {
18
+ const own = resolver.logicalId(resource.address);
19
+ const referenced = [
20
+ ...resource.dependsOn,
21
+ ...terraformExpressionReferences(resource.expressions),
22
+ ]
23
+ .map((reference) => resolver.targetAddress(reference, resource))
24
+ .filter((address) => address !== undefined)
25
+ .map((address) => resolver.logicalId(address))
26
+ .filter((logicalId) => logicalId !== own);
27
+ const declared = [...new Set(referenced)];
28
+ return declared.length === 0 ? {} : { DependsOn: declared };
29
+ }
30
+ //# sourceMappingURL=sim-tf-depends-on.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sim-tf-depends-on.js","sourceRoot":"","sources":["../../src/terraform/sim-tf-depends-on.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,6BAA6B,EAAE,MAAM,mCAAmC,CAAC;AAElF;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,kBAAkB,CAChC,QAA2B,EAC3B,QAAoC;IAEpC,MAAM,GAAG,GAAG,QAAQ,CAAC,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IAEjD,MAAM,UAAU,GAAG;QACjB,GAAG,QAAQ,CAAC,SAAS;QACrB,GAAG,6BAA6B,CAAC,QAAQ,CAAC,WAAW,CAAC;KACvD;SACE,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,QAAQ,CAAC,aAAa,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;SAC/D,MAAM,CAAC,CAAC,OAAO,EAAqB,EAAE,CAAC,OAAO,KAAK,SAAS,CAAC;SAC7D,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;SAC7C,MAAM,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,KAAK,GAAG,CAAC,CAAC;IAE5C,MAAM,QAAQ,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC;IAE1C,OAAO,QAAQ,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC;AAC9D,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Every `references` entry anywhere inside an expression.
3
+ *
4
+ * A plan writes an expression as a record holding `references`, and nests
5
+ * that record wherever the configuration nested the expression. A nested block
6
+ * becomes a list of records, and a block inside a block becomes a list inside
7
+ * a record, so reaching every reference means walking whatever shape the
8
+ * configuration had rather than reading one key.
9
+ */
10
+ export declare function terraformExpressionReferences(value: unknown): readonly string[];
11
+ //# sourceMappingURL=sim-tf-expression-references.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sim-tf-expression-references.d.ts","sourceRoot":"","sources":["../../src/terraform/sim-tf-expression-references.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,wBAAgB,6BAA6B,CAC3C,KAAK,EAAE,OAAO,GACb,SAAS,MAAM,EAAE,CAcnB"}
@@ -0,0 +1,22 @@
1
+ import { isRecord } from "../util/type-guard/record.js";
2
+ /**
3
+ * Every `references` entry anywhere inside an expression.
4
+ *
5
+ * A plan writes an expression as a record holding `references`, and nests
6
+ * that record wherever the configuration nested the expression. A nested block
7
+ * becomes a list of records, and a block inside a block becomes a list inside
8
+ * a record, so reaching every reference means walking whatever shape the
9
+ * configuration had rather than reading one key.
10
+ */
11
+ export function terraformExpressionReferences(value) {
12
+ if (Array.isArray(value)) {
13
+ return value.flatMap((entry) => terraformExpressionReferences(entry));
14
+ }
15
+ if (!isRecord(value)) {
16
+ return [];
17
+ }
18
+ return Object.entries(value).flatMap(([key, nested]) => key === "references" && Array.isArray(nested)
19
+ ? nested.filter((entry) => typeof entry === "string")
20
+ : terraformExpressionReferences(nested));
21
+ }
22
+ //# sourceMappingURL=sim-tf-expression-references.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sim-tf-expression-references.js","sourceRoot":"","sources":["../../src/terraform/sim-tf-expression-references.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAExD;;;;;;;;GAQG;AACH,MAAM,UAAU,6BAA6B,CAC3C,KAAc;IAEd,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,KAAK,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,6BAA6B,CAAC,KAAK,CAAC,CAAC,CAAC;IACxE,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,6BAA6B,CAAC,MAAM,CAAC,CAC1C,CAAC;AACJ,CAAC"}
@@ -1,4 +1,6 @@
1
1
  import type { TerraformPlan } from "./sim-tf-plan.type.js";
2
+ import type { TerraformResource } from "./sim-tf-resource.type.js";
3
+ import type { TerraformResourceAddresses } from "./sim-tf-reference-addresses.js";
2
4
  /**
3
5
  * Every module output a plan declares, keyed by the address that reads it.
4
6
  *
@@ -8,4 +10,41 @@ import type { TerraformPlan } from "./sim-tf-plan.type.js";
8
10
  * output's own expression and continuing from the module that declares it.
9
11
  */
10
12
  export declare function terraformModuleOutputs(plan: TerraformPlan): ReadonlyMap<string, readonly string[]>;
13
+ /**
14
+ * Following a reference that names a module output.
15
+ *
16
+ * `module.processor.lambda_function_arn` is an address no resource has. The
17
+ * output's own expression names what it reads, in terms of the module
18
+ * declaring it, so following one is resolving that expression again a module
19
+ * down.
20
+ */
21
+ export declare class TerraformModuleOutputWalk {
22
+ private readonly outputs;
23
+ private readonly resources;
24
+ constructor(outputs: ReadonlyMap<string, readonly string[]>, resources: TerraformResourceAddresses);
25
+ /**
26
+ * The resource a module output leads to.
27
+ *
28
+ * An output built out of several resources answers with the first that
29
+ * resolves, and the depth limit stops a module whose outputs refer to each
30
+ * other from looping.
31
+ */
32
+ target(qualified: string, depth?: number): TerraformResource | undefined;
33
+ /**
34
+ * The attribute a reference through an output reads.
35
+ *
36
+ * The reference names the output, and the output's own expression is what
37
+ * says which attribute of the resource behind it was being read.
38
+ */
39
+ attributeOf(qualified: string): string | undefined;
40
+ /**
41
+ * The references one output declares.
42
+ *
43
+ * The index is keyed by module call path, since a module declares its
44
+ * outputs once however many instances of the call there are. A reference
45
+ * made from inside one instance carries that instance's key, so the key
46
+ * comes off when the qualified form finds nothing.
47
+ */
48
+ private references;
49
+ }
11
50
  //# sourceMappingURL=sim-tf-module-outputs.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sim-tf-module-outputs.d.ts","sourceRoot":"","sources":["../../src/terraform/sim-tf-module-outputs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,aAAa,EACd,MAAM,uBAAuB,CAAC;AAE/B;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,aAAa,GAClB,WAAW,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CASxC"}
1
+ {"version":3,"file":"sim-tf-module-outputs.d.ts","sourceRoot":"","sources":["../../src/terraform/sim-tf-module-outputs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,aAAa,EACd,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAQlF;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,aAAa,GAClB,WAAW,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CASxC;AAgCD;;;;;;;GAOG;AACH,qBAAa,yBAAyB;IAElC,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAF5B,YACmB,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,EAC/C,SAAS,EAAE,0BAA0B,EACpD;IAEJ;;;;;;OAMG;IACI,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,SAAI,GAAG,iBAAiB,GAAG,SAAS,CAuBzE;IAED;;;;;OAKG;IACI,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAIxD;IAED;;;;;;;OAOG;IACH,OAAO,CAAC,UAAU;CAMnB"}
@@ -1,3 +1,4 @@
1
+ import { longestFirst, moduleOutputPath, qualifiedReference, withoutInstanceKeys, } from "./sim-tf-reference-address.js";
1
2
  /**
2
3
  * Every module output a plan declares, keyed by the address that reads it.
3
4
  *
@@ -30,4 +31,69 @@ function collect(config, modulePath, outputs) {
30
31
  collect(child, childPath, outputs);
31
32
  }
32
33
  }
34
+ /** How far a chain of outputs is followed before it is taken to be a loop. */
35
+ const outputLimit = 8;
36
+ /**
37
+ * Following a reference that names a module output.
38
+ *
39
+ * `module.processor.lambda_function_arn` is an address no resource has. The
40
+ * output's own expression names what it reads, in terms of the module
41
+ * declaring it, so following one is resolving that expression again a module
42
+ * down.
43
+ */
44
+ export class TerraformModuleOutputWalk {
45
+ outputs;
46
+ resources;
47
+ constructor(outputs, resources) {
48
+ this.outputs = outputs;
49
+ this.resources = resources;
50
+ }
51
+ /**
52
+ * The resource a module output leads to.
53
+ *
54
+ * An output built out of several resources answers with the first that
55
+ * resolves, and the depth limit stops a module whose outputs refer to each
56
+ * other from looping.
57
+ */
58
+ target(qualified, depth = 0) {
59
+ const output = this.references(qualified);
60
+ if (output === undefined || depth >= outputLimit) {
61
+ return undefined;
62
+ }
63
+ // The path the output was read through rather than the one it was
64
+ // declared under, so an output reached inside a `for_each` instance
65
+ // follows its own instance's resources.
66
+ const instance = moduleOutputPath(qualified);
67
+ for (const reference of longestFirst(output)) {
68
+ const nested = qualifiedReference(reference, instance);
69
+ const target = this.resources.longestMatch(nested) ?? this.target(nested, depth + 1);
70
+ if (target !== undefined) {
71
+ return target;
72
+ }
73
+ }
74
+ return undefined;
75
+ }
76
+ /**
77
+ * The attribute a reference through an output reads.
78
+ *
79
+ * The reference names the output, and the output's own expression is what
80
+ * says which attribute of the resource behind it was being read.
81
+ */
82
+ attributeOf(qualified) {
83
+ const [longest] = longestFirst(this.references(qualified) ?? []);
84
+ return longest?.split(".").pop();
85
+ }
86
+ /**
87
+ * The references one output declares.
88
+ *
89
+ * The index is keyed by module call path, since a module declares its
90
+ * outputs once however many instances of the call there are. A reference
91
+ * made from inside one instance carries that instance's key, so the key
92
+ * comes off when the qualified form finds nothing.
93
+ */
94
+ references(qualified) {
95
+ return (this.outputs.get(qualified) ??
96
+ this.outputs.get(withoutInstanceKeys(qualified)));
97
+ }
98
+ }
33
99
  //# sourceMappingURL=sim-tf-module-outputs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"sim-tf-module-outputs.js","sourceRoot":"","sources":["../../src/terraform/sim-tf-module-outputs.ts"],"names":[],"mappings":"AAKA;;;;;;;GAOG;AACH,MAAM,UAAU,sBAAsB,CACpC,IAAmB;IAEnB,MAAM,OAAO,GAAG,IAAI,GAAG,EAA6B,CAAC;IACrD,MAAM,IAAI,GAAG,IAAI,CAAC,aAAa,EAAE,WAAW,CAAC;IAE7C,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;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CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC;YAC3B,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC,CACjD,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,16 @@
1
+ import type { TerraformPlan } from "./sim-tf-plan.type.js";
2
+ /**
3
+ * Every variable a module call sets, keyed by the address that names it.
4
+ *
5
+ * A resource inside a module reads its module's own variables, and the value
6
+ * behind one was written by the caller. `var.routes` is not an address any
7
+ * resource has and the plan resolves nothing for it, so following it means
8
+ * reading the call's own expression and continuing from the module that made
9
+ * the call.
10
+ *
11
+ * This is the mirror of `terraformModuleOutputs`. An output carries a value up
12
+ * out of a module and a variable carries one down into it, and the two are the
13
+ * only ways a plan lets a reference cross a module boundary.
14
+ */
15
+ export declare function terraformModuleVariables(plan: TerraformPlan): ReadonlyMap<string, readonly string[]>;
16
+ //# sourceMappingURL=sim-tf-module-variables.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sim-tf-module-variables.d.ts","sourceRoot":"","sources":["../../src/terraform/sim-tf-module-variables.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,aAAa,EACd,MAAM,uBAAuB,CAAC;AAG/B;;;;;;;;;;;;GAYG;AACH,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,aAAa,GAClB,WAAW,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CASxC"}
@@ -0,0 +1,37 @@
1
+ import { terraformExpressionReferences } from "./sim-tf-expression-references.js";
2
+ /**
3
+ * Every variable a module call sets, keyed by the address that names it.
4
+ *
5
+ * A resource inside a module reads its module's own variables, and the value
6
+ * behind one was written by the caller. `var.routes` is not an address any
7
+ * resource has and the plan resolves nothing for it, so following it means
8
+ * reading the call's own expression and continuing from the module that made
9
+ * the call.
10
+ *
11
+ * This is the mirror of `terraformModuleOutputs`. An output carries a value up
12
+ * out of a module and a variable carries one down into it, and the two are the
13
+ * only ways a plan lets a reference cross a module boundary.
14
+ */
15
+ export function terraformModuleVariables(plan) {
16
+ const variables = new Map();
17
+ const root = plan.configuration?.root_module;
18
+ if (root !== undefined) {
19
+ collect(root, [], variables);
20
+ }
21
+ return variables;
22
+ }
23
+ function collect(config, modulePath, variables) {
24
+ const calls = Object.entries(config.module_calls ?? {});
25
+ for (const [callName, call] of calls) {
26
+ const childPath = [...modulePath, callName];
27
+ const address = childPath.map((name) => `module.${name}`).join(".");
28
+ const set = Object.entries(call.expressions ?? {});
29
+ for (const [name, expression] of set) {
30
+ variables.set(`${address}.var.${name}`, terraformExpressionReferences(expression));
31
+ }
32
+ if (call.module !== undefined) {
33
+ collect(call.module, childPath, variables);
34
+ }
35
+ }
36
+ }
37
+ //# sourceMappingURL=sim-tf-module-variables.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sim-tf-module-variables.js","sourceRoot":"","sources":["../../src/terraform/sim-tf-module-variables.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,6BAA6B,EAAE,MAAM,mCAAmC,CAAC;AAElF;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,wBAAwB,CACtC,IAAmB;IAEnB,MAAM,SAAS,GAAG,IAAI,GAAG,EAA6B,CAAC;IACvD,MAAM,IAAI,GAAG,IAAI,CAAC,aAAa,EAAE,WAAW,CAAC;IAE7C,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,OAAO,CAAC,IAAI,EAAE,EAAE,EAAE,SAAS,CAAC,CAAC;IAC/B,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAS,OAAO,CACd,MAA6B,EAC7B,UAA6B,EAC7B,SAAyC;IAEzC,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,YAAY,IAAI,EAAE,CAAC,CAAC;IAExD,KAAK,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC,IAAI,KAAK,EAAE,CAAC;QACrC,MAAM,SAAS,GAAG,CAAC,GAAG,UAAU,EAAE,QAAQ,CAAC,CAAC;QAC5C,MAAM,OAAO,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,UAAU,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAEpE,MAAM,GAAG,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC;QAEnD,KAAK,MAAM,CAAC,IAAI,EAAE,UAAU,CAAC,IAAI,GAAG,EAAE,CAAC;YACrC,SAAS,CAAC,GAAG,CACX,GAAG,OAAO,QAAQ,IAAI,EAAE,EACxB,6BAA6B,CAAC,UAAU,CAAC,CAC1C,CAAC;QACJ,CAAC;QAED,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;YAC9B,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;QAC7C,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -37,7 +37,7 @@ export function attributeList(context, key) {
37
37
  const resolved = new Map();
38
38
  const declared = longestFirst(references(resource.expressions[key]));
39
39
  for (const reference of declared) {
40
- const value = resolver.resolve(reference, resource.modulePath);
40
+ const value = resolver.resolve(reference, resource);
41
41
  if (value !== undefined) {
42
42
  resolved.set(JSON.stringify(value), value);
43
43
  }
@@ -60,7 +60,7 @@ export function blockAttribute(context, key, index, name) {
60
60
  const expression = entry(resource.expressions[key], index)?.[name];
61
61
  const declared = longestFirst(references(expression));
62
62
  for (const reference of declared) {
63
- const value = resolver.resolve(reference, resource.modulePath);
63
+ const value = resolver.resolve(reference, resource);
64
64
  if (value !== undefined) {
65
65
  return value;
66
66
  }
@@ -1 +1 @@
1
- {"version":3,"file":"sim-tf-nested-attributes.js","sourceRoot":"","sources":["../../src/terraform/sim-tf-nested-attributes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,kDAAkD;AAClD,OAAO,EAAE,QAAQ,EAAE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SAAS,iBAAiB,EAAE,CAa9B"}
1
+ {"version":3,"file":"sim-tf-plan-resources.d.ts","sourceRoot":"","sources":["../../src/terraform/sim-tf-plan-resources.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAGV,aAAa,EAGd,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAUnE;;;;;;;;;;;;;GAaG;AACH,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,aAAa,GAClB,SAAS,iBAAiB,EAAE,CAa9B"}
@@ -1,3 +1,4 @@
1
+ import { terraformExpressionReferences } from "./sim-tf-expression-references.js";
1
2
  import { childModuleCallName, childModuleSegment, configResourcesByKey, providerShortName, unknownAttributesByAddress, } from "./sim-tf-plan-sections.js";
2
3
  /**
3
4
  * Every managed AWS resource a plan will create, in declaration order.
@@ -46,6 +47,7 @@ function joined(resource, declared, modulePath, unknown) {
46
47
  unknown: unknown.get(resource.address) ?? {},
47
48
  expressions: config?.expressions ?? {},
48
49
  dependsOn: config?.depends_on ?? [],
50
+ forEach: terraformExpressionReferences(config?.for_each_expression),
49
51
  modulePath,
50
52
  };
51
53
  }
@@ -1 +1 @@
1
- {"version":3,"file":"sim-tf-plan-resources.js","sourceRoot":"","sources":["../../src/terraform/sim-tf-plan-resources.ts"],"names":[],"mappings":"AAcA,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,oBAAoB,EACpB,iBAAiB,EACjB,0BAA0B,GAC3B,MAAM,2BAA2B,CAAC;AAEnC;;;;;;;;;;;;;GAaG;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,EAA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CAAC,MAAM,IAAI,EAAE;QAC7B,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE;QAC5C,WAAW,EAAE,MAAM,EAAE,WAAW,IAAI,EAAE;QACtC,SAAS,EAAE,MAAM,EAAE,UAAU,IAAI,EAAE;QACnC,OAAO,EAAE,6BAA6B,CAAC,MAAM,EAAE,mBAAmB,CAAC;QACnE,UAAU;KACX,CAAC;AACJ,CAAC"}
@@ -68,9 +68,19 @@ export interface TerraformResourceChange {
68
68
  export interface TerraformConfigModule {
69
69
  readonly resources?: readonly TerraformConfigResource[];
70
70
  readonly outputs?: Record<string, TerraformConfigOutput>;
71
- readonly module_calls?: Record<string, {
72
- readonly module?: TerraformConfigModule;
73
- }>;
71
+ readonly module_calls?: Record<string, TerraformConfigModuleCall>;
72
+ }
73
+ /**
74
+ * One `module` block, holding the module it calls and what it sets on it.
75
+ *
76
+ * `expressions` is keyed by variable name and holds what the caller wrote for
77
+ * each one, in the same shape a resource attribute's expression takes. A
78
+ * variable set from a resource of the calling module carries the reference
79
+ * rather than a value.
80
+ */
81
+ export interface TerraformConfigModuleCall {
82
+ readonly module?: TerraformConfigModule;
83
+ readonly expressions?: Record<string, unknown>;
74
84
  }
75
85
  export interface TerraformConfigResource {
76
86
  readonly address: string;
@@ -79,6 +89,13 @@ export interface TerraformConfigResource {
79
89
  readonly name: string;
80
90
  readonly expressions?: Record<string, unknown>;
81
91
  readonly depends_on?: readonly string[];
92
+ /**
93
+ * What `for_each` iterates, as the references its expression holds.
94
+ *
95
+ * `planned_values` carries the instances rather than the collection, so this
96
+ * is the only place a plan says what `each` was iterating.
97
+ */
98
+ readonly for_each_expression?: unknown;
82
99
  }
83
100
  export interface TerraformConfigOutput {
84
101
  readonly expression?: TerraformExpression;
@@ -1 +1 @@
1
- {"version":3,"file":"sim-tf-plan.type.d.ts","sourceRoot":"","sources":["../../src/terraform/sim-tf-plan.type.ts"],"names":[],"mappings":"AAAA;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