@kensio/yulin 1.19.0 → 1.19.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/service/cloudformation/deploy/sim-cfn-cdk-out-deployer.d.ts +2 -2
- package/dist/service/cloudformation/deploy/sim-cfn-cdk-out-deployer.d.ts.map +1 -1
- package/dist/service/cloudformation/deploy/sim-cfn-cdk-out-deployer.js.map +1 -1
- package/dist/service/cloudformation/deploy/sim-cfn-cdk-out-stack-options.d.ts +3 -3
- package/dist/service/cloudformation/deploy/sim-cfn-cdk-out-stack-options.d.ts.map +1 -1
- package/dist/service/cloudformation/deploy/sim-cfn-cdk-out-stack-options.js.map +1 -1
- package/dist/service/cloudformation/deploy/sim-cfn-template-deployer.d.ts +5 -4
- package/dist/service/cloudformation/deploy/sim-cfn-template-deployer.d.ts.map +1 -1
- package/dist/service/cloudformation/deploy/sim-cfn-template-deployer.js.map +1 -1
- package/dist/service/cloudformation/index.d.ts +7 -0
- package/dist/service/cloudformation/index.d.ts.map +1 -1
- package/dist/service/cloudformation/resource/sim-cfn-deployed-resource.type.d.ts +59 -0
- package/dist/service/cloudformation/resource/sim-cfn-deployed-resource.type.d.ts.map +1 -0
- package/dist/service/cloudformation/resource/sim-cfn-deployed-resource.type.js +2 -0
- package/dist/service/cloudformation/resource/sim-cfn-deployed-resource.type.js.map +1 -0
- package/dist/service/cloudformation/sim-cloudformation.d.ts +8 -9
- package/dist/service/cloudformation/sim-cloudformation.d.ts.map +1 -1
- package/dist/service/cloudformation/sim-cloudformation.js +1 -3
- package/dist/service/cloudformation/sim-cloudformation.js.map +1 -1
- package/dist/service/cloudformation/stack/sim-cfn-deployed-stack.type.d.ts +68 -0
- package/dist/service/cloudformation/stack/sim-cfn-deployed-stack.type.d.ts.map +1 -0
- package/dist/service/cloudformation/stack/sim-cfn-deployed-stack.type.js +2 -0
- package/dist/service/cloudformation/stack/sim-cfn-deployed-stack.type.js.map +1 -0
- package/dist/service/cloudformation/stack/sim-cfn-stack.d.ts +2 -1
- package/dist/service/cloudformation/stack/sim-cfn-stack.d.ts.map +1 -1
- package/dist/service/cloudformation/stack/sim-cfn-stack.fixture.d.ts +21 -0
- package/dist/service/cloudformation/stack/sim-cfn-stack.fixture.d.ts.map +1 -0
- package/dist/service/cloudformation/stack/sim-cfn-stack.fixture.js +21 -0
- package/dist/service/cloudformation/stack/sim-cfn-stack.fixture.js.map +1 -0
- package/dist/service/cloudformation/stack/sim-cfn-stack.js.map +1 -1
- package/dist/service/cloudformation/terraform/sim-tf-attribute-reads.d.ts +12 -0
- package/dist/service/cloudformation/terraform/sim-tf-attribute-reads.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-attribute-reads.js +60 -0
- package/dist/service/cloudformation/terraform/sim-tf-attribute-reads.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-attributes.d.ts +60 -0
- package/dist/service/cloudformation/terraform/sim-tf-attributes.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-attributes.js +121 -0
- package/dist/service/cloudformation/terraform/sim-tf-attributes.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-config.d.ts +14 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-config.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-config.js +36 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-config.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-dynamodb.d.ts +15 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-dynamodb.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-dynamodb.js +74 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-dynamodb.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-http-api-route.d.ts +5 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-http-api-route.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-http-api-route.js +32 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-http-api-route.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-http-api.d.ts +12 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-http-api.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-http-api.js +52 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-http-api.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-iam.d.ts +9 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-iam.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-iam.js +80 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-iam.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-lambda.d.ts +19 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-lambda.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-lambda.js +90 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-lambda.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-s3-cors.d.ts +5 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-s3-cors.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-s3-cors.js +12 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-s3-cors.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-s3-encryption.d.ts +5 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-s3-encryption.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-s3-encryption.js +32 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-s3-encryption.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-s3-folds.d.ts +9 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-s3-folds.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-s3-folds.js +48 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-s3-folds.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-s3.d.ts +5 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-s3.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-s3.js +18 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-s3.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-sns.d.ts +15 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-sns.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-sns.js +40 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-sns.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-sqs.d.ts +5 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-sqs.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-sqs.js +56 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-sqs.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-mapping.type.d.ts +41 -0
- package/dist/service/cloudformation/terraform/sim-tf-mapping.type.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-mapping.type.js +2 -0
- package/dist/service/cloudformation/terraform/sim-tf-mapping.type.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-module-outputs.d.ts +19 -0
- package/dist/service/cloudformation/terraform/sim-tf-module-outputs.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-module-outputs.js +63 -0
- package/dist/service/cloudformation/terraform/sim-tf-module-outputs.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-plan-index.d.ts +26 -0
- package/dist/service/cloudformation/terraform/sim-tf-plan-index.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-plan-index.js +45 -0
- package/dist/service/cloudformation/terraform/sim-tf-plan-index.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-plan-resources.d.ts +39 -0
- package/dist/service/cloudformation/terraform/sim-tf-plan-resources.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-plan-resources.js +44 -0
- package/dist/service/cloudformation/terraform/sim-tf-plan-resources.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-plan.type.d.ts +94 -0
- package/dist/service/cloudformation/terraform/sim-tf-plan.type.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-plan.type.js +2 -0
- package/dist/service/cloudformation/terraform/sim-tf-plan.type.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-reference-address.d.ts +27 -0
- package/dist/service/cloudformation/terraform/sim-tf-reference-address.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-reference-address.js +58 -0
- package/dist/service/cloudformation/terraform/sim-tf-reference-address.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-reference.d.ts +64 -0
- package/dist/service/cloudformation/terraform/sim-tf-reference.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-reference.js +122 -0
- package/dist/service/cloudformation/terraform/sim-tf-reference.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-registry.d.ts +14 -0
- package/dist/service/cloudformation/terraform/sim-tf-registry.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-registry.js +40 -0
- package/dist/service/cloudformation/terraform/sim-tf-registry.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-report.type.d.ts +31 -0
- package/dist/service/cloudformation/terraform/sim-tf-report.type.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-report.type.js +2 -0
- package/dist/service/cloudformation/terraform/sim-tf-report.type.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-folds.d.ts +20 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-folds.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-folds.js +28 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-folds.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-graph.d.ts +29 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-graph.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-graph.js +71 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-graph.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-mappings.d.ts +23 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-mappings.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-mappings.js +72 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-mappings.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-merge.d.ts +21 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-merge.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-merge.js +33 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-merge.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-prune.d.ts +21 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-prune.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-prune.js +51 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-prune.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-pruned.d.ts +18 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-pruned.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-pruned.js +23 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-pruned.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-references.d.ts +10 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-references.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-references.js +39 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-references.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-resolver.d.ts +12 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-resolver.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-resolver.js +17 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-resolver.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-template.d.ts +26 -0
- package/dist/service/cloudformation/terraform/sim-tf-template.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-template.js +54 -0
- package/dist/service/cloudformation/terraform/sim-tf-template.js.map +1 -0
- package/dist/service/cognito/command/hosted/sim-cognito-hosted-passkey-sign-in.d.ts +6 -0
- package/dist/service/cognito/command/hosted/sim-cognito-hosted-passkey-sign-in.d.ts.map +1 -1
- package/dist/service/cognito/command/hosted/sim-cognito-hosted-passkey-sign-in.js +8 -3
- package/dist/service/cognito/command/hosted/sim-cognito-hosted-passkey-sign-in.js.map +1 -1
- package/dist/service/elbv2/cfn/sim-cfn-elbv2.fixture.d.ts +2 -2
- package/dist/service/elbv2/cfn/sim-cfn-elbv2.fixture.d.ts.map +1 -1
- package/dist/service/elbv2/cfn/sim-cfn-elbv2.fixture.js.map +1 -1
- package/dist/util/filesystem/test-terraform-project.d.ts +56 -0
- package/dist/util/filesystem/test-terraform-project.d.ts.map +1 -0
- package/dist/util/filesystem/test-terraform-project.js +83 -0
- package/dist/util/filesystem/test-terraform-project.js.map +1 -0
- package/package.json +3 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-tf-map-iam.js","sourceRoot":"","sources":["../../../../src/service/cloudformation/terraform/sim-tf-map-iam.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,kDAAkD;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAE9D,OAAO,EACL,SAAS,EACT,KAAK,EACL,UAAU,EACV,OAAO,EACP,IAAI,EACJ,aAAa,GAEd,MAAM,wBAAwB,CAAC;AAMhC,mEAAmE;AACnE,MAAM,UAAU,OAAO,CACrB,OAAgC;IAEhC,MAAM,MAAM,GAAG,YAAY,CACzB,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,EAAE,oBAAoB,CAAC,CACrD,CAAC;IAEF,OAAO;QACL,IAAI,EAAE,gBAAgB;Q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CAAC,EAAE,UAAU,EAAE,UAAU,CAAC,OAAO,CAAC,EAAE,cAAc,EAAE,QAAQ,EAAE,CAAC;KAC1E,CAAC;AACJ,CAAC;AAED,SAAS,aAAa,CACpB,OAAgC;IAEhC,MAAM,GAAG,GAAG,SAAS,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;IAE7C,OAAO,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,iBAAiB,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC;AAC/D,CAAC;AAED,0EAA0E;AAC1E,SAAS,UAAU,CAAC,OAAgC;IAClD,MAAM,IAAI,GAAG,SAAS,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAExC,OAAO,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC;AACvE,CAAC;AAED;;;;;;GAMG;AACH,SAAS,YAAY,CAAC,KAAc;IAClC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,MAAM,GAAY,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAE1C,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAC9D,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type TerraformMappingContext } from "./sim-tf-attributes.js";
|
|
2
|
+
import type { TerraformMappedResource } from "./sim-tf-mapping.type.js";
|
|
3
|
+
/**
|
|
4
|
+
* A function, minus its code.
|
|
5
|
+
*
|
|
6
|
+
* Terraform points at a zip on disk, an S3 object or a container image, and
|
|
7
|
+
* none of the three is a handler Yulin can run. A simulated function takes its
|
|
8
|
+
* behaviour from a deploy binding instead, matched on the function name the
|
|
9
|
+
* template carries.
|
|
10
|
+
*/
|
|
11
|
+
export declare function lambdaFunction(context: TerraformMappingContext): TerraformMappedResource;
|
|
12
|
+
/** One permission to invoke a function. */
|
|
13
|
+
export declare function lambdaPermission(context: TerraformMappingContext): TerraformMappedResource;
|
|
14
|
+
/**
|
|
15
|
+
* An event source mapping. Simulated Lambda checks the execution role is
|
|
16
|
+
* allowed to poll the source, so a role whose policy the plan lost fails here.
|
|
17
|
+
*/
|
|
18
|
+
export declare function lambdaEventSourceMapping(context: TerraformMappingContext): TerraformMappedResource;
|
|
19
|
+
//# sourceMappingURL=sim-tf-map-lambda.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-tf-map-lambda.d.ts","sourceRoot":"","sources":["../../../../src/service/cloudformation/terraform/sim-tf-map-lambda.ts"],"names":[],"mappings":"AAQA,OAAO,EAOL,KAAK,uBAAuB,EAC7B,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAExE;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,uBAAuB,GAC/B,uBAAuB,CAqBzB;AAuCD,2CAA2C;AAC3C,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,uBAAuB,GAC/B,uBAAuB,CAUzB;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,uBAAuB,GAC/B,uBAAuB,CAUzB"}
|
|
@@ -0,0 +1,90 @@
|
|
|
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 { block, field, properties, renamed, tags, templateValue, } from "./sim-tf-attributes.js";
|
|
9
|
+
/**
|
|
10
|
+
* A function, minus its code.
|
|
11
|
+
*
|
|
12
|
+
* Terraform points at a zip on disk, an S3 object or a container image, and
|
|
13
|
+
* none of the three is a handler Yulin can run. A simulated function takes its
|
|
14
|
+
* behaviour from a deploy binding instead, matched on the function name the
|
|
15
|
+
* template carries.
|
|
16
|
+
*/
|
|
17
|
+
export function lambdaFunction(context) {
|
|
18
|
+
const variables = environmentVariables(context);
|
|
19
|
+
return {
|
|
20
|
+
Type: "AWS::Lambda::Function",
|
|
21
|
+
Properties: {
|
|
22
|
+
...renamed(context, {
|
|
23
|
+
FunctionName: "function_name",
|
|
24
|
+
Handler: "handler",
|
|
25
|
+
Runtime: "runtime",
|
|
26
|
+
Role: "role",
|
|
27
|
+
Timeout: "timeout",
|
|
28
|
+
MemorySize: "memory_size",
|
|
29
|
+
}),
|
|
30
|
+
...properties({
|
|
31
|
+
Environment: variables && { Variables: variables },
|
|
32
|
+
Tags: tags(context),
|
|
33
|
+
}),
|
|
34
|
+
},
|
|
35
|
+
lost: lost(context, variables),
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
function environmentVariables(context) {
|
|
39
|
+
const environment = block(context, "environment");
|
|
40
|
+
const variables = environment && field(environment, "variables");
|
|
41
|
+
if (!isRecord(variables)) {
|
|
42
|
+
return undefined;
|
|
43
|
+
}
|
|
44
|
+
const value = templateValue(variables);
|
|
45
|
+
return value;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* What the mapping could not carry.
|
|
49
|
+
*
|
|
50
|
+
* The code is always one. The environment variables are another whenever any
|
|
51
|
+
* value in the map names a resource of the same plan, because Terraform marks
|
|
52
|
+
* the whole map unknown and the variable names go with it.
|
|
53
|
+
*/
|
|
54
|
+
function lost(context, variables) {
|
|
55
|
+
const declared = field(context.resource.unknown, "environment");
|
|
56
|
+
const entries = Array.isArray(declared) ? declared : [];
|
|
57
|
+
const first = entries[0];
|
|
58
|
+
const collapsed = isRecord(first) &&
|
|
59
|
+
field(first, "variables") === true &&
|
|
60
|
+
variables === undefined;
|
|
61
|
+
return collapsed ? ["code", "environment.variables"] : ["code"];
|
|
62
|
+
}
|
|
63
|
+
/** One permission to invoke a function. */
|
|
64
|
+
export function lambdaPermission(context) {
|
|
65
|
+
return {
|
|
66
|
+
Type: "AWS::Lambda::Permission",
|
|
67
|
+
Properties: renamed(context, {
|
|
68
|
+
FunctionName: "function_name",
|
|
69
|
+
Action: "action",
|
|
70
|
+
Principal: "principal",
|
|
71
|
+
SourceArn: "source_arn",
|
|
72
|
+
}),
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* An event source mapping. Simulated Lambda checks the execution role is
|
|
77
|
+
* allowed to poll the source, so a role whose policy the plan lost fails here.
|
|
78
|
+
*/
|
|
79
|
+
export function lambdaEventSourceMapping(context) {
|
|
80
|
+
return {
|
|
81
|
+
Type: "AWS::Lambda::EventSourceMapping",
|
|
82
|
+
Properties: renamed(context, {
|
|
83
|
+
EventSourceArn: "event_source_arn",
|
|
84
|
+
FunctionName: "function_name",
|
|
85
|
+
BatchSize: "batch_size",
|
|
86
|
+
Enabled: "enabled",
|
|
87
|
+
}),
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=sim-tf-map-lambda.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-tf-map-lambda.js","sourceRoot":"","sources":["../../../../src/service/cloudformation/terraform/sim-tf-map-lambda.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,kDAAkD;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAE9D,OAAO,EACL,KAAK,EACL,KAAK,EACL,UAAU,EACV,OAAO,EACP,IAAI,EACJ,aAAa,GAEd,MAAM,wBAAwB,CAAC;AAGhC;;;;;;;GAOG;AACH,MAAM,UAAU,cAAc,CAC5B,OAAgC;IAEhC,MAAM,SAAS,GAAG,oBAAoB,CAAC,OAAO,CAAC,CAAC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AAC,KAAK,EAAE,WAAW,CAAC,KAAK,IAAI;QAClC,SAAS,KAAK,SAAS,CAAC;IAE1B,OAAO,SAAS,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;AAClE,CAAC;AAED,2CAA2C;AAC3C,MAAM,UAAU,gBAAgB,CAC9B,OAAgC;IAEhC,OAAO;QACL,IAAI,EAAE,yBAAyB;QAC/B,UAAU,EAAE,OAAO,CAAC,OAAO,EAAE;YAC3B,YAAY,EAAE,eAAe;YAC7B,MAAM,EAAE,QAAQ;YAChB,SAAS,EAAE,WAAW;YACtB,SAAS,EAAE,YAAY;SACxB,CAAC;KACH,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,wBAAwB,CACtC,OAAgC;IAEhC,OAAO;QACL,IAAI,EAAE,iCAAiC;QACvC,UAAU,EAAE,OAAO,CAAC,OAAO,EAAE;YAC3B,cAAc,EAAE,kBAAkB;YAClC,YAAY,EAAE,eAAe;YAC7B,SAAS,EAAE,YAAY;YACvB,OAAO,EAAE,SAAS;SACnB,CAAC;KACH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { SimCfnTemplateValue } from "../template/value/sim-cfn-template-value.js";
|
|
2
|
+
import { type TerraformMappingContext } from "./sim-tf-attributes.js";
|
|
3
|
+
/** The CORS rules a bucket answers browser requests under. */
|
|
4
|
+
export declare function cors(context: TerraformMappingContext): Record<string, SimCfnTemplateValue>;
|
|
5
|
+
//# sourceMappingURL=sim-tf-map-s3-cors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-tf-map-s3-cors.d.ts","sourceRoot":"","sources":["../../../../src/service/cloudformation/terraform/sim-tf-map-s3-cors.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAC;AACvF,OAAO,EAIL,KAAK,uBAAuB,EAC7B,MAAM,wBAAwB,CAAC;AAEhC,8DAA8D;AAC9D,wBAAgB,IAAI,CAClB,OAAO,EAAE,uBAAuB,GAC/B,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAWrC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { blocks, field, properties, } from "./sim-tf-attributes.js";
|
|
2
|
+
/** The CORS rules a bucket answers browser requests under. */
|
|
3
|
+
export function cors(context) {
|
|
4
|
+
const rules = blocks(context, "cors_rule").map((rule) => properties({
|
|
5
|
+
AllowedHeaders: field(rule, "allowed_headers"),
|
|
6
|
+
AllowedMethods: field(rule, "allowed_methods"),
|
|
7
|
+
AllowedOrigins: field(rule, "allowed_origins"),
|
|
8
|
+
MaxAge: field(rule, "max_age_seconds"),
|
|
9
|
+
}));
|
|
10
|
+
return { CorsConfiguration: { CorsRules: rules } };
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=sim-tf-map-s3-cors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-tf-map-s3-cors.js","sourceRoot":"","sources":["../../../../src/service/cloudformation/terraform/sim-tf-map-s3-cors.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,MAAM,EACN,KAAK,EACL,UAAU,GAEX,MAAM,wBAAwB,CAAC;AAEhC,8DAA8D;AAC9D,MAAM,UAAU,IAAI,CAClB,OAAgC;IAEhC,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CACtD,UAAU,CAAC;QACT,cAAc,EAAE,KAAK,CAAC,IAAI,EAAE,iBAAiB,CAAa;QAC1D,cAAc,EAAE,KAAK,CAAC,IAAI,EAAE,iBAAiB,CAAa;QAC1D,cAAc,EAAE,KAAK,CAAC,IAAI,EAAE,iBAAiB,CAAa;QAC1D,MAAM,EAAE,KAAK,CAAC,IAAI,EAAE,iBAAiB,CAAW;KACjD,CAAC,CACH,CAAC;IAEF,OAAO,EAAE,iBAAiB,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,CAAC;AACrD,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { SimCfnTemplateValue } from "../template/value/sim-cfn-template-value.js";
|
|
2
|
+
import { type TerraformMappingContext } from "./sim-tf-attributes.js";
|
|
3
|
+
/** The default encryption a bucket applies, as CloudFormation declares it. */
|
|
4
|
+
export declare function encryption(context: TerraformMappingContext): Record<string, SimCfnTemplateValue>;
|
|
5
|
+
//# sourceMappingURL=sim-tf-map-s3-encryption.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-tf-map-s3-encryption.d.ts","sourceRoot":"","sources":["../../../../src/service/cloudformation/terraform/sim-tf-map-s3-encryption.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAC;AACvF,OAAO,EAIL,KAAK,uBAAuB,EAC7B,MAAM,wBAAwB,CAAC;AAEhC,8EAA8E;AAC9E,wBAAgB,UAAU,CACxB,OAAO,EAAE,uBAAuB,GAC/B,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAQrC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
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 { blocks, field, properties, } from "./sim-tf-attributes.js";
|
|
9
|
+
/** The default encryption a bucket applies, as CloudFormation declares it. */
|
|
10
|
+
export function encryption(context) {
|
|
11
|
+
return {
|
|
12
|
+
BucketEncryption: {
|
|
13
|
+
ServerSideEncryptionConfiguration: blocks(context, "rule").map((rule) => encryptionRule(rule)),
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
function encryptionRule(rule) {
|
|
18
|
+
const configured = field(rule, "apply_server_side_encryption_by_default");
|
|
19
|
+
const applied = Array.isArray(configured)
|
|
20
|
+
? configured[0]
|
|
21
|
+
: undefined;
|
|
22
|
+
if (!isRecord(applied)) {
|
|
23
|
+
return {};
|
|
24
|
+
}
|
|
25
|
+
return {
|
|
26
|
+
ServerSideEncryptionByDefault: properties({
|
|
27
|
+
SSEAlgorithm: field(applied, "sse_algorithm"),
|
|
28
|
+
KMSMasterKeyID: field(applied, "kms_master_key_id"),
|
|
29
|
+
}),
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=sim-tf-map-s3-encryption.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-tf-map-s3-encryption.js","sourceRoot":"","sources":["../../../../src/service/cloudformation/terraform/sim-tf-map-s3-encryption.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,kDAAkD;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAE9D,OAAO,EACL,MAAM,EACN,KAAK,EACL,UAAU,GAEX,MAAM,wBAAwB,CAAC;AAEhC,8EAA8E;AAC9E,MAAM,UAAU,UAAU,CACxB,OAAgC;IAEhC,OAAO;QACL,gBAAgB,EAAE;YAChB,iCAAiC,EAAE,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CACtE,cAAc,CAAC,IAAI,CAAC,CACrB;SACF;KACF,CAAC;AACJ,CAAC;AAED,SAAS,cAAc,CAAC,IAA6B;IACnD,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,EAAE,yCAAyC,CAAC,CAAC;IAC1E,MAAM,OAAO,GAAY,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC;QAChD,CAAC,CAAE,UAAwB,CAAC,CAAC,CAAC;QAC9B,CAAC,CAAC,SAAS,CAAC;IAEd,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;QACvB,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,OAAO;QACL,6BAA6B,EAAE,UAAU,CAAC;YACxC,YAAY,EAAE,KAAK,CAAC,OAAO,EAAE,eAAe,CAAW;YACvD,cAAc,EAAE,KAAK,CAAC,OAAO,EAAE,mBAAmB,CAAW;SAC9D,CAAC;KACH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { TerraformResourceFold } from "./sim-tf-mapping.type.js";
|
|
2
|
+
/**
|
|
3
|
+
* The `aws_s3_bucket_*` resources that configure a bucket declared elsewhere.
|
|
4
|
+
*
|
|
5
|
+
* Each names its bucket in a `bucket` attribute and carries one section of
|
|
6
|
+
* what CloudFormation holds on the `AWS::S3::Bucket` itself.
|
|
7
|
+
*/
|
|
8
|
+
export declare const s3BucketFolds: ReadonlyMap<string, TerraformResourceFold>;
|
|
9
|
+
//# sourceMappingURL=sim-tf-map-s3-folds.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-tf-map-s3-folds.d.ts","sourceRoot":"","sources":["../../../../src/service/cloudformation/terraform/sim-tf-map-s3-folds.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAEtE;;;;;GAKG;AACH,eAAO,MAAM,aAAa,EAAE,WAAW,CAAC,MAAM,EAAE,qBAAqB,CAkBjE,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { block, field, renamed, } from "./sim-tf-attributes.js";
|
|
2
|
+
import { cors } from "./sim-tf-map-s3-cors.js";
|
|
3
|
+
import { encryption } from "./sim-tf-map-s3-encryption.js";
|
|
4
|
+
/**
|
|
5
|
+
* The `aws_s3_bucket_*` resources that configure a bucket declared elsewhere.
|
|
6
|
+
*
|
|
7
|
+
* Each names its bucket in a `bucket` attribute and carries one section of
|
|
8
|
+
* what CloudFormation holds on the `AWS::S3::Bucket` itself.
|
|
9
|
+
*/
|
|
10
|
+
export const s3BucketFolds = new Map([
|
|
11
|
+
[
|
|
12
|
+
"aws_s3_bucket_versioning",
|
|
13
|
+
{ parentAttribute: "bucket", properties: versioning },
|
|
14
|
+
],
|
|
15
|
+
[
|
|
16
|
+
"aws_s3_bucket_public_access_block",
|
|
17
|
+
{ parentAttribute: "bucket", properties: publicAccess },
|
|
18
|
+
],
|
|
19
|
+
[
|
|
20
|
+
"aws_s3_bucket_cors_configuration",
|
|
21
|
+
{ parentAttribute: "bucket", properties: cors },
|
|
22
|
+
],
|
|
23
|
+
[
|
|
24
|
+
"aws_s3_bucket_server_side_encryption_configuration",
|
|
25
|
+
{ parentAttribute: "bucket", properties: encryption },
|
|
26
|
+
],
|
|
27
|
+
]);
|
|
28
|
+
function versioning(context) {
|
|
29
|
+
const configured = block(context, "versioning_configuration");
|
|
30
|
+
if (configured === undefined) {
|
|
31
|
+
return {};
|
|
32
|
+
}
|
|
33
|
+
const enabled = field(configured, "status") === "Enabled";
|
|
34
|
+
return {
|
|
35
|
+
VersioningConfiguration: { Status: enabled ? "Enabled" : "Suspended" },
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
function publicAccess(context) {
|
|
39
|
+
return {
|
|
40
|
+
PublicAccessBlockConfiguration: renamed(context, {
|
|
41
|
+
BlockPublicAcls: "block_public_acls",
|
|
42
|
+
BlockPublicPolicy: "block_public_policy",
|
|
43
|
+
IgnorePublicAcls: "ignore_public_acls",
|
|
44
|
+
RestrictPublicBuckets: "restrict_public_buckets",
|
|
45
|
+
}),
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=sim-tf-map-s3-folds.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-tf-map-s3-folds.js","sourceRoot":"","sources":["../../../../src/service/cloudformation/terraform/s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SACjD,CAAC;KACH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type TerraformMappingContext } from "./sim-tf-attributes.js";
|
|
2
|
+
import type { TerraformMappedResource } from "./sim-tf-mapping.type.js";
|
|
3
|
+
/** A bucket. What configures it arrives as its own resource and folds in. */
|
|
4
|
+
export declare function s3Bucket(context: TerraformMappingContext): TerraformMappedResource;
|
|
5
|
+
//# sourceMappingURL=sim-tf-map-s3.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-tf-map-s3.d.ts","sourceRoot":"","sources":["../../../../src/service/cloudformation/terraform/sim-tf-map-s3.ts"],"names":[],"mappings":"AAMA,OAAO,EAIL,KAAK,uBAAuB,EAC7B,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAExE,6EAA6E;AAC7E,wBAAgB,QAAQ,CACtB,OAAO,EAAE,uBAAuB,GAC/B,uBAAuB,CAQzB"}
|
|
@@ -0,0 +1,18 @@
|
|
|
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 { properties, renamed, tags, } from "./sim-tf-attributes.js";
|
|
8
|
+
/** A bucket. What configures it arrives as its own resource and folds in. */
|
|
9
|
+
export function s3Bucket(context) {
|
|
10
|
+
return {
|
|
11
|
+
Type: "AWS::S3::Bucket",
|
|
12
|
+
Properties: {
|
|
13
|
+
...renamed(context, { BucketName: "bucket" }),
|
|
14
|
+
...properties({ Tags: tags(context) }),
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=sim-tf-map-s3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-tf-map-s3.js","sourceRoot":"","sources":["../../../../src/service/cloudformation/terraform/sim-tf-map-s3.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,kDAAkD;AAClD,OAAO,EACL,UAAU,EACV,OAAO,EACP,IAAI,GAEL,MAAM,wBAAwB,CAAC;AAGhC,6EAA6E;AAC7E,MAAM,UAAU,QAAQ,CACtB,OAAgC;IAEhC,OAAO;QACL,IAAI,EAAE,iBAAiB;QACvB,UAAU,EAAE;YACV,GAAG,OAAO,CAAC,OAAO,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC;YAC7C,GAAG,UAAU,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;SACvC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type TerraformMappingContext } from "./sim-tf-attributes.js";
|
|
2
|
+
import type { TerraformMappedResource } from "./sim-tf-mapping.type.js";
|
|
3
|
+
/**
|
|
4
|
+
* A topic.
|
|
5
|
+
*
|
|
6
|
+
* Tags are left off. Simulated SNS refuses a `Tags` property, because nothing
|
|
7
|
+
* it models reads a topic tag, and Terraform tags whatever a default tag block
|
|
8
|
+
* covers whether or not the tag matters. A property a service refuses fails
|
|
9
|
+
* the Resource, so tagging is one of the places a mapping has to know what the
|
|
10
|
+
* service will take.
|
|
11
|
+
*/
|
|
12
|
+
export declare function snsTopic(context: TerraformMappingContext): TerraformMappedResource;
|
|
13
|
+
/** A subscription, which Terraform declares apart from its topic as well. */
|
|
14
|
+
export declare function snsSubscription(context: TerraformMappingContext): TerraformMappedResource;
|
|
15
|
+
//# sourceMappingURL=sim-tf-map-sns.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-tf-map-sns.d.ts","sourceRoot":"","sources":["../../../../src/service/cloudformation/terraform/sim-tf-map-sns.ts"],"names":[],"mappings":"AAMA,OAAO,EAIL,KAAK,uBAAuB,EAC7B,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAExE;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,CACtB,OAAO,EAAE,uBAAuB,GAC/B,uBAAuB,CAWzB;AAED,6EAA6E;AAC7E,wBAAgB,eAAe,CAC7B,OAAO,EAAE,uBAAuB,GAC/B,uBAAuB,CAUzB"}
|
|
@@ -0,0 +1,40 @@
|
|
|
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 { attribute, renamed, tags, } from "./sim-tf-attributes.js";
|
|
8
|
+
/**
|
|
9
|
+
* A topic.
|
|
10
|
+
*
|
|
11
|
+
* Tags are left off. Simulated SNS refuses a `Tags` property, because nothing
|
|
12
|
+
* it models reads a topic tag, and Terraform tags whatever a default tag block
|
|
13
|
+
* covers whether or not the tag matters. A property a service refuses fails
|
|
14
|
+
* the Resource, so tagging is one of the places a mapping has to know what the
|
|
15
|
+
* service will take.
|
|
16
|
+
*/
|
|
17
|
+
export function snsTopic(context) {
|
|
18
|
+
const fifo = attribute(context, "fifo_topic");
|
|
19
|
+
return {
|
|
20
|
+
Type: "AWS::SNS::Topic",
|
|
21
|
+
Properties: {
|
|
22
|
+
...renamed(context, { TopicName: "name", DisplayName: "display_name" }),
|
|
23
|
+
...(fifo === true && { FifoTopic: true }),
|
|
24
|
+
},
|
|
25
|
+
lost: tags(context) === undefined ? [] : ["tags"],
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
/** A subscription, which Terraform declares apart from its topic as well. */
|
|
29
|
+
export function snsSubscription(context) {
|
|
30
|
+
return {
|
|
31
|
+
Type: "AWS::SNS::Subscription",
|
|
32
|
+
Properties: renamed(context, {
|
|
33
|
+
TopicArn: "topic_arn",
|
|
34
|
+
Protocol: "protocol",
|
|
35
|
+
Endpoint: "endpoint",
|
|
36
|
+
RawMessageDelivery: "raw_message_delivery",
|
|
37
|
+
}),
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=sim-tf-map-sns.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-tf-map-sns.js","sourceRoot":"","sources":["../../../../src/service/cloudformation/terraform/sim-tf-map-sns.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,kDAAkD;AAClD,OAAO,EACL,SAAS,EACT,OAAO,EACP,IAAI,GAEL,MAAM,wBAAwB,CAAC;AAGhC;;;;;;;;GAQG;AACH,MAAM,UAAU,QAAQ,CACtB,OAAgC;IAEhC,MAAM,IAAI,GAAG,SAAS,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;IAE9C,OAAO;QACL,IAAI,EAAE,iBAAiB;QACvB,UAAU,EAAE;YACV,GAAG,OAAO,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,cAAc,EAAE,CAAC;YACvE,GAAG,CAAC,IAAI,KAAK,IAAI,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;SAC1C;QACD,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;KAClD,CAAC;AACJ,CAAC;AAED,6EAA6E;AAC7E,MAAM,UAAU,eAAe,CAC7B,OAAgC;IAEhC,OAAO;QACL,IAAI,EAAE,wBAAwB;QAC9B,UAAU,EAAE,OAAO,CAAC,OAAO,EAAE;YAC3B,QAAQ,EAAE,WAAW;YACrB,QAAQ,EAAE,UAAU;YACpB,QAAQ,EAAE,UAAU;YACpB,kBAAkB,EAAE,sBAAsB;SAC3C,CAAC;KACH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type TerraformMappingContext } from "./sim-tf-attributes.js";
|
|
2
|
+
import type { TerraformMappedResource } from "./sim-tf-mapping.type.js";
|
|
3
|
+
/** A queue, with the redrive policy read out of the JSON string it lives in. */
|
|
4
|
+
export declare function sqsQueue(context: TerraformMappingContext): TerraformMappedResource;
|
|
5
|
+
//# sourceMappingURL=sim-tf-map-sqs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-tf-map-sqs.d.ts","sourceRoot":"","sources":["../../../../src/service/cloudformation/terraform/sim-tf-map-sqs.ts"],"names":[],"mappings":"AAQA,OAAO,EAML,KAAK,uBAAuB,EAC7B,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAExE,gFAAgF;AAChF,wBAAgB,QAAQ,CACtB,OAAO,EAAE,uBAAuB,GAC/B,uBAAuB,CAgBzB"}
|
|
@@ -0,0 +1,56 @@
|
|
|
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 { field, properties, renamed, tags, templateValue, } from "./sim-tf-attributes.js";
|
|
9
|
+
/** A queue, with the redrive policy read out of the JSON string it lives in. */
|
|
10
|
+
export function sqsQueue(context) {
|
|
11
|
+
const redrive = redrivePolicy(context);
|
|
12
|
+
return {
|
|
13
|
+
Type: "AWS::SQS::Queue",
|
|
14
|
+
Properties: {
|
|
15
|
+
...renamed(context, {
|
|
16
|
+
QueueName: "name",
|
|
17
|
+
VisibilityTimeout: "visibility_timeout_seconds",
|
|
18
|
+
MessageRetentionPeriod: "message_retention_seconds",
|
|
19
|
+
DelaySeconds: "delay_seconds",
|
|
20
|
+
}),
|
|
21
|
+
...properties({ RedrivePolicy: redrive.value, Tags: tags(context) }),
|
|
22
|
+
},
|
|
23
|
+
lost: redrive.lost,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* The queue's redrive policy, which Terraform carries as a JSON string.
|
|
28
|
+
*
|
|
29
|
+
* The string is built with `jsonencode` around the dead-letter queue's ARN, so
|
|
30
|
+
* the whole string is unknown whenever that queue is created by the same plan.
|
|
31
|
+
* What survives is the reference. The `maxReceiveCount` beside it was inside
|
|
32
|
+
* the string that never got built.
|
|
33
|
+
*/
|
|
34
|
+
function redrivePolicy(context) {
|
|
35
|
+
const known = field(context.resource.values, "redrive_policy");
|
|
36
|
+
if (typeof known === "string") {
|
|
37
|
+
const parsed = JSON.parse(known);
|
|
38
|
+
return {
|
|
39
|
+
value: isRecord(parsed) ? templateValue(parsed) : undefined,
|
|
40
|
+
lost: [],
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
/*
|
|
44
|
+
* The dead-letter queue is recoverable from the reference and the receive
|
|
45
|
+
* limit is not, and a redrive policy carrying a made-up limit would give the
|
|
46
|
+
* queue different retry behaviour from the one the plan describes. The whole
|
|
47
|
+
* policy is dropped and recorded instead.
|
|
48
|
+
*/
|
|
49
|
+
return {
|
|
50
|
+
value: undefined,
|
|
51
|
+
lost: context.resource.unknown["redrive_policy"] === true
|
|
52
|
+
? ["redrive_policy"]
|
|
53
|
+
: [],
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=sim-tf-map-sqs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-tf-map-sqs.js","sourceRoot":"","sources":["../../../../src/service/cloudformation/terraform/sim-tf-map-sqs.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,kDAAkD;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAE9D,OAAO,EACL,KAAK,EACL,UAAU,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 @@
|
|
|
1
|
+
import type { SimCfnTemplateValue } from "../template/value/sim-cfn-template-value.js";
|
|
2
|
+
import type { TerraformMappingContext } from "./sim-tf-attributes.js";
|
|
3
|
+
/**
|
|
4
|
+
* One CloudFormation Resource built from one Terraform resource.
|
|
5
|
+
*
|
|
6
|
+
* `lost` names the Terraform attributes the mapping could not carry across.
|
|
7
|
+
* A mapping records them rather than dropping them quietly, because an
|
|
8
|
+
* attribute that goes missing without a word is the kind of gap that only turns
|
|
9
|
+
* up later as a test passing for the wrong reason.
|
|
10
|
+
*/
|
|
11
|
+
export interface TerraformMappedResource {
|
|
12
|
+
readonly Type: string;
|
|
13
|
+
readonly Properties: Record<string, SimCfnTemplateValue>;
|
|
14
|
+
readonly lost?: readonly string[];
|
|
15
|
+
/**
|
|
16
|
+
* Properties the simulated service will refuse the Resource without.
|
|
17
|
+
*
|
|
18
|
+
* A plan can leave a required value unresolvable, and a Resource built
|
|
19
|
+
* without it fails and takes the Stack's other Resources with it. Naming the
|
|
20
|
+
* properties here lets the import drop that one Resource and record it,
|
|
21
|
+
* which is what sim CloudFormation already does with a Resource type it
|
|
22
|
+
* cannot create.
|
|
23
|
+
*/
|
|
24
|
+
readonly requires?: readonly string[];
|
|
25
|
+
}
|
|
26
|
+
export type TerraformResourceMapping = (context: TerraformMappingContext) => TerraformMappedResource;
|
|
27
|
+
/**
|
|
28
|
+
* How one Terraform resource contributes to another resource's properties.
|
|
29
|
+
*
|
|
30
|
+
* The AWS provider splits a single CloudFormation Resource across several
|
|
31
|
+
* Terraform resources. Six `aws_s3_bucket_*` resources configure one bucket,
|
|
32
|
+
* and CloudFormation carries all six as properties of one `AWS::S3::Bucket`.
|
|
33
|
+
* A fold names the attribute holding the parent's address, and returns the
|
|
34
|
+
* properties to merge into the parent.
|
|
35
|
+
*/
|
|
36
|
+
export interface TerraformResourceFold {
|
|
37
|
+
/** The attribute naming the resource these properties belong to. */
|
|
38
|
+
readonly parentAttribute: string;
|
|
39
|
+
readonly properties: (context: TerraformMappingContext) => Record<string, SimCfnTemplateValue>;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=sim-tf-mapping.type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-tf-mapping.type.d.ts","sourceRoot":"","sources":["../../../../src/service/cloudformation/terraform/sim-tf-mapping.type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAC;AACvF,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAEtE;;;;;;;GAOG;AACH,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;IACzD,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC;;;;;;;;OAQG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACvC;AAED,MAAM,MAAM,wBAAwB,GAAG,CACrC,OAAO,EAAE,uBAAuB,KAC7B,uBAAuB,CAAC;AAE7B;;;;;;;;GAQG;AACH,MAAM,WAAW,qBAAqB;IACpC,oEAAoE;IACpE,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,UAAU,EAAE,CACnB,OAAO,EAAE,uBAAuB,KAC7B,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;CAC1C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-tf-mapping.type.js","sourceRoot":"","sources":["../../../../src/service/cloudformation/terraform/sim-tf-mapping.type.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { TerraformPlan } from "./sim-tf-plan.type.js";
|
|
2
|
+
/**
|
|
3
|
+
* What one module output is, in terms of the module that declares it.
|
|
4
|
+
*/
|
|
5
|
+
export interface TerraformModuleOutput {
|
|
6
|
+
/** The module path the output's references are relative to. */
|
|
7
|
+
readonly modulePath: readonly string[];
|
|
8
|
+
readonly references: readonly string[];
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Every module output a plan declares, keyed by the address that reads it.
|
|
12
|
+
*
|
|
13
|
+
* A resource in one module reaching a resource in another goes through an
|
|
14
|
+
* output. `module.processor.lambda_function_arn` is not an address any resource
|
|
15
|
+
* has, and the plan resolves nothing for it, so following it means reading the
|
|
16
|
+
* output's own expression and continuing from the module that declares it.
|
|
17
|
+
*/
|
|
18
|
+
export declare function terraformModuleOutputs(plan: TerraformPlan): ReadonlyMap<string, TerraformModuleOutput>;
|
|
19
|
+
//# sourceMappingURL=sim-tf-module-outputs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-tf-module-outputs.d.ts","sourceRoot":"","sources":["../../../../src/service/cloudformation/terraform/sim-tf-module-outputs.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAGV,aAAa,EACd,MAAM,uBAAuB,CAAC;AAE/B;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,+DAA+D;IAC/D,QAAQ,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,CAAC;IACvC,QAAQ,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,CAAC;CACxC;AAED;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,aAAa,GAClB,WAAW,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAS5C"}
|
|
@@ -0,0 +1,63 @@
|
|
|
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
|
+
* Every module output a plan declares, keyed by the address that reads it.
|
|
10
|
+
*
|
|
11
|
+
* A resource in one module reaching a resource in another goes through an
|
|
12
|
+
* output. `module.processor.lambda_function_arn` is not an address any resource
|
|
13
|
+
* has, and the plan resolves nothing for it, so following it means reading the
|
|
14
|
+
* output's own expression and continuing from the module that declares it.
|
|
15
|
+
*/
|
|
16
|
+
export function terraformModuleOutputs(plan) {
|
|
17
|
+
const outputs = new Map();
|
|
18
|
+
const root = plan.configuration?.root_module;
|
|
19
|
+
if (root !== undefined) {
|
|
20
|
+
collect(root, [], outputs);
|
|
21
|
+
}
|
|
22
|
+
return outputs;
|
|
23
|
+
}
|
|
24
|
+
function collect(config, modulePath, outputs) {
|
|
25
|
+
const calls = Object.entries(config.module_calls ?? {});
|
|
26
|
+
for (const [callName, call] of calls) {
|
|
27
|
+
const child = call.module;
|
|
28
|
+
if (child === undefined) {
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
31
|
+
const childPath = [...modulePath, callName];
|
|
32
|
+
const address = childPath.map((name) => `module.${name}`).join(".");
|
|
33
|
+
const declaredOutputs = Object.entries(moduleOutputRecords(child));
|
|
34
|
+
for (const [outputName, declared] of declaredOutputs) {
|
|
35
|
+
outputs.set(`${address}.${outputName}`, {
|
|
36
|
+
modulePath: childPath,
|
|
37
|
+
references: declared,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
collect(child, childPath, outputs);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
function moduleOutputRecords(config) {
|
|
44
|
+
const declared = config.outputs;
|
|
45
|
+
if (!isRecord(declared)) {
|
|
46
|
+
return {};
|
|
47
|
+
}
|
|
48
|
+
return Object.fromEntries(Object.entries(declared).map(([name, output]) => [
|
|
49
|
+
name,
|
|
50
|
+
outputReferences(output),
|
|
51
|
+
]));
|
|
52
|
+
}
|
|
53
|
+
function outputReferences(output) {
|
|
54
|
+
if (!isRecord(output)) {
|
|
55
|
+
return [];
|
|
56
|
+
}
|
|
57
|
+
const expression = output.expression;
|
|
58
|
+
if (!isRecord(expression)) {
|
|
59
|
+
return [];
|
|
60
|
+
}
|
|
61
|
+
return expression.references ?? [];
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=sim-tf-module-outputs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-tf-module-outputs.js","sourceRoot":"","sources":["../../../../src/service/cloudformation/terraform/sim-tf-module-outputs.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,kDAAkD;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAgB9D;;;;;;;GAOG;AACH,MAAM,UAAU,sBAAsB,CACpC,IAAmB;IAEnB,MAAM,OAAO,GAAG,IAAI,GAAG,EAAiC,CAAC;IACzD,MAAM,IAAI,GAAG,IAAI,CAAC,aAAa,EAAE,WAAW,CAAC;IAE7C,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,OAAO,CAAC,IAAI,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;IAC7B,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,SAAS,OAAO,CACd,MAA6B,EAC7B,UAA6B,EAC7B,OAA2C;IAE3C,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,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC;QAE1B,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACxB,SAAS;QACX,CAAC;QAED,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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ource, TerraformPlan } from "./sim-tf-plan.type.js";
|
|
2
|
+
export interface TerraformChangeParts {
|
|
3
|
+
readonly unknown: Record<string, unknown>;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Each resource's `after_unknown`, keyed by the address it belongs to.\n *\n * `planned_values` says what a value is and `resource_changes` says whether\n * the plan knew it, so reading a resource means having both to hand.
|
|
7
|
+
*/
|
|
8
|
+
export declare function changesByAddress(plan: TerraformPlan): ReadonlyMap<string, TerraformChangeParts>;
|
|
9
|
+
/**
|
|
10
|
+
* The declared configuration of one module's resources, keyed by type and\n * name.\n *\n * Configuration addresses are relative to the module that declares them, while\n * `planned_values` addresses are fully qualified, so the two are joined per\n * module rather than across the whole plan.
|
|
11
|
+
*/
|
|
12
|
+
export declare function configResourcesByKey(config: TerraformConfigModule | undefined): ReadonlyMap<string, TerraformConfigResource>;
|
|
13
|
+
/**
|
|
14
|
+
* The call name of a child module, taken off its fully qualified address.
|
|
15
|
+
*
|
|
16
|
+
* A child module address repeats its parents, so `module.a.module.b` under
|
|
17
|
+
* `["a"]` is the call named `b`. A module called with `for_each` carries the
|
|
18
|
+
* key on the address, and the key belongs to the instance rather than to the
|
|
19
|
+
* call the configuration is filed under.
|
|
20
|
+
*/
|
|
21
|
+
export declare function childModuleCallName(address: string | undefined, modulePath: readonly string[]): string;
|
|
22
|
+
/**
|
|
23
|
+
* The provider that owns a resource type, without the registry it came from.
|
|
24
|
+
*/
|
|
25
|
+
export declare function providerShortName(providerName: string | undefined): string;
|
|
26
|
+
//# sourceMappingURL=sim-tf-plan-index.d.ts.map
|