@kensio/yulin 1.19.1 → 1.19.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/service/cloudformation/deploy/sim-cfn-cdk-out-deployer.d.ts +2 -2
- package/dist/service/cloudformation/deploy/sim-cfn-cdk-out-deployer.d.ts.map +1 -1
- package/dist/service/cloudformation/deploy/sim-cfn-cdk-out-deployer.js.map +1 -1
- package/dist/service/cloudformation/deploy/sim-cfn-cdk-out-stack-options.d.ts +3 -3
- package/dist/service/cloudformation/deploy/sim-cfn-cdk-out-stack-options.d.ts.map +1 -1
- package/dist/service/cloudformation/deploy/sim-cfn-cdk-out-stack-options.js.map +1 -1
- package/dist/service/cloudformation/deploy/sim-cfn-template-deployer.d.ts +5 -4
- package/dist/service/cloudformation/deploy/sim-cfn-template-deployer.d.ts.map +1 -1
- package/dist/service/cloudformation/deploy/sim-cfn-template-deployer.js.map +1 -1
- package/dist/service/cloudformation/index.d.ts +7 -0
- package/dist/service/cloudformation/index.d.ts.map +1 -1
- package/dist/service/cloudformation/resource/sim-cfn-deployed-resource.type.d.ts +59 -0
- package/dist/service/cloudformation/resource/sim-cfn-deployed-resource.type.d.ts.map +1 -0
- package/dist/service/cloudformation/resource/sim-cfn-deployed-resource.type.js +2 -0
- package/dist/service/cloudformation/resource/sim-cfn-deployed-resource.type.js.map +1 -0
- package/dist/service/cloudformation/sim-cloudformation.d.ts +8 -9
- package/dist/service/cloudformation/sim-cloudformation.d.ts.map +1 -1
- package/dist/service/cloudformation/sim-cloudformation.js +1 -3
- package/dist/service/cloudformation/sim-cloudformation.js.map +1 -1
- package/dist/service/cloudformation/stack/sim-cfn-deployed-stack.type.d.ts +68 -0
- package/dist/service/cloudformation/stack/sim-cfn-deployed-stack.type.d.ts.map +1 -0
- package/dist/service/cloudformation/stack/sim-cfn-deployed-stack.type.js +2 -0
- package/dist/service/cloudformation/stack/sim-cfn-deployed-stack.type.js.map +1 -0
- package/dist/service/cloudformation/stack/sim-cfn-stack.d.ts +2 -1
- package/dist/service/cloudformation/stack/sim-cfn-stack.d.ts.map +1 -1
- package/dist/service/cloudformation/stack/sim-cfn-stack.fixture.d.ts +21 -0
- package/dist/service/cloudformation/stack/sim-cfn-stack.fixture.d.ts.map +1 -0
- package/dist/service/cloudformation/stack/sim-cfn-stack.fixture.js +21 -0
- package/dist/service/cloudformation/stack/sim-cfn-stack.fixture.js.map +1 -0
- package/dist/service/cloudformation/stack/sim-cfn-stack.js.map +1 -1
- package/dist/service/cloudformation/terraform/sim-tf-attribute-reads.d.ts +12 -0
- package/dist/service/cloudformation/terraform/sim-tf-attribute-reads.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-attribute-reads.js +60 -0
- package/dist/service/cloudformation/terraform/sim-tf-attribute-reads.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-attributes.d.ts +60 -0
- package/dist/service/cloudformation/terraform/sim-tf-attributes.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-attributes.js +121 -0
- package/dist/service/cloudformation/terraform/sim-tf-attributes.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-config.d.ts +14 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-config.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-config.js +36 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-config.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-dynamodb.d.ts +15 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-dynamodb.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-dynamodb.js +74 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-dynamodb.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-http-api-route.d.ts +5 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-http-api-route.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-http-api-route.js +32 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-http-api-route.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-http-api.d.ts +12 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-http-api.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-http-api.js +52 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-http-api.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-iam.d.ts +9 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-iam.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-iam.js +80 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-iam.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-lambda.d.ts +19 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-lambda.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-lambda.js +90 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-lambda.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-s3-cors.d.ts +5 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-s3-cors.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-s3-cors.js +12 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-s3-cors.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-s3-encryption.d.ts +5 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-s3-encryption.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-s3-encryption.js +32 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-s3-encryption.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-s3-folds.d.ts +9 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-s3-folds.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-s3-folds.js +48 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-s3-folds.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-s3.d.ts +5 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-s3.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-s3.js +18 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-s3.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-sns.d.ts +15 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-sns.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-sns.js +40 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-sns.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-sqs.d.ts +5 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-sqs.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-sqs.js +56 -0
- package/dist/service/cloudformation/terraform/sim-tf-map-sqs.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-mapping.type.d.ts +41 -0
- package/dist/service/cloudformation/terraform/sim-tf-mapping.type.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-mapping.type.js +2 -0
- package/dist/service/cloudformation/terraform/sim-tf-mapping.type.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-module-outputs.d.ts +19 -0
- package/dist/service/cloudformation/terraform/sim-tf-module-outputs.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-module-outputs.js +63 -0
- package/dist/service/cloudformation/terraform/sim-tf-module-outputs.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-plan-index.d.ts +26 -0
- package/dist/service/cloudformation/terraform/sim-tf-plan-index.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-plan-index.js +45 -0
- package/dist/service/cloudformation/terraform/sim-tf-plan-index.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-plan-resources.d.ts +39 -0
- package/dist/service/cloudformation/terraform/sim-tf-plan-resources.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-plan-resources.js +44 -0
- package/dist/service/cloudformation/terraform/sim-tf-plan-resources.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-plan.type.d.ts +94 -0
- package/dist/service/cloudformation/terraform/sim-tf-plan.type.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-plan.type.js +2 -0
- package/dist/service/cloudformation/terraform/sim-tf-plan.type.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-reference-address.d.ts +27 -0
- package/dist/service/cloudformation/terraform/sim-tf-reference-address.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-reference-address.js +58 -0
- package/dist/service/cloudformation/terraform/sim-tf-reference-address.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-reference.d.ts +64 -0
- package/dist/service/cloudformation/terraform/sim-tf-reference.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-reference.js +122 -0
- package/dist/service/cloudformation/terraform/sim-tf-reference.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-registry.d.ts +14 -0
- package/dist/service/cloudformation/terraform/sim-tf-registry.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-registry.js +40 -0
- package/dist/service/cloudformation/terraform/sim-tf-registry.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-report.type.d.ts +31 -0
- package/dist/service/cloudformation/terraform/sim-tf-report.type.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-report.type.js +2 -0
- package/dist/service/cloudformation/terraform/sim-tf-report.type.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-folds.d.ts +20 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-folds.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-folds.js +28 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-folds.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-graph.d.ts +29 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-graph.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-graph.js +71 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-graph.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-mappings.d.ts +23 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-mappings.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-mappings.js +72 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-mappings.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-merge.d.ts +21 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-merge.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-merge.js +33 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-merge.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-prune.d.ts +21 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-prune.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-prune.js +51 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-prune.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-pruned.d.ts +18 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-pruned.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-pruned.js +23 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-pruned.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-references.d.ts +10 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-references.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-references.js +39 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-references.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-resolver.d.ts +12 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-resolver.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-resolver.js +17 -0
- package/dist/service/cloudformation/terraform/sim-tf-template-resolver.js.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-template.d.ts +26 -0
- package/dist/service/cloudformation/terraform/sim-tf-template.d.ts.map +1 -0
- package/dist/service/cloudformation/terraform/sim-tf-template.js +54 -0
- package/dist/service/cloudformation/terraform/sim-tf-template.js.map +1 -0
- package/dist/service/elbv2/cfn/sim-cfn-elbv2.fixture.d.ts +2 -2
- package/dist/service/elbv2/cfn/sim-cfn-elbv2.fixture.d.ts.map +1 -1
- package/dist/service/elbv2/cfn/sim-cfn-elbv2.fixture.js.map +1 -1
- package/dist/util/filesystem/test-terraform-project.d.ts +56 -0
- package/dist/util/filesystem/test-terraform-project.d.ts.map +1 -0
- package/dist/util/filesystem/test-terraform-project.js +83 -0
- package/dist/util/filesystem/test-terraform-project.js.map +1 -0
- package/package.json +3 -2
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How one Terraform attribute is read off the CloudFormation Resource standing
|
|
3
|
+
* in for it.
|
|
4
|
+
*
|
|
5
|
+
* `Ref` means the CloudFormation Resource's own Ref value returns it, and any
|
|
6
|
+
* other string is the `Fn::GetAtt` attribute name. The table is per Terraform
|
|
7
|
+
* type because the provider and CloudFormation disagree about which value is
|
|
8
|
+
* the Ref. An `AWS::SNS::Topic` Ref is the topic ARN, an `AWS::SQS::Queue` Ref
|
|
9
|
+
* is the queue URL, and an `AWS::S3::Bucket` Ref is the bucket name.
|
|
10
|
+
*/
|
|
11
|
+
export const terraformAttributeReads = new Map([
|
|
12
|
+
["aws_s3_bucket.id", "Ref"],
|
|
13
|
+
["aws_s3_bucket.bucket", "Ref"],
|
|
14
|
+
["aws_s3_bucket.arn", "Arn"],
|
|
15
|
+
["aws_s3_bucket.bucket_regional_domain_name", "RegionalDomainName"],
|
|
16
|
+
["aws_s3_bucket.bucket_domain_name", "DomainName"],
|
|
17
|
+
["aws_dynamodb_table.id", "Ref"],
|
|
18
|
+
["aws_dynamodb_table.name", "Ref"],
|
|
19
|
+
["aws_dynamodb_table.arn", "Arn"],
|
|
20
|
+
["aws_dynamodb_table.stream_arn", "StreamArn"],
|
|
21
|
+
["aws_sqs_queue.id", "Ref"],
|
|
22
|
+
["aws_sqs_queue.url", "Ref"],
|
|
23
|
+
["aws_sqs_queue.arn", "Arn"],
|
|
24
|
+
["aws_sqs_queue.name", "QueueName"],
|
|
25
|
+
["aws_sns_topic.id", "Ref"],
|
|
26
|
+
["aws_sns_topic.arn", "Ref"],
|
|
27
|
+
["aws_sns_topic.name", "TopicName"],
|
|
28
|
+
["aws_lambda_function.arn", "Arn"],
|
|
29
|
+
/*
|
|
30
|
+
* `invoke_arn` is the API Gateway invocation URI in Terraform, and the
|
|
31
|
+
* CloudFormation property it feeds, `IntegrationUri`, takes the function ARN
|
|
32
|
+
* itself. The ARN is what a synthesized template carries, so that is what
|
|
33
|
+
* this reads. `qualified_arn` has no entry, because it names a version and
|
|
34
|
+
* dropping the qualifier would point at the wrong code.
|
|
35
|
+
*/
|
|
36
|
+
["aws_lambda_function.invoke_arn", "Arn"],
|
|
37
|
+
["aws_lambda_function.function_name", "Ref"],
|
|
38
|
+
["aws_lambda_function.id", "Ref"],
|
|
39
|
+
["aws_iam_role.arn", "Arn"],
|
|
40
|
+
["aws_iam_role.id", "Ref"],
|
|
41
|
+
["aws_iam_role.name", "Ref"],
|
|
42
|
+
["aws_kms_key.arn", "Arn"],
|
|
43
|
+
["aws_kms_key.id", "Ref"],
|
|
44
|
+
["aws_kms_key.key_id", "Ref"],
|
|
45
|
+
["aws_apigatewayv2_api.id", "Ref"],
|
|
46
|
+
["aws_apigatewayv2_api.api_endpoint", "ApiEndpoint"],
|
|
47
|
+
["aws_apigatewayv2_integration.id", "Ref"],
|
|
48
|
+
["aws_cognito_user_pool.id", "Ref"],
|
|
49
|
+
["aws_cognito_user_pool.arn", "Arn"],
|
|
50
|
+
["aws_cognito_user_pool_client.id", "Ref"],
|
|
51
|
+
["aws_cloudwatch_log_group.arn", "Arn"],
|
|
52
|
+
["aws_cloudwatch_log_group.name", "Ref"],
|
|
53
|
+
["aws_cloudwatch_event_rule.arn", "Arn"],
|
|
54
|
+
["aws_cloudwatch_event_rule.name", "Ref"],
|
|
55
|
+
["aws_secretsmanager_secret.id", "Ref"],
|
|
56
|
+
["aws_secretsmanager_secret.arn", "Ref"],
|
|
57
|
+
["aws_ecr_repository.arn", "Arn"],
|
|
58
|
+
["aws_ecr_repository.repository_url", "RepositoryUri"],
|
|
59
|
+
]);
|
|
60
|
+
//# sourceMappingURL=sim-tf-attribute-reads.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-tf-attribute-reads.js","sourceRoot":"","sources":["../../../../src/service/cloudformation/terraform/sim-tf-attribute-reads.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAgC,IAAI,GAAG,CAAC;IAC1E,CAAC,kBAAkB,EAAE,KAAK,CAAC;IAC3B,CAAC,sBAAsB,EAAE,KAAK,CAAC;IAC/B,CAAC,mBAAmB,EAAE,KAAK,CAAC;IAC5B,CAAC,2CAA2C,EAAE,oBAAoB,CAAC;IACnE,CAAC,kCAAkC,EAAE,YAAY,CAAC;IAClD,CAAC,uBAAuB,EAAE,KAAK,CAAC;IAChC,CAAC,yBAAyB,EAAE,KAAK,CAAC;IAClC,CAAC,wBAAwB,EAAE,KAAK,CAAC;IACjC,CAAC,+BAA+B,EAAE,WAAW,CAAC;IAC9C,CAAC,kBAAkB,EAAE,KAAK,CAAC;IAC3B,CAAC,mBAAmB,EAAE,KAAK,CAAC;IAC5B,CAAC,mBAAmB,EAAE,KAAK,CAAC;IAC5B,CAAC,oBAAoB,EAAE,WAAW,CAAC;IACnC,CAAC,kBAAkB,EAAE,KAAK,CAAC;IAC3B,CAAC,mBAAmB,EAAE,KAAK,CAAC;IAC5B,CAAC,oBAAoB,EAAE,WAAW,CAAC;IACnC,CAAC,yBAAyB,EAAE,KAAK,CAAC;IAClC;;;;;;OAMG;IACH,CAAC,gCAAgC,EAAE,KAAK,CAAC;IACzC,CAAC,mCAAmC,EAAE,KAAK,CAAC;IAC5C,CAAC,wBAAwB,EAAE,KAAK,CAAC;IACjC,CAAC,kBAAkB,EAAE,KAAK,CAAC;IAC3B,CAAC,iBAAiB,EAAE,KAAK,CAAC;IAC1B,CAAC,mBAAmB,EAAE,KAAK,CAAC;IAC5B,CAAC,iBAAiB,EAAE,KAAK,CAAC;IAC1B,CAAC,gBAAgB,EAAE,KAAK,CAAC;IACzB,CAAC,oBAAoB,EAAE,KAAK,CAAC;IAC7B,CAAC,yBAAyB,EAAE,KAAK,CAAC;IAClC,CAAC,mCAAmC,EAAE,aAAa,CAAC;IACpD,CAAC,iCAAiC,EAAE,KAAK,CAAC;IAC1C,CAAC,0BAA0B,EAAE,KAAK,CAAC;IACnC,CAAC,2BAA2B,EAAE,KAAK,CAAC;IACpC,CAAC,iCAAiC,EAAE,KAAK,CAAC;IAC1C,CAAC,8BAA8B,EAAE,KAAK,CAAC;IACvC,CAAC,+BAA+B,EAAE,KAAK,CAAC;IACxC,CAAC,+BAA+B,EAAE,KAAK,CAAC;IACxC,CAAC,gCAAgC,EAAE,KAAK,CAAC;IACzC,CAAC,8BAA8B,EAAE,KAAK,CAAC;IACvC,CAAC,+BAA+B,EAAE,KAAK,CAAC;IACxC,CAAC,wBAAwB,EAAE,KAAK,CAAC;IACjC,CAAC,mCAAmC,EAAE,eAAe,CAAC;CACvD,CAAC,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { SimCfnTemplateValue } from "../template/value/sim-cfn-template-value.js";
|
|
2
|
+
import type { TerraformResource } from "./sim-tf-plan-resources.js";
|
|
3
|
+
import type { TerraformReferenceResolver } from "./sim-tf-reference.js";
|
|
4
|
+
/**
|
|
5
|
+
* What a mapping function is given to build one CloudFormation Resource.
|
|
6
|
+
*/
|
|
7
|
+
export interface TerraformMappingContext {
|
|
8
|
+
readonly resource: TerraformResource;
|
|
9
|
+
readonly resolver: TerraformReferenceResolver;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* The value of one Terraform attribute, as CloudFormation would carry it.
|
|
13
|
+
*
|
|
14
|
+
* An attribute the plan resolved returns its value. An attribute still unknown
|
|
15
|
+
* returns the intrinsic that reads it off the Resource producing it, taken from
|
|
16
|
+
* the reference the configuration records for that attribute. An attribute with
|
|
17
|
+
* neither returns undefined.
|
|
18
|
+
*/
|
|
19
|
+
export declare function attribute(context: TerraformMappingContext, key: string): SimCfnTemplateValue | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* A Terraform nested block, which the plan represents as a list of records even
|
|
22
|
+
* where the schema allows only one.
|
|
23
|
+
*/
|
|
24
|
+
export declare function block(context: TerraformMappingContext, key: string): Record<string, unknown> | undefined;
|
|
25
|
+
/** Every entry of a Terraform nested block that repeats. */
|
|
26
|
+
export declare function blocks(context: TerraformMappingContext, key: string): readonly Record<string, unknown>[];
|
|
27
|
+
/**
|
|
28
|
+
* A CloudFormation `Tags` list built from a Terraform `tags` map.
|
|
29
|
+
*
|
|
30
|
+
* The provider also carries `tags_all`, which is `tags` merged with the
|
|
31
|
+
* provider's default tags. `tags_all` is the one that ends up on the resource.
|
|
32
|
+
*/
|
|
33
|
+
export declare function tags(context: TerraformMappingContext): SimCfnTemplateValue | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* One key of a Terraform attribute record.
|
|
36
|
+
*
|
|
37
|
+
* Provider attribute names are snake case, which this project's TypeScript
|
|
38
|
+
* settings will not let through a dotted access on an index signature.
|
|
39
|
+
*/
|
|
40
|
+
export declare function field(record: Record<string, unknown>, key: string): unknown;
|
|
41
|
+
/**
|
|
42
|
+
* A Terraform value, carried as the template value CloudFormation reads.
|
|
43
|
+
*
|
|
44
|
+
* Only an absent value comes back undefined. `false`, `0` and `""` are values
|
|
45
|
+
* a resource was configured with, and a truthiness test here would drop
|
|
46
|
+
* `block_public_acls = false` as though it had never been written.
|
|
47
|
+
*/
|
|
48
|
+
export declare function templateValue(value: unknown): SimCfnTemplateValue | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* CloudFormation properties read straight off Terraform attributes.
|
|
51
|
+
*
|
|
52
|
+
* The table is keyed by CloudFormation property name and holds the Terraform
|
|
53
|
+
* attribute each one is read from. Most of a mapping is this, because most
|
|
54
|
+
* properties differ only in what they are called, and the ones that need more
|
|
55
|
+
* than a rename are added to what this returns.
|
|
56
|
+
*/
|
|
57
|
+
export declare function renamed(context: TerraformMappingContext, names: Readonly<Record<string, string>>): Record<string, SimCfnTemplateValue>;
|
|
58
|
+
/** A property record with the keys carrying no value taken back out of it. */
|
|
59
|
+
export declare function properties(record: Record<string, SimCfnTemplateValue | undefined>): Record<string, SimCfnTemplateValue>;
|
|
60
|
+
//# sourceMappingURL=sim-tf-attributes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-tf-attributes.d.ts","sourceRoot":"","sources":["../../../../src/service/cloudformation/terraform/sim-tf-attributes.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAC;AACvF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AAIxE;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,QAAQ,EAAE,iBAAiB,CAAC;IACrC,QAAQ,CAAC,QAAQ,EAAE,0BAA0B,CAAC;CAC/C;AAED;;;;;;;GAOG;AACH,wBAAgB,SAAS,CACvB,OAAO,EAAE,uBAAuB,EAChC,GAAG,EAAE,MAAM,GACV,mBAAmB,GAAG,SAAS,CAQjC;AAqCD;;;GAGG;AACH,wBAAgB,KAAK,CACnB,OAAO,EAAE,uBAAuB,EAChC,GAAG,EAAE,MAAM,GACV,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAYrC;AAED,4DAA4D;AAC5D,wBAAgB,MAAM,CACpB,OAAO,EAAE,uBAAuB,EAChC,GAAG,EAAE,MAAM,GACV,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAIpC;AAED;;;;;GAKG;AACH,wBAAgB,IAAI,CAClB,OAAO,EAAE,uBAAuB,GAC/B,mBAAmB,GAAG,SAAS,CAcjC;AAED;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAE3E;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,mBAAmB,GAAG,SAAS,CAM7E;AAED;;;;;;;GAOG;AACH,wBAAgB,OAAO,CACrB,OAAO,EAAE,uBAAuB,EAChC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GACtC,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAMrC;AAED,8EAA8E;AAC9E,wBAAgB,UAAU,CACxB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,GAAG,SAAS,CAAC,GACtD,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAMrC"}
|
|
@@ -0,0 +1,121 @@
|
|
|
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 { longestFirst } from "./sim-tf-reference-address.js";
|
|
9
|
+
/**
|
|
10
|
+
* The value of one Terraform attribute, as CloudFormation would carry it.
|
|
11
|
+
*
|
|
12
|
+
* An attribute the plan resolved returns its value. An attribute still unknown
|
|
13
|
+
* returns the intrinsic that reads it off the Resource producing it, taken from
|
|
14
|
+
* the reference the configuration records for that attribute. An attribute with
|
|
15
|
+
* neither returns undefined.
|
|
16
|
+
*/
|
|
17
|
+
export function attribute(context, key) {
|
|
18
|
+
const { resource, resolver } = context;
|
|
19
|
+
if (resource.unknown[key] === true) {
|
|
20
|
+
return referencedValue(resource, key, resolver);
|
|
21
|
+
}
|
|
22
|
+
return templateValue(resource.values[key]);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* The intrinsic one unknown attribute reads, from the references its
|
|
26
|
+
* expression records.
|
|
27
|
+
*
|
|
28
|
+
* Terraform lists the attribute form and the bare resource form of the same
|
|
29
|
+
* reference. The attribute form resolves to a `Fn::GetAtt` and is the one
|
|
30
|
+
* wanted, so the first reference that resolves at all wins, and the list is
|
|
31
|
+
* ordered longest first to reach it.
|
|
32
|
+
*/
|
|
33
|
+
function referencedValue(resource, key, resolver) {
|
|
34
|
+
const expression = resource.expressions[key];
|
|
35
|
+
if (!isRecord(expression)) {
|
|
36
|
+
return undefined;
|
|
37
|
+
}
|
|
38
|
+
const references = longestFirst(expression.references ?? []);
|
|
39
|
+
for (const reference of references) {
|
|
40
|
+
const resolved = resolver.resolve(reference, resource.modulePath);
|
|
41
|
+
if (resolved !== undefined) {
|
|
42
|
+
return resolved;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return undefined;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* A Terraform nested block, which the plan represents as a list of records even
|
|
49
|
+
* where the schema allows only one.
|
|
50
|
+
*/
|
|
51
|
+
export function block(context, key) {
|
|
52
|
+
const value = context.resource.values[key];
|
|
53
|
+
if (isRecord(value)) {
|
|
54
|
+
return value;
|
|
55
|
+
}
|
|
56
|
+
if (Array.isArray(value) && isRecord(value[0])) {
|
|
57
|
+
return value[0];
|
|
58
|
+
}
|
|
59
|
+
return undefined;
|
|
60
|
+
}
|
|
61
|
+
/** Every entry of a Terraform nested block that repeats. */
|
|
62
|
+
export function blocks(context, key) {
|
|
63
|
+
const value = context.resource.values[key];
|
|
64
|
+
return Array.isArray(value) ? value.filter((entry) => isRecord(entry)) : [];
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* A CloudFormation `Tags` list built from a Terraform `tags` map.
|
|
68
|
+
*
|
|
69
|
+
* The provider also carries `tags_all`, which is `tags` merged with the
|
|
70
|
+
* provider's default tags. `tags_all` is the one that ends up on the resource.
|
|
71
|
+
*/
|
|
72
|
+
export function tags(context) {
|
|
73
|
+
const value = field(context.resource.values, "tags_all") ??
|
|
74
|
+
field(context.resource.values, "tags");
|
|
75
|
+
if (!isRecord(value)) {
|
|
76
|
+
return undefined;
|
|
77
|
+
}
|
|
78
|
+
const entries = Object.entries(value);
|
|
79
|
+
return entries.length === 0
|
|
80
|
+
? undefined
|
|
81
|
+
: entries.map(([Key, Value]) => ({ Key, Value: Value }));
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* One key of a Terraform attribute record.
|
|
85
|
+
*
|
|
86
|
+
* Provider attribute names are snake case, which this project's TypeScript
|
|
87
|
+
* settings will not let through a dotted access on an index signature.
|
|
88
|
+
*/
|
|
89
|
+
export function field(record, key) {
|
|
90
|
+
return record[key];
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* A Terraform value, carried as the template value CloudFormation reads.
|
|
94
|
+
*
|
|
95
|
+
* Only an absent value comes back undefined. `false`, `0` and `""` are values
|
|
96
|
+
* a resource was configured with, and a truthiness test here would drop
|
|
97
|
+
* `block_public_acls = false` as though it had never been written.
|
|
98
|
+
*/
|
|
99
|
+
export function templateValue(value) {
|
|
100
|
+
if (value === null || value === undefined) {
|
|
101
|
+
return undefined;
|
|
102
|
+
}
|
|
103
|
+
return value;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* CloudFormation properties read straight off Terraform attributes.
|
|
107
|
+
*
|
|
108
|
+
* The table is keyed by CloudFormation property name and holds the Terraform
|
|
109
|
+
* attribute each one is read from. Most of a mapping is this, because most
|
|
110
|
+
* properties differ only in what they are called, and the ones that need more
|
|
111
|
+
* than a rename are added to what this returns.
|
|
112
|
+
*/
|
|
113
|
+
export function renamed(context, names) {
|
|
114
|
+
const entries = Object.entries(names).map(([property, name]) => [property, attribute(context, name)]);
|
|
115
|
+
return properties(Object.fromEntries(entries));
|
|
116
|
+
}
|
|
117
|
+
/** A property record with the keys carrying no value taken back out of it. */
|
|
118
|
+
export function properties(record) {
|
|
119
|
+
return Object.fromEntries(Object.entries(record).filter((entry) => entry[1] !== undefined));
|
|
120
|
+
}
|
|
121
|
+
//# sourceMappingURL=sim-tf-attributes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-tf-attributes.js","sourceRoot":"","sources":["../../../../src/service/cloudformation/terraform/sim-tf-attributes.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type TerraformMappingContext } from "./sim-tf-attributes.js";
|
|
2
|
+
import type { TerraformMappedResource, TerraformResourceFold } from "./sim-tf-mapping.type.js";
|
|
3
|
+
/** A parameter. */
|
|
4
|
+
export declare function ssmParameter(context: TerraformMappingContext): TerraformMappedResource;
|
|
5
|
+
/** A secret. Its value arrives as an aws_secretsmanager_secret_version. */
|
|
6
|
+
export declare function secretsManagerSecret(context: TerraformMappingContext): TerraformMappedResource;
|
|
7
|
+
/**
|
|
8
|
+
* The secret value, which Terraform keeps in a resource of its own.
|
|
9
|
+
*
|
|
10
|
+
* CloudFormation carries the value on the `AWS::SecretsManager::Secret`, and
|
|
11
|
+
* simulated Secrets Manager refuses a Secret with no value at all.
|
|
12
|
+
*/
|
|
13
|
+
export declare const secretsManagerFolds: ReadonlyMap<string, TerraformResourceFold>;
|
|
14
|
+
//# sourceMappingURL=sim-tf-map-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-tf-map-config.d.ts","sourceRoot":"","sources":["../../../../src/service/cloudformation/terraform/sim-tf-map-config.ts"],"names":[],"mappings":"AAOA,OAAO,EAAW,KAAK,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAC/E,OAAO,KAAK,EACV,uBAAuB,EACvB,qBAAqB,EACtB,MAAM,0BAA0B,CAAC;AAElC,mBAAmB;AACnB,wBAAgB,YAAY,CAC1B,OAAO,EAAE,uBAAuB,GAC/B,uBAAuB,CAUzB;AAED,2EAA2E;AAC3E,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,uBAAuB,GAC/B,uBAAuB,CAKzB;AAED;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,EAAE,WAAW,CAAC,MAAM,EAAE,qBAAqB,CAUvE,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { renamed } from "./sim-tf-attributes.js";
|
|
2
|
+
/** A parameter. */
|
|
3
|
+
export function ssmParameter(context) {
|
|
4
|
+
return {
|
|
5
|
+
Type: "AWS::SSM::Parameter",
|
|
6
|
+
Properties: renamed(context, {
|
|
7
|
+
Name: "name",
|
|
8
|
+
Type: "type",
|
|
9
|
+
Value: "value",
|
|
10
|
+
Description: "description",
|
|
11
|
+
}),
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
/** A secret. Its value arrives as an aws_secretsmanager_secret_version. */
|
|
15
|
+
export function secretsManagerSecret(context) {
|
|
16
|
+
return {
|
|
17
|
+
Type: "AWS::SecretsManager::Secret",
|
|
18
|
+
Properties: renamed(context, { Name: "name", Description: "description" }),
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The secret value, which Terraform keeps in a resource of its own.
|
|
23
|
+
*
|
|
24
|
+
* CloudFormation carries the value on the `AWS::SecretsManager::Secret`, and
|
|
25
|
+
* simulated Secrets Manager refuses a Secret with no value at all.
|
|
26
|
+
*/
|
|
27
|
+
export const secretsManagerFolds = new Map([
|
|
28
|
+
[
|
|
29
|
+
"aws_secretsmanager_secret_version",
|
|
30
|
+
{
|
|
31
|
+
parentAttribute: "secret_id",
|
|
32
|
+
properties: (context) => renamed(context, { SecretString: "secret_string" }),
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
]);
|
|
36
|
+
//# sourceMappingURL=sim-tf-map-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-tf-map-config.js","sourceRoot":"","sources":["../../../../src/service/cloudformation/terraform/sim-tf-map-config.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,OAAO,EAAgC,MAAM,wBAAwB,CAAC;AAM/E,mBAAmB;AACnB,MAAM,UAAU,YAAY,CAC1B,OAAgC;IAEhC,OAAO;QACL,IAAI,EAAE,qBAAqB;QAC3B,UAAU,EAAE,OAAO,CAAC,OAAO,EAAE;YAC3B,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE,MAAM;YACZ,KAAK,EAAE,OAAO;YACd,WAAW,EAAE,aAAa;SAC3B,CAAC;KACH,CAAC;AACJ,CAAC;AAED,2EAA2E;AAC3E,MAAM,UAAU,oBAAoB,CAClC,OAAgC;IAEhC,OAAO;QACL,IAAI,EAAE,6BAA6B;QACnC,UAAU,EAAE,OAAO,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,aAAa,EAAE,CAAC;KAC3E,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAC9B,IAAI,GAAG,CAAC;IACN;QACE,mCAAmC;QACnC;YACE,eAAe,EAAE,WAAW;YAC5B,UAAU,EAAE,CAAC,OAAO,EAAuC,EAAE,CAC3D,OAAO,CAAC,OAAO,EAAE,EAAE,YAAY,EAAE,eAAe,EAAE,CAAC;SACtD;KACF;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { SimCfnTemplateValue } from "../template/value/sim-cfn-template-value.js";
|
|
2
|
+
import { type TerraformMappingContext } from "./sim-tf-attributes.js";
|
|
3
|
+
import type { TerraformMappedResource } from "./sim-tf-mapping.type.js";
|
|
4
|
+
/** A table, with the key schema rebuilt from its key attribute names. */
|
|
5
|
+
export declare function dynamodbTable(context: TerraformMappingContext): TerraformMappedResource;
|
|
6
|
+
/**
|
|
7
|
+
* A key schema, from the hash and range key attribute names.
|
|
8
|
+
*
|
|
9
|
+
* An optional string inside a nested block arrives as an empty string rather
|
|
10
|
+
* than as null, which is how a top-level optional attribute arrives. A range
|
|
11
|
+
* key that was never declared reads as `""`, and taking it at face value
|
|
12
|
+
* declares an index with a nameless RANGE element.
|
|
13
|
+
*/
|
|
14
|
+
export declare function keySchema(hashKey: unknown, rangeKey: unknown): SimCfnTemplateValue | undefined;
|
|
15
|
+
//# sourceMappingURL=sim-tf-map-dynamodb.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-tf-map-dynamodb.d.ts","sourceRoot":"","sources":["../../../../src/service/cloudformation/terraform/sim-tf-map-dynamodb.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAC;AACvF,OAAO,EAOL,KAAK,uBAAuB,EAC7B,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAExE,yEAAyE;AACzE,wBAAgB,aAAa,CAC3B,OAAO,EAAE,uBAAuB,GAC/B,uBAAuB,CAoBzB;AAsBD;;;;;;;GAOG;AACH,wBAAgB,SAAS,CACvB,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,OAAO,GAChB,mBAAmB,GAAG,SAAS,CAUjC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { block, blocks, field, properties, renamed, tags, } from "./sim-tf-attributes.js";
|
|
2
|
+
/** A table, with the key schema rebuilt from its key attribute names. */
|
|
3
|
+
export function dynamodbTable(context) {
|
|
4
|
+
const values = context.resource.values;
|
|
5
|
+
const ttl = block(context, "ttl");
|
|
6
|
+
return {
|
|
7
|
+
Type: "AWS::DynamoDB::Table",
|
|
8
|
+
Properties: {
|
|
9
|
+
...renamed(context, { TableName: "name", BillingMode: "billing_mode" }),
|
|
10
|
+
...properties({
|
|
11
|
+
AttributeDefinitions: attributeDefinitions(context),
|
|
12
|
+
KeySchema: keySchema(field(values, "hash_key"), field(values, "range_key")),
|
|
13
|
+
GlobalSecondaryIndexes: secondaryIndexes(context),
|
|
14
|
+
TimeToLiveSpecification: timeToLive(ttl),
|
|
15
|
+
Tags: tags(context),
|
|
16
|
+
}),
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
function attributeDefinitions(context) {
|
|
21
|
+
return blocks(context, "attribute").map((entry) => ({
|
|
22
|
+
AttributeName: field(entry, "name"),
|
|
23
|
+
AttributeType: field(entry, "type"),
|
|
24
|
+
}));
|
|
25
|
+
}
|
|
26
|
+
function timeToLive(ttl) {
|
|
27
|
+
return ttl === undefined
|
|
28
|
+
? undefined
|
|
29
|
+
: {
|
|
30
|
+
AttributeName: field(ttl, "attribute_name"),
|
|
31
|
+
Enabled: field(ttl, "enabled") === true,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* A key schema, from the hash and range key attribute names.
|
|
36
|
+
*
|
|
37
|
+
* An optional string inside a nested block arrives as an empty string rather
|
|
38
|
+
* than as null, which is how a top-level optional attribute arrives. A range
|
|
39
|
+
* key that was never declared reads as `""`, and taking it at face value
|
|
40
|
+
* declares an index with a nameless RANGE element.
|
|
41
|
+
*/
|
|
42
|
+
export function keySchema(hashKey, rangeKey) {
|
|
43
|
+
if (!named(hashKey)) {
|
|
44
|
+
return undefined;
|
|
45
|
+
}
|
|
46
|
+
const range = named(rangeKey)
|
|
47
|
+
? [{ AttributeName: rangeKey, KeyType: "RANGE" }]
|
|
48
|
+
: [];
|
|
49
|
+
return [{ AttributeName: hashKey, KeyType: "HASH" }, ...range];
|
|
50
|
+
}
|
|
51
|
+
function named(value) {
|
|
52
|
+
return typeof value === "string" && value.length > 0;
|
|
53
|
+
}
|
|
54
|
+
function secondaryIndexes(context) {
|
|
55
|
+
const indexes = blocks(context, "global_secondary_index");
|
|
56
|
+
if (indexes.length === 0) {
|
|
57
|
+
return undefined;
|
|
58
|
+
}
|
|
59
|
+
return indexes.map((index) => ({
|
|
60
|
+
IndexName: field(index, "name"),
|
|
61
|
+
KeySchema: keySchema(field(index, "hash_key"), field(index, "range_key")) ?? [],
|
|
62
|
+
Projection: properties({
|
|
63
|
+
ProjectionType: field(index, "projection_type"),
|
|
64
|
+
NonKeyAttributes: nonEmptyList(field(index, "non_key_attributes")),
|
|
65
|
+
}),
|
|
66
|
+
}));
|
|
67
|
+
}
|
|
68
|
+
/** A Terraform list attribute, where the provider left anything in it. */
|
|
69
|
+
function nonEmptyList(value) {
|
|
70
|
+
return Array.isArray(value) && value.length > 0
|
|
71
|
+
? value
|
|
72
|
+
: undefined;
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=sim-tf-map-dynamodb.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-tf-map-dynamodb.js","sourceRoot":"","sources":["../../../../src/service/cloudformation/terraform/sim-tf-map-dynamodb.ts"],"names":[],"mappings":"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"}
|
|
@@ -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 route, which needs the integration it targets to have been created. */
|
|
4
|
+
export declare function httpApiRoute(context: TerraformMappingContext): TerraformMappedResource;
|
|
5
|
+
//# sourceMappingURL=sim-tf-map-http-api-route.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-tf-map-http-api-route.d.ts","sourceRoot":"","sources":["../../../../src/service/cloudformation/terraform/sim-tf-map-http-api-route.ts"],"names":[],"mappings":"AAOA,OAAO,EAIL,KAAK,uBAAuB,EAC7B,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAExE,4EAA4E;AAC5E,wBAAgB,YAAY,CAC1B,OAAO,EAAE,uBAAuB,GAC/B,uBAAuB,CAazB"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { attribute, properties, renamed, } from "./sim-tf-attributes.js";
|
|
2
|
+
/** A route, which needs the integration it targets to have been created. */
|
|
3
|
+
export function httpApiRoute(context) {
|
|
4
|
+
return {
|
|
5
|
+
Type: "AWS::ApiGatewayV2::Route",
|
|
6
|
+
Properties: {
|
|
7
|
+
...renamed(context, {
|
|
8
|
+
ApiId: "api_id",
|
|
9
|
+
RouteKey: "route_key",
|
|
10
|
+
AuthorizationType: "authorization_type",
|
|
11
|
+
}),
|
|
12
|
+
...properties({ Target: routeTarget(context) }),
|
|
13
|
+
},
|
|
14
|
+
requires: ["Target"],
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* What the route sends a request to, as `integrations/<integration id>`.
|
|
19
|
+
*
|
|
20
|
+
* Terraform writes that string itself, and the integration ID inside it is
|
|
21
|
+
* unknown until the integration exists, which makes the whole string unknown.
|
|
22
|
+
* What survives is a reference to the integration, and a reference on its own
|
|
23
|
+
* is the ID without the prefix CloudFormation expects.
|
|
24
|
+
*/
|
|
25
|
+
function routeTarget(context) {
|
|
26
|
+
const target = attribute(context, "target");
|
|
27
|
+
if (target === undefined || typeof target === "string") {
|
|
28
|
+
return target;
|
|
29
|
+
}
|
|
30
|
+
return { "Fn::Join": ["", ["integrations/", target]] };
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=sim-tf-map-http-api-route.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-tf-map-http-api-route.js","sourceRoot":"","sources":["../../../../src/service/cloudformation/terraform/sim-tf-map-http-api-route.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,SAAS,EACT,UAAU,EACV,OAAO,GAER,MAAM,wBAAwB,CAAC;AAGhC,4EAA4E;AAC5E,MAAM,UAAU,YAAY,CAC1B,OAAgC;IAEhC,OAAO;QACL,IAAI,EAAE,0BAA0B;QAChC,UAAU,EAAE;YACV,GAAG,OAAO,CAAC,OAAO,EAAE;gBAClB,KAAK,EAAE,QAAQ;gBACf,QAAQ,EAAE,WAAW;gBACrB,iBAAiB,EAAE,oBAAoB;aACxC,CAAC;YACF,GAAG,UAAU,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,OAAO,CAAC,EAAE,CAAC;SAChD;QACD,QAAQ,EAAE,CAAC,QAAQ,CAAC;KACrB,CAAC;AACJ,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,WAAW,CAClB,OAAgC;IAEhC,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IAE5C,IAAI,MAAM,KAAK,SAAS,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;QACvD,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,OAAO,EAAE,UAAU,EAAE,CAAC,EAAE,EAAE,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC;AACzD,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type TerraformMappingContext } from "./sim-tf-attributes.js";
|
|
2
|
+
import type { TerraformMappedResource } from "./sim-tf-mapping.type.js";
|
|
3
|
+
/** An HTTP API. */
|
|
4
|
+
export declare function httpApi(context: TerraformMappingContext): TerraformMappedResource;
|
|
5
|
+
/**
|
|
6
|
+
* An integration. Its URI is the value a plan most often cannot resolve,
|
|
7
|
+
* because it names a function that does not exist yet.
|
|
8
|
+
*/
|
|
9
|
+
export declare function httpApiIntegration(context: TerraformMappingContext): TerraformMappedResource;
|
|
10
|
+
/** A stage. */
|
|
11
|
+
export declare function httpApiStage(context: TerraformMappingContext): TerraformMappedResource;
|
|
12
|
+
//# sourceMappingURL=sim-tf-map-http-api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-tf-map-http-api.d.ts","sourceRoot":"","sources":["../../../../src/service/cloudformation/terraform/sim-tf-map-http-api.ts"],"names":[],"mappings":"AAOA,OAAO,EAOL,KAAK,uBAAuB,EAC7B,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAExE,mBAAmB;AACnB,wBAAgB,OAAO,CACrB,OAAO,EAAE,uBAAuB,GAC/B,uBAAuB,CAWzB;AAgBD;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,uBAAuB,GAC/B,uBAAuB,CAWzB;AAED,eAAe;AACf,wBAAgB,YAAY,CAC1B,OAAO,EAAE,uBAAuB,GAC/B,uBAAuB,CASzB"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { block, field, properties, renamed, tags, templateValue, } from "./sim-tf-attributes.js";
|
|
2
|
+
/** An HTTP API. */
|
|
3
|
+
export function httpApi(context) {
|
|
4
|
+
return {
|
|
5
|
+
Type: "AWS::ApiGatewayV2::Api",
|
|
6
|
+
Properties: {
|
|
7
|
+
...renamed(context, { Name: "name", ProtocolType: "protocol_type" }),
|
|
8
|
+
...properties({
|
|
9
|
+
CorsConfiguration: cors(block(context, "cors_configuration")),
|
|
10
|
+
Tags: tags(context),
|
|
11
|
+
}),
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
function cors(configured) {
|
|
16
|
+
if (configured === undefined) {
|
|
17
|
+
return undefined;
|
|
18
|
+
}
|
|
19
|
+
return properties({
|
|
20
|
+
AllowOrigins: templateValue(field(configured, "allow_origins")),
|
|
21
|
+
AllowMethods: templateValue(field(configured, "allow_methods")),
|
|
22
|
+
AllowHeaders: templateValue(field(configured, "allow_headers")),
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* An integration. Its URI is the value a plan most often cannot resolve,
|
|
27
|
+
* because it names a function that does not exist yet.
|
|
28
|
+
*/
|
|
29
|
+
export function httpApiIntegration(context) {
|
|
30
|
+
return {
|
|
31
|
+
Type: "AWS::ApiGatewayV2::Integration",
|
|
32
|
+
Properties: renamed(context, {
|
|
33
|
+
ApiId: "api_id",
|
|
34
|
+
IntegrationType: "integration_type",
|
|
35
|
+
IntegrationUri: "integration_uri",
|
|
36
|
+
PayloadFormatVersion: "payload_format_version",
|
|
37
|
+
}),
|
|
38
|
+
requires: ["IntegrationUri"],
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
/** A stage. */
|
|
42
|
+
export function httpApiStage(context) {
|
|
43
|
+
return {
|
|
44
|
+
Type: "AWS::ApiGatewayV2::Stage",
|
|
45
|
+
Properties: renamed(context, {
|
|
46
|
+
ApiId: "api_id",
|
|
47
|
+
StageName: "name",
|
|
48
|
+
AutoDeploy: "auto_deploy",
|
|
49
|
+
}),
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=sim-tf-map-http-api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-tf-map-http-api.js","sourceRoot":"","sources":["../../../../src/service/cloudformation/terraform/sim-tf-map-http-api.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,KAAK,EACL,KAAK,EACL,UAAU,EACV,OAAO,EACP,IAAI,EACJ,aAAa,GAEd,MAAM,wBAAwB,CAAC;AAGhC,mBAAmB;AACnB,MAAM,UAAU,OAAO,CACrB,OAAgC;IAEhC,OAAO;QACL,IAAI,EAAE,wBAAwB;QAC9B,UAAU,EAAE;YACV,GAAG,OAAO,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,eAAe,EAAE,CAAC;YACpE,GAAG,UAAU,CAAC;gBACZ,iBAAiB,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,oBAAoB,CAAC,CAAC;gBAC7D,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC;aACpB,CAAC;SACH;KACF,CAAC;AACJ,CAAC;AAED,SAAS,IAAI,CACX,UAA+C;IAE/C,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;QAC7B,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO,UAAU,CAAC;QAChB,YAAY,EAAE,aAAa,CAAC,KAAK,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC;QAC/D,YAAY,EAAE,aAAa,CAAC,KAAK,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC;QAC/D,YAAY,EAAE,aAAa,CAAC,KAAK,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC;KAChE,CAAC,CAAC;AACL,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,kBAAkB,CAChC,OAAgC;IAEhC,OAAO;QACL,IAAI,EAAE,gCAAgC;QACtC,UAAU,EAAE,OAAO,CAAC,OAAO,EAAE;YAC3B,KAAK,EAAE,QAAQ;YACf,eAAe,EAAE,kBAAkB;YACnC,cAAc,EAAE,iBAAiB;YACjC,oBAAoB,EAAE,wBAAwB;SAC/C,CAAC;QACF,QAAQ,EAAE,CAAC,gBAAgB,CAAC;KAC7B,CAAC;AACJ,CAAC;AAED,eAAe;AACf,MAAM,UAAU,YAAY,CAC1B,OAAgC;IAEhC,OAAO;QACL,IAAI,EAAE,0BAA0B;QAChC,UAAU,EAAE,OAAO,CAAC,OAAO,EAAE;YAC3B,KAAK,EAAE,QAAQ;YACf,SAAS,EAAE,MAAM;YACjB,UAAU,EAAE,aAAa;SAC1B,CAAC;KACH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type TerraformMappingContext } from "./sim-tf-attributes.js";
|
|
2
|
+
import type { TerraformMappedResource, TerraformResourceFold } from "./sim-tf-mapping.type.js";
|
|
3
|
+
/** A role. The policies on it arrive as resources of their own. */
|
|
4
|
+
export declare function iamRole(context: TerraformMappingContext): TerraformMappedResource;
|
|
5
|
+
/** A log group. Terraform spells "never expire" as a retention of zero. */
|
|
6
|
+
export declare function logGroup(context: TerraformMappingContext): TerraformMappedResource;
|
|
7
|
+
/** The IAM resources that attach policy to a role declared elsewhere. */
|
|
8
|
+
export declare const iamRoleFolds: ReadonlyMap<string, TerraformResourceFold>;
|
|
9
|
+
//# sourceMappingURL=sim-tf-map-iam.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-tf-map-iam.d.ts","sourceRoot":"","sources":["../../../../src/service/cloudformation/terraform/sim-tf-map-iam.ts"],"names":[],"mappings":"AAQA,OAAO,EAOL,KAAK,uBAAuB,EAC7B,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EACV,uBAAuB,EACvB,qBAAqB,EACtB,MAAM,0BAA0B,CAAC;AAElC,mEAAmE;AACnE,wBAAgB,OAAO,CACrB,OAAO,EAAE,uBAAuB,GAC/B,uBAAuB,CAgBzB;AAED,2EAA2E;AAC3E,wBAAgB,QAAQ,CACtB,OAAO,EAAE,uBAAuB,GAC/B,uBAAuB,CAYzB;AAED,yEAAyE;AACzE,eAAO,MAAM,YAAY,EAAE,WAAW,CAAC,MAAM,EAAE,qBAAqB,CAWnE,CAAC"}
|
|
@@ -0,0 +1,80 @@
|
|
|
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 { attribute, field, properties, renamed, tags, templateValue, } from "./sim-tf-attributes.js";
|
|
9
|
+
/** A role. The policies on it arrive as resources of their own. */
|
|
10
|
+
export function iamRole(context) {
|
|
11
|
+
const assume = jsonDocument(field(context.resource.values, "assume_role_policy"));
|
|
12
|
+
return {
|
|
13
|
+
Type: "AWS::IAM::Role",
|
|
14
|
+
Properties: {
|
|
15
|
+
...renamed(context, { RoleName: "name" }),
|
|
16
|
+
...properties({
|
|
17
|
+
AssumeRolePolicyDocument: assume,
|
|
18
|
+
Tags: tags(context),
|
|
19
|
+
}),
|
|
20
|
+
},
|
|
21
|
+
lost: assume === undefined ? ["assume_role_policy"] : [],
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
/** A log group. Terraform spells "never expire" as a retention of zero. */
|
|
25
|
+
export function logGroup(context) {
|
|
26
|
+
const retention = attribute(context, "retention_in_days");
|
|
27
|
+
return {
|
|
28
|
+
Type: "AWS::Logs::LogGroup",
|
|
29
|
+
Properties: {
|
|
30
|
+
...renamed(context, { LogGroupName: "name" }),
|
|
31
|
+
...properties({
|
|
32
|
+
RetentionInDays: retention === 0 ? undefined : retention,
|
|
33
|
+
}),
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
/** The IAM resources that attach policy to a role declared elsewhere. */
|
|
38
|
+
export const iamRoleFolds = new Map([
|
|
39
|
+
[
|
|
40
|
+
"aws_iam_role_policy",
|
|
41
|
+
{ parentAttribute: "role", properties: inlinePolicy },
|
|
42
|
+
],
|
|
43
|
+
[
|
|
44
|
+
"aws_iam_role_policy_attachment",
|
|
45
|
+
{ parentAttribute: "role", properties: managedPolicy },
|
|
46
|
+
],
|
|
47
|
+
]);
|
|
48
|
+
function inlinePolicy(context) {
|
|
49
|
+
const document = jsonDocument(field(context.resource.values, "policy"));
|
|
50
|
+
if (document === undefined) {
|
|
51
|
+
return {};
|
|
52
|
+
}
|
|
53
|
+
return {
|
|
54
|
+
Policies: [{ PolicyName: policyName(context), PolicyDocument: document }],
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
function managedPolicy(context) {
|
|
58
|
+
const arn = attribute(context, "policy_arn");
|
|
59
|
+
return arn === undefined ? {} : { ManagedPolicyArns: [arn] };
|
|
60
|
+
}
|
|
61
|
+
/** The name of an inline role policy, which Terraform lets go unnamed. */
|
|
62
|
+
function policyName(context) {
|
|
63
|
+
const name = attribute(context, "name");
|
|
64
|
+
return typeof name === "string" && name.length > 0 ? name : "inline";
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* A policy document, which Terraform carries as a JSON string and
|
|
68
|
+
* CloudFormation as an object.
|
|
69
|
+
*
|
|
70
|
+
* A document built with `jsonencode` around an ARN of the same plan is unknown
|
|
71
|
+
* in its entirety, so this returns nothing rather than a partial policy.
|
|
72
|
+
*/
|
|
73
|
+
function jsonDocument(value) {
|
|
74
|
+
if (typeof value !== "string") {
|
|
75
|
+
return undefined;
|
|
76
|
+
}
|
|
77
|
+
const parsed = JSON.parse(value);
|
|
78
|
+
return isRecord(parsed) ? templateValue(parsed) : undefined;
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=sim-tf-map-iam.js.map
|