@cdktn/hcl2cdk 0.25.0-pre.9 → 0.25.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/README.md +12 -0
  2. package/build/coerceType.js +21 -11
  3. package/build/dynamic-blocks.js +3 -3
  4. package/build/expressions.js +24 -17
  5. package/build/generation.js +34 -24
  6. package/build/index.js +27 -17
  7. package/build/iteration.js +6 -7
  8. package/build/jsii-rosetta-workarounds.js +5 -6
  9. package/build/partialCode.js +20 -11
  10. package/build/provider.js +3 -4
  11. package/build/references.js +5 -6
  12. package/build/schema.js +18 -8
  13. package/build/terraformSchema.js +4 -4
  14. package/build/utils.js +3 -3
  15. package/build/variables.js +21 -12
  16. package/package.json +18 -17
  17. package/.spec.swcrc +0 -22
  18. package/build/__tests__/coerceType.test.d.ts +0 -2
  19. package/build/__tests__/coerceType.test.js +0 -165
  20. package/build/__tests__/expressionToTs.test.d.ts +0 -6
  21. package/build/__tests__/expressionToTs.test.js +0 -693
  22. package/build/__tests__/expressions.test.d.ts +0 -4
  23. package/build/__tests__/expressions.test.js +0 -415
  24. package/build/__tests__/findExpressionType.test.d.ts +0 -6
  25. package/build/__tests__/findExpressionType.test.js +0 -105
  26. package/build/__tests__/functions.test.d.ts +0 -6
  27. package/build/__tests__/functions.test.js +0 -605
  28. package/build/__tests__/generation.test.d.ts +0 -6
  29. package/build/__tests__/generation.test.js +0 -45
  30. package/build/__tests__/jsii-rosetta-workarounds.test.d.ts +0 -2
  31. package/build/__tests__/jsii-rosetta-workarounds.test.js +0 -86
  32. package/build/__tests__/partialCode.test.d.ts +0 -6
  33. package/build/__tests__/partialCode.test.js +0 -390
  34. package/build/__tests__/terraformSchema.test.d.ts +0 -6
  35. package/build/__tests__/terraformSchema.test.js +0 -105
  36. package/build/__tests__/testHelpers.d.ts +0 -7
  37. package/build/__tests__/testHelpers.js +0 -16
  38. package/jest.config.js +0 -25
  39. package/package.sh +0 -9
  40. package/src/__tests__/coerceType.test.ts +0 -207
  41. package/src/__tests__/expressionToTs.test.ts +0 -1167
  42. package/src/__tests__/expressions.test.ts +0 -541
  43. package/src/__tests__/findExpressionType.test.ts +0 -112
  44. package/src/__tests__/functions.test.ts +0 -768
  45. package/src/__tests__/generation.test.ts +0 -72
  46. package/src/__tests__/jsii-rosetta-workarounds.test.ts +0 -145
  47. package/src/__tests__/partialCode.test.ts +0 -432
  48. package/src/__tests__/terraformSchema.test.ts +0 -107
  49. package/src/__tests__/testHelpers.ts +0 -11
  50. package/src/coerceType.ts +0 -261
  51. package/src/dynamic-blocks.ts +0 -61
  52. package/src/expressions.ts +0 -968
  53. package/src/function-bindings/functions.generated.ts +0 -1211
  54. package/src/function-bindings/functions.ts +0 -104
  55. package/src/generation.ts +0 -1189
  56. package/src/index.ts +0 -584
  57. package/src/iteration.ts +0 -156
  58. package/src/jsii-rosetta-workarounds.ts +0 -145
  59. package/src/partialCode.ts +0 -132
  60. package/src/provider.ts +0 -60
  61. package/src/references.ts +0 -193
  62. package/src/schema.ts +0 -74
  63. package/src/terraformSchema.ts +0 -182
  64. package/src/types.ts +0 -58
  65. package/src/utils.ts +0 -19
  66. package/src/variables.ts +0 -214
  67. package/test/__snapshots__/backends.test.ts.snap +0 -70
  68. package/test/__snapshots__/externals.test.ts.snap +0 -37
  69. package/test/__snapshots__/granular-imports.test.ts.snap +0 -180
  70. package/test/__snapshots__/imports.test.ts.snap +0 -159
  71. package/test/__snapshots__/iteration.test.ts.snap +0 -532
  72. package/test/__snapshots__/jsiiLanguage.test.ts.snap +0 -347
  73. package/test/__snapshots__/locals.test.ts.snap +0 -55
  74. package/test/__snapshots__/modules.test.ts.snap +0 -127
  75. package/test/__snapshots__/outputs.test.ts.snap +0 -77
  76. package/test/__snapshots__/partialCode.test.ts.snap +0 -120
  77. package/test/__snapshots__/provider.test.ts.snap +0 -128
  78. package/test/__snapshots__/references.test.ts.snap +0 -376
  79. package/test/__snapshots__/resource-meta-properties.test.ts.snap +0 -342
  80. package/test/__snapshots__/resources.test.ts.snap +0 -613
  81. package/test/__snapshots__/tfExpressions.test.ts.snap +0 -537
  82. package/test/__snapshots__/typeCoercion.test.ts.snap +0 -253
  83. package/test/__snapshots__/variables.test.ts.snap +0 -150
  84. package/test/backends.test.ts +0 -75
  85. package/test/convertProject.test.ts +0 -257
  86. package/test/externals.test.ts +0 -35
  87. package/test/globalSetup.ts +0 -224
  88. package/test/globalTeardown.ts +0 -11
  89. package/test/granular-imports.test.ts +0 -161
  90. package/test/hcl2cdk.test.ts +0 -88
  91. package/test/helpers/convert.ts +0 -544
  92. package/test/helpers/tmp.ts +0 -40
  93. package/test/imports.test.ts +0 -141
  94. package/test/iteration.test.ts +0 -342
  95. package/test/jsiiLanguage.test.ts +0 -73
  96. package/test/locals.test.ts +0 -47
  97. package/test/modules.test.ts +0 -143
  98. package/test/outputs.test.ts +0 -69
  99. package/test/partialCode.test.ts +0 -25
  100. package/test/provider.test.ts +0 -106
  101. package/test/references.test.ts +0 -287
  102. package/test/resource-meta-properties.test.ts +0 -288
  103. package/test/resources.test.ts +0 -551
  104. package/test/tfExpressions.test.ts +0 -300
  105. package/test/typeCoercion.test.ts +0 -154
  106. package/test/variables.test.ts +0 -96
  107. package/tsconfig.json +0 -43
@@ -1,537 +0,0 @@
1
- // Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
2
-
3
- exports[`tfExpressions arithmetics snapshot typescript 1`] = `
4
- "import { Construct } from "constructs";
5
- import {
6
- VariableType,
7
- TerraformVariable,
8
- TerraformOutput,
9
- Op,
10
- TerraformStack,
11
- } from "cdktn";
12
- class MyConvertedCode extends TerraformStack {
13
- constructor(scope: Construct, name: string) {
14
- super(scope, name);
15
- /*Terraform Variables are not always the best fit for getting inputs in the context of Terraform CDK.
16
- You can read more about this at https://cdktn.io/docs/concepts/variables-and-outputs#input-variables*/
17
- const admins = new TerraformVariable(this, "admins", {
18
- type: VariableType.NUMBER,
19
- });
20
- const members = new TerraformVariable(this, "members", {
21
- type: VariableType.NUMBER,
22
- });
23
- new TerraformOutput(this, "arithmetics", {
24
- value: Op.add(members.value, admins.value),
25
- });
26
- }
27
- }
28
- "
29
- `;
30
-
31
- exports[`tfExpressions conditionals snapshot typescript 1`] = `
32
- "import { Construct } from "constructs";
33
- import { Op, conditional, Token, TerraformStack } from "cdktn";
34
- /*
35
- * Provider bindings are generated by running \`cdktn get\`.
36
- * See https://cdktn.io/docs/concepts/providers#import-providers for more details.
37
- */
38
- import { KmsKey } from "./.gen/providers/aws/kms-key";
39
- import { AwsProvider } from "./.gen/providers/aws/provider";
40
- import { S3Bucket } from "./.gen/providers/aws/s3-bucket";
41
- import { S3BucketObject } from "./.gen/providers/aws/s3-bucket-object";
42
- class MyConvertedCode extends TerraformStack {
43
- constructor(scope: Construct, name: string) {
44
- super(scope, name);
45
- new AwsProvider(this, "aws", {
46
- region: "us-east-1",
47
- });
48
- const examplekms = new KmsKey(this, "examplekms", {
49
- deletionWindowInDays: 7,
50
- description: "KMS key 1",
51
- });
52
- const examplebucket = new S3Bucket(this, "examplebucket", {
53
- acl: "private",
54
- bucket: "examplebuckettftest",
55
- });
56
- new S3BucketObject(this, "examplebucket_object", {
57
- bucket: Token.asString(
58
- conditional(
59
- Op.gt(examplekms.deletionWindowInDays, 3),
60
- examplebucket.id,
61
- []
62
- )
63
- ),
64
- key: "someobject",
65
- kmsKeyId: examplekms.arn,
66
- source: "index.html",
67
- });
68
- }
69
- }
70
- "
71
- `;
72
-
73
- exports[`tfExpressions escaping dollar-curly in template strings works snapshot typescript 1`] = `
74
- "import { Construct } from "constructs";
75
- import { TerraformStack } from "cdktn";
76
- /*
77
- * Provider bindings are generated by running \`cdktn get\`.
78
- * See https://cdktn.io/docs/concepts/providers#import-providers for more details.
79
- */
80
- import { SsoadminInstanceAccessControlAttributes } from "./.gen/providers/aws/ssoadmin-instance-access-control-attributes";
81
- interface MyConfig {
82
- key: any;
83
- instanceArn: any;
84
- }
85
- class MyConvertedCode extends TerraformStack {
86
- constructor(scope: Construct, name: string, config: MyConfig) {
87
- super(scope, name);
88
- new SsoadminInstanceAccessControlAttributes(this, "example", {
89
- attribute: [
90
- {
91
- value: [
92
- {
93
- source: ["$\${path:name.givenName}"],
94
- },
95
- ],
96
- key: config.key,
97
- },
98
- ],
99
- instanceArn: config.instanceArn,
100
- });
101
- }
102
- }
103
- "
104
- `;
105
-
106
- exports[`tfExpressions for expression 1 snapshot typescript 1`] = `
107
- "import { Construct } from "constructs";
108
- import {
109
- VariableType,
110
- TerraformVariable,
111
- TerraformOutput,
112
- TerraformStack,
113
- } from "cdktn";
114
- class MyConvertedCode extends TerraformStack {
115
- constructor(scope: Construct, name: string) {
116
- super(scope, name);
117
- /*Terraform Variables are not always the best fit for getting inputs in the context of Terraform CDK.
118
- You can read more about this at https://cdktn.io/docs/concepts/variables-and-outputs#input-variables*/
119
- const users = new TerraformVariable(this, "users", {
120
- type: VariableType.map(
121
- VariableType.object({
122
- is_admin: VariableType.ANY,
123
- })
124
- ),
125
- });
126
- const adminUsers =
127
- "\${{ for name, user in \${" +
128
- users.value +
129
- "} : name => user if user.is_admin}}";
130
- const regularUsers =
131
- "\${{ for name, user in \${" +
132
- users.value +
133
- "} : name => user if !user.is_admin}}";
134
- new TerraformOutput(this, "combined-so-it-does-not-get-removed", {
135
- value: "\${" + adminUsers + "},\${" + regularUsers + "}",
136
- });
137
- }
138
- }
139
- "
140
- `;
141
-
142
- exports[`tfExpressions for expression 2 snapshot typescript 1`] = `
143
- "import { Construct } from "constructs";
144
- import {
145
- VariableType,
146
- TerraformVariable,
147
- TerraformOutput,
148
- TerraformStack,
149
- } from "cdktn";
150
- class MyConvertedCode extends TerraformStack {
151
- constructor(scope: Construct, name: string) {
152
- super(scope, name);
153
- /*Terraform Variables are not always the best fit for getting inputs in the context of Terraform CDK.
154
- You can read more about this at https://cdktn.io/docs/concepts/variables-and-outputs#input-variables*/
155
- const users = new TerraformVariable(this, "users", {
156
- type: VariableType.map(
157
- VariableType.object({
158
- role: VariableType.STRING,
159
- })
160
- ),
161
- });
162
- const usersByRole =
163
- "\${{ for name, user in \${" + users.value + "} : user.role => name...}}";
164
- new TerraformOutput(this, "so-it-does-not-get-removed", {
165
- value: usersByRole,
166
- });
167
- }
168
- }
169
- "
170
- `;
171
-
172
- exports[`tfExpressions for expression 3 snapshot typescript 1`] = `
173
- "import { Construct } from "constructs";
174
- import {
175
- VariableType,
176
- TerraformVariable,
177
- Fn,
178
- Token,
179
- TerraformStack,
180
- } from "cdktn";
181
- /*
182
- * Provider bindings are generated by running \`cdktn get\`.
183
- * See https://cdktn.io/docs/concepts/providers#import-providers for more details.
184
- */
185
- import { Monitor } from "./.gen/providers/datadog/monitor";
186
- import { DatadogProvider } from "./.gen/providers/datadog/provider";
187
- class MyConvertedCode extends TerraformStack {
188
- constructor(scope: Construct, name: string) {
189
- super(scope, name);
190
- /*Terraform Variables are not always the best fit for getting inputs in the context of Terraform CDK.
191
- You can read more about this at https://cdktn.io/docs/concepts/variables-and-outputs#input-variables*/
192
- new DatadogProvider(this, "datadog", {
193
- apiKey: "api_key",
194
- appKey: "app_key",
195
- });
196
- const users = new TerraformVariable(this, "users", {
197
- type: VariableType.list(
198
- VariableType.object({
199
- id: VariableType.STRING,
200
- })
201
- ),
202
- });
203
- new Monitor(this, "hard_query", {
204
- message: "here we go",
205
- name: "queries are hard",
206
- query: Token.asString(
207
- Fn.join(
208
- " && ",
209
- Token.asList("\${[ for o in \${" + users.value + '} : "!(!\${o.id})"]}')
210
- )
211
- ),
212
- type: "metric alert",
213
- });
214
- }
215
- }
216
- "
217
- `;
218
-
219
- exports[`tfExpressions list access through square brackets snapshot typescript 1`] = `
220
- "import { Construct } from "constructs";
221
- import {
222
- VariableType,
223
- TerraformVariable,
224
- Fn,
225
- Token,
226
- TerraformStack,
227
- } from "cdktn";
228
- /*
229
- * Provider bindings are generated by running \`cdktn get\`.
230
- * See https://cdktn.io/docs/concepts/providers#import-providers for more details.
231
- */
232
- import { AwsProvider } from "./.gen/providers/aws/provider";
233
- import { S3Bucket } from "./.gen/providers/aws/s3-bucket";
234
- class MyConvertedCode extends TerraformStack {
235
- constructor(scope: Construct, name: string) {
236
- super(scope, name);
237
- /*Terraform Variables are not always the best fit for getting inputs in the context of Terraform CDK.
238
- You can read more about this at https://cdktn.io/docs/concepts/variables-and-outputs#input-variables*/
239
- new AwsProvider(this, "aws", {
240
- region: "us-east-1",
241
- });
242
- const settings = new TerraformVariable(this, "settings", {
243
- type: VariableType.list(VariableType.map(VariableType.STRING)),
244
- });
245
- new S3Bucket(this, "examplebucket", {
246
- acl: "private",
247
- bucket: Token.asString(
248
- Fn.lookupNested(settings.value, ["0", '"bucket_name"'])
249
- ),
250
- });
251
- }
252
- }
253
- "
254
- `;
255
-
256
- exports[`tfExpressions multi-line strings are supported snapshot typescript 1`] = `
257
- "import { Construct } from "constructs";
258
- import { TerraformOutput, TerraformStack } from "cdktn";
259
- class MyConvertedCode extends TerraformStack {
260
- constructor(scope: Construct, name: string) {
261
- super(scope, name);
262
- new TerraformOutput(this, "hash", {
263
- value:
264
- '{\\n "example_hash_key": {"S": "something"},\\n "example_attribute": {"N": "11111"}\\n}\\n\\n',
265
- });
266
- }
267
- }
268
- "
269
- `;
270
-
271
- exports[`tfExpressions numeric property access snapshot typescript 1`] = `
272
- "import { Construct } from "constructs";
273
- import { TerraformOutput, Fn, TerraformStack } from "cdktn";
274
- /*
275
- * Provider bindings are generated by running \`cdktn get\`.
276
- * See https://cdktn.io/docs/concepts/providers#import-providers for more details.
277
- */
278
- import { ComputeInstance } from "./.gen/providers/google/compute-instance";
279
- import { GoogleProvider } from "./.gen/providers/google/provider";
280
- class MyConvertedCode extends TerraformStack {
281
- constructor(scope: Construct, name: string) {
282
- super(scope, name);
283
- new GoogleProvider(this, "google", {
284
- project: "my-project",
285
- region: "us-central1",
286
- });
287
- const example = new ComputeInstance(this, "example", {
288
- bootDisk: {
289
- initializeParams: {
290
- image: "debian-cloud/debian-9",
291
- },
292
- },
293
- machineType: "f1-micro",
294
- name: "example",
295
- networkInterface: [
296
- {
297
- accessConfig: [{}],
298
- network: "default",
299
- },
300
- ],
301
- zone: "us-east1-b",
302
- });
303
- new TerraformOutput(this, "public_ip", {
304
- value: Fn.lookupNested(example.networkInterface, [
305
- "0",
306
- "access_config",
307
- "0",
308
- "assigned_nat_ip",
309
- ]),
310
- });
311
- }
312
- }
313
- "
314
- `;
315
-
316
- exports[`tfExpressions property access in maps works snapshot csharp 1`] = `
317
- "using Constructs;
318
- using Io.Cdktn;
319
- /*
320
- * Provider bindings are generated by running \`cdktn get\`.
321
- * See https://cdktn.io/docs/concepts/providers#import-providers for more details.
322
- */
323
- using aws.Eip;
324
- class MyConvertedCode : TerraformStack
325
- {
326
- public MyConvertedCode(Construct scope, string name) : base(scope, name)
327
- {
328
- /*Terraform Variables are not always the best fit for getting inputs in the context of Terraform CDK.
329
- You can read more about this at https://cdktn.io/docs/concepts/variables-and-outputs#input-variables*/
330
- var defaultTags = new TerraformVariable(this, "default_tags", new TerraformVariableConfig {
331
- Default = new [] { new Dictionary<string, string> {
332
- { "project", "Learning Live with AWS & HashiCorp" }
333
- } },
334
- Description = "Map of default tags to apply to resources",
335
- Type = VariableType.Map(VariableType.STRING)
336
- });
337
- new Eip(this, "nat", new EipConfig {
338
- Tags = new Dictionary<string, string> {
339
- { "Name", Token.AsString(Fn.LookupNested(defaultTags.Value, new [] { "project" })) + "-nat-eip" }
340
- },
341
- Vpc = true
342
- });
343
- }
344
- }"
345
- `;
346
-
347
- exports[`tfExpressions property access in maps works snapshot go 1`] = `
348
- "import "github.com/aws/constructs-go/constructs"
349
- import "github.com/open-constructs/cdk-terrain-go/cdktn"
350
- /*
351
- * Provider bindings are generated by running \`cdktn get\`.
352
- * See https://cdktn.io/docs/concepts/providers#import-providers for more details.
353
- */
354
- import "cdk.tf/go/stack/generated/aws/eip"
355
- type myConvertedCode struct {
356
- TerraformStack
357
- }
358
-
359
- func newMyConvertedCode(scope Construct, name *string) *myConvertedCode {
360
- this := &myConvertedCode{}
361
- newTerraformStack_Override(this, scope, name)
362
- /*Terraform Variables are not always the best fit for getting inputs in the context of Terraform CDK.
363
- You can read more about this at https://cdktn.io/docs/concepts/variables-and-outputs#input-variables*/
364
- defaultTags := cdktn.NewTerraformVariable(this, jsii.String("default_tags"), &TerraformVariableConfig{
365
- Default: []interface{}{
366
- map[string]*string{
367
- "project": jsii.String("Learning Live with AWS & HashiCorp"),
368
- },
369
- },
370
- Description: jsii.String("Map of default tags to apply to resources"),
371
- Type: cdktn.VariableType_Map(cdktn.VariableType_STRING()),
372
- })
373
- genprovidersawseip.NewEip(this, jsii.String("nat"), &EipConfig{
374
- tags: map[string]*string{
375
- "Name": jsii.String(cdktn.Token_asString(cdktn.Fn_lookupNested(defaultTags.value, []interface{}{
376
- jsii.String("project"),
377
- })) + "-nat-eip"),
378
- },
379
- vpc: jsii.Boolean(true),
380
- })
381
- return this
382
- }"
383
- `;
384
-
385
- exports[`tfExpressions property access in maps works snapshot java 1`] = `
386
- "import software.constructs.Construct;
387
- import io.cdktn.cdktn.VariableType;
388
- import io.cdktn.cdktn.TerraformVariable;
389
- import io.cdktn.cdktn.Fn;
390
- import io.cdktn.cdktn.Token;
391
- import io.cdktn.cdktn.TerraformStack;
392
- /*
393
- * Provider bindings are generated by running \`cdktn get\`.
394
- * See https://cdktn.io/docs/concepts/providers#import-providers for more details.
395
- */
396
- import imports.aws.eip.Eip;
397
- public class MyConvertedCode extends TerraformStack {
398
- public MyConvertedCode(Construct scope, String name) {
399
- super(scope, name);
400
- /*Terraform Variables are not always the best fit for getting inputs in the context of Terraform CDK.
401
- You can read more about this at https://cdktn.io/docs/concepts/variables-and-outputs#input-variables*/
402
- TerraformVariable defaultTags = TerraformVariable.Builder.create(this, "default_tags")
403
- .default(List.of(Map.of(
404
- "project", "Learning Live with AWS & HashiCorp")))
405
- .description("Map of default tags to apply to resources")
406
- .type(VariableType.map(VariableType.STRING))
407
- .build();
408
- new Eip(this, "nat", new EipConfig()
409
- .tags(Map.of(
410
- "Name", Token.asString(Fn.lookupNested(defaultTags.getValue(), List.of("project"))) + "-nat-eip"))
411
- .vpc(true)
412
- );
413
- }
414
- }"
415
- `;
416
-
417
- exports[`tfExpressions property access in maps works snapshot python 1`] = `
418
- "from constructs import Construct
419
- from cdktn import VariableType, TerraformVariable, Fn, Token, TerraformStack
420
- #
421
- # Provider bindings are generated by running \`cdktn get\`.
422
- # See https://cdktn.io/docs/concepts/providers#import-providers for more details.
423
- #
424
- from imports.aws.eip import Eip
425
- class MyConvertedCode(TerraformStack):
426
- def __init__(self, scope, name):
427
- super().__init__(scope, name)
428
- # Terraform Variables are not always the best fit for getting inputs in the context of Terraform CDK.
429
- # You can read more about this at https://cdktn.io/docs/concepts/variables-and-outputs#input-variables
430
- default_tags = TerraformVariable(self, "default_tags",
431
- default=[{
432
- "project": "Learning Live with AWS & HashiCorp"
433
- }
434
- ],
435
- description="Map of default tags to apply to resources",
436
- type=VariableType.map(VariableType.STRING)
437
- )
438
- Eip(self, "nat",
439
- tags={
440
- "Name":
441
- Token.as_string(Fn.lookup_nested(default_tags.value, ["project"])) + "-nat-eip"
442
- },
443
- vpc=True
444
- )"
445
- `;
446
-
447
- exports[`tfExpressions property access in maps works snapshot typescript 1`] = `
448
- "import { Construct } from "constructs";
449
- import {
450
- VariableType,
451
- TerraformVariable,
452
- Fn,
453
- Token,
454
- TerraformStack,
455
- } from "cdktn";
456
- /*
457
- * Provider bindings are generated by running \`cdktn get\`.
458
- * See https://cdktn.io/docs/concepts/providers#import-providers for more details.
459
- */
460
- import { Eip } from "./.gen/providers/aws/eip";
461
- class MyConvertedCode extends TerraformStack {
462
- constructor(scope: Construct, name: string) {
463
- super(scope, name);
464
- /*Terraform Variables are not always the best fit for getting inputs in the context of Terraform CDK.
465
- You can read more about this at https://cdktn.io/docs/concepts/variables-and-outputs#input-variables*/
466
- const defaultTags = new TerraformVariable(this, "default_tags", {
467
- default: [
468
- {
469
- project: "Learning Live with AWS & HashiCorp",
470
- },
471
- ],
472
- description: "Map of default tags to apply to resources",
473
- type: VariableType.map(VariableType.STRING),
474
- });
475
- new Eip(this, "nat", {
476
- tags: {
477
- Name:
478
- Token.asString(Fn.lookupNested(defaultTags.value, ["project"])) +
479
- "-nat-eip",
480
- },
481
- vpc: true,
482
- });
483
- }
484
- }
485
- "
486
- `;
487
-
488
- exports[`tfExpressions property access through square brackets snapshot typescript 1`] = `
489
- "import { Construct } from "constructs";
490
- import {
491
- VariableType,
492
- TerraformVariable,
493
- Fn,
494
- Token,
495
- TerraformStack,
496
- } from "cdktn";
497
- /*
498
- * Provider bindings are generated by running \`cdktn get\`.
499
- * See https://cdktn.io/docs/concepts/providers#import-providers for more details.
500
- */
501
- import { AwsProvider } from "./.gen/providers/aws/provider";
502
- import { S3Bucket } from "./.gen/providers/aws/s3-bucket";
503
- class MyConvertedCode extends TerraformStack {
504
- constructor(scope: Construct, name: string) {
505
- super(scope, name);
506
- /*Terraform Variables are not always the best fit for getting inputs in the context of Terraform CDK.
507
- You can read more about this at https://cdktn.io/docs/concepts/variables-and-outputs#input-variables*/
508
- new AwsProvider(this, "aws", {
509
- region: "us-east-1",
510
- });
511
- const settings = new TerraformVariable(this, "settings", {
512
- type: VariableType.map(VariableType.STRING),
513
- });
514
- new S3Bucket(this, "examplebucket", {
515
- acl: "private",
516
- bucket: Token.asString(
517
- Fn.lookupNested(settings.value, ['"bucket_name"'])
518
- ),
519
- });
520
- }
521
- }
522
- "
523
- `;
524
-
525
- exports[`tfExpressions strings containing single outer quotes are supported snapshot typescript 1`] = `
526
- "import { Construct } from "constructs";
527
- import { TerraformOutput, TerraformStack } from "cdktn";
528
- class MyConvertedCode extends TerraformStack {
529
- constructor(scope: Construct, name: string) {
530
- super(scope, name);
531
- new TerraformOutput(this, "hash", {
532
- value: "'static'",
533
- });
534
- }
535
- }
536
- "
537
- `;