@cdktn/provider-generator 0.24.0-pre.88 → 0.24.0-pre.89
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/build/__tests__/edge-provider-schema/builder.d.ts +9 -3
- package/build/__tests__/edge-provider-schema/builder.js +6 -3
- package/build/__tests__/edge-provider-schema/index.js +119 -1
- package/build/__tests__/provider.test.js +4 -1
- package/build/get/__tests__/generator/ephemeral-resources.test.d.ts +2 -0
- package/build/get/__tests__/generator/ephemeral-resources.test.js +49 -0
- package/build/get/__tests__/generator/provider-functions.test.d.ts +2 -0
- package/build/get/__tests__/generator/provider-functions.test.js +176 -0
- package/build/get/__tests__/generator/provider.test.js +9 -1
- package/build/get/__tests__/generator/write-only.test.d.ts +2 -0
- package/build/get/__tests__/generator/write-only.test.js +65 -0
- package/build/get/__tests__/target-versions.test.d.ts +2 -0
- package/build/get/__tests__/target-versions.test.js +171 -0
- package/build/get/constructs-maker.d.ts +8 -1
- package/build/get/constructs-maker.js +13 -4
- package/build/get/generator/emitter/attributes-emitter.d.ts +12 -2
- package/build/get/generator/emitter/attributes-emitter.js +47 -5
- package/build/get/generator/emitter/index.d.ts +1 -0
- package/build/get/generator/emitter/index.js +2 -1
- package/build/get/generator/emitter/provider-functions-emitter.d.ts +11 -0
- package/build/get/generator/emitter/provider-functions-emitter.js +94 -0
- package/build/get/generator/emitter/resource-emitter.d.ts +5 -1
- package/build/get/generator/emitter/resource-emitter.js +83 -7
- package/build/get/generator/models/attribute-model.d.ts +2 -0
- package/build/get/generator/models/attribute-model.js +2 -1
- package/build/get/generator/models/index.d.ts +1 -0
- package/build/get/generator/models/index.js +2 -1
- package/build/get/generator/models/provider-function-model.d.ts +102 -0
- package/build/get/generator/models/provider-function-model.js +667 -0
- package/build/get/generator/models/resource-model.d.ts +3 -0
- package/build/get/generator/models/resource-model.js +13 -4
- package/build/get/generator/models/struct.d.ts +2 -0
- package/build/get/generator/models/struct.js +6 -2
- package/build/get/generator/provider-generator.d.ts +2 -0
- package/build/get/generator/provider-generator.js +31 -3
- package/build/get/generator/resource-parser.js +3 -1
- package/package.json +4 -4
- package/src/__tests__/__snapshots__/edge-provider-schema.test.ts.snap +4 -0
- package/src/__tests__/edge-provider-schema/builder.ts +17 -1
- package/src/__tests__/edge-provider-schema/index.ts +124 -1
- package/src/__tests__/provider.test.ts +3 -0
- package/src/get/__tests__/generator/__snapshots__/ephemeral-resources.test.ts.snap +524 -0
- package/src/get/__tests__/generator/__snapshots__/provider-functions.test.ts.snap +444 -0
- package/src/get/__tests__/generator/__snapshots__/write-only.test.ts.snap +262 -0
- package/src/get/__tests__/generator/ephemeral-resources.test.ts +46 -0
- package/src/get/__tests__/generator/fixtures/ephemeral-resources.test.fixture.json +160 -0
- package/src/get/__tests__/generator/fixtures/provider-functions-collision.test.fixture.json +31 -0
- package/src/get/__tests__/generator/fixtures/provider-functions-synthetic.test.fixture.json +192 -0
- package/src/get/__tests__/generator/fixtures/provider-functions.test.fixture.json +170 -0
- package/src/get/__tests__/generator/fixtures/write-only.test.fixture.json +58 -0
- package/src/get/__tests__/generator/provider-functions.test.ts +262 -0
- package/src/get/__tests__/generator/provider.test.ts +8 -0
- package/src/get/__tests__/generator/write-only.test.ts +71 -0
- package/src/get/__tests__/target-versions.test.ts +206 -0
- package/src/get/constructs-maker.ts +43 -3
- package/src/get/generator/emitter/attributes-emitter.ts +61 -6
- package/src/get/generator/emitter/index.ts +1 -0
- package/src/get/generator/emitter/provider-functions-emitter.ts +117 -0
- package/src/get/generator/emitter/resource-emitter.ts +110 -6
- package/src/get/generator/models/attribute-model.ts +3 -0
- package/src/get/generator/models/index.ts +1 -0
- package/src/get/generator/models/provider-function-model.ts +872 -0
- package/src/get/generator/models/resource-model.ts +25 -3
- package/src/get/generator/models/struct.ts +9 -1
- package/src/get/generator/provider-generator.ts +70 -4
- package/src/get/generator/resource-parser.ts +2 -0
|
@@ -0,0 +1,524 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
|
|
2
|
+
|
|
3
|
+
exports[`generate an ephemeral random_password resource alongside a regular random_uuid resource: ephemeral-random-password 1`] = `
|
|
4
|
+
"// https://registry.terraform.io/providers/hashicorp/random/latest/docs/ephemeral-resources/password
|
|
5
|
+
// generated from terraform resource schema
|
|
6
|
+
|
|
7
|
+
import { Construct } from 'constructs';
|
|
8
|
+
import * as cdktn from 'cdktn';
|
|
9
|
+
|
|
10
|
+
// Configuration
|
|
11
|
+
|
|
12
|
+
export interface EphemeralRandomPasswordConfig extends cdktn.TerraformEphemeralMetaArguments {
|
|
13
|
+
/**
|
|
14
|
+
* The length of the string desired. The minimum value for length is 1 and, length must also be >= (\`min_upper\` + \`min_lower\` + \`min_numeric\` + \`min_special\`).
|
|
15
|
+
*
|
|
16
|
+
* Docs at Terraform Registry: {@link https://registry.terraform.io/providers/hashicorp/random/latest/docs/ephemeral-resources/password#length EphemeralRandomPassword#length}
|
|
17
|
+
*/
|
|
18
|
+
readonly length: number;
|
|
19
|
+
/**
|
|
20
|
+
* Include lowercase alphabet characters in the result. Default value is \`true\`.
|
|
21
|
+
*
|
|
22
|
+
* Docs at Terraform Registry: {@link https://registry.terraform.io/providers/hashicorp/random/latest/docs/ephemeral-resources/password#lower EphemeralRandomPassword#lower}
|
|
23
|
+
*/
|
|
24
|
+
readonly lower?: boolean | cdktn.IResolvable;
|
|
25
|
+
/**
|
|
26
|
+
* Minimum number of lowercase alphabet characters in the result. Default value is \`0\`.
|
|
27
|
+
*
|
|
28
|
+
* Docs at Terraform Registry: {@link https://registry.terraform.io/providers/hashicorp/random/latest/docs/ephemeral-resources/password#min_lower EphemeralRandomPassword#min_lower}
|
|
29
|
+
*/
|
|
30
|
+
readonly minLower?: number;
|
|
31
|
+
/**
|
|
32
|
+
* Minimum number of numeric characters in the result. Default value is \`0\`.
|
|
33
|
+
*
|
|
34
|
+
* Docs at Terraform Registry: {@link https://registry.terraform.io/providers/hashicorp/random/latest/docs/ephemeral-resources/password#min_numeric EphemeralRandomPassword#min_numeric}
|
|
35
|
+
*/
|
|
36
|
+
readonly minNumeric?: number;
|
|
37
|
+
/**
|
|
38
|
+
* Minimum number of special characters in the result. Default value is \`0\`.
|
|
39
|
+
*
|
|
40
|
+
* Docs at Terraform Registry: {@link https://registry.terraform.io/providers/hashicorp/random/latest/docs/ephemeral-resources/password#min_special EphemeralRandomPassword#min_special}
|
|
41
|
+
*/
|
|
42
|
+
readonly minSpecial?: number;
|
|
43
|
+
/**
|
|
44
|
+
* Minimum number of uppercase alphabet characters in the result. Default value is \`0\`.
|
|
45
|
+
*
|
|
46
|
+
* Docs at Terraform Registry: {@link https://registry.terraform.io/providers/hashicorp/random/latest/docs/ephemeral-resources/password#min_upper EphemeralRandomPassword#min_upper}
|
|
47
|
+
*/
|
|
48
|
+
readonly minUpper?: number;
|
|
49
|
+
/**
|
|
50
|
+
* Include numeric characters in the result. Default value is \`true\`. If \`numeric\`, \`upper\`, \`lower\`, and \`special\` are all configured, at least one of them must be set to \`true\`.
|
|
51
|
+
*
|
|
52
|
+
* Docs at Terraform Registry: {@link https://registry.terraform.io/providers/hashicorp/random/latest/docs/ephemeral-resources/password#numeric EphemeralRandomPassword#numeric}
|
|
53
|
+
*/
|
|
54
|
+
readonly numeric?: boolean | cdktn.IResolvable;
|
|
55
|
+
/**
|
|
56
|
+
* Supply your own list of special characters to use for string generation. This overrides the default character list in the special argument. The \`special\` argument must still be set to true for any overwritten characters to be used in generation.
|
|
57
|
+
*
|
|
58
|
+
* Docs at Terraform Registry: {@link https://registry.terraform.io/providers/hashicorp/random/latest/docs/ephemeral-resources/password#override_special EphemeralRandomPassword#override_special}
|
|
59
|
+
*/
|
|
60
|
+
readonly overrideSpecial?: string;
|
|
61
|
+
/**
|
|
62
|
+
* Include special characters in the result. These are \`!@#$%&*()-_=+[]{}<>:?\`. Default value is \`true\`.
|
|
63
|
+
*
|
|
64
|
+
* Docs at Terraform Registry: {@link https://registry.terraform.io/providers/hashicorp/random/latest/docs/ephemeral-resources/password#special EphemeralRandomPassword#special}
|
|
65
|
+
*/
|
|
66
|
+
readonly special?: boolean | cdktn.IResolvable;
|
|
67
|
+
/**
|
|
68
|
+
* Include uppercase alphabet characters in the result. Default value is \`true\`.
|
|
69
|
+
*
|
|
70
|
+
* Docs at Terraform Registry: {@link https://registry.terraform.io/providers/hashicorp/random/latest/docs/ephemeral-resources/password#upper EphemeralRandomPassword#upper}
|
|
71
|
+
*/
|
|
72
|
+
readonly upper?: boolean | cdktn.IResolvable;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Represents a {@link https://registry.terraform.io/providers/hashicorp/random/latest/docs/ephemeral-resources/password random_password}
|
|
77
|
+
*/
|
|
78
|
+
export class EphemeralRandomPassword extends cdktn.TerraformEphemeralResource {
|
|
79
|
+
|
|
80
|
+
// =================
|
|
81
|
+
// STATIC PROPERTIES
|
|
82
|
+
// =================
|
|
83
|
+
public static readonly tfResourceType = "random_password";
|
|
84
|
+
|
|
85
|
+
// ===========
|
|
86
|
+
// INITIALIZER
|
|
87
|
+
// ===========
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Create a new {@link https://registry.terraform.io/providers/hashicorp/random/latest/docs/ephemeral-resources/password random_password} Ephemeral Resource
|
|
91
|
+
*
|
|
92
|
+
* @param scope The scope in which to define this construct
|
|
93
|
+
* @param id The scoped construct ID. Must be unique amongst siblings in the same scope
|
|
94
|
+
* @param options EphemeralRandomPasswordConfig
|
|
95
|
+
*/
|
|
96
|
+
public constructor(scope: Construct, id: string, config: EphemeralRandomPasswordConfig) {
|
|
97
|
+
super(scope, id, {
|
|
98
|
+
terraformResourceType: 'random_password',
|
|
99
|
+
terraformGeneratorMetadata: {
|
|
100
|
+
providerName: 'random'
|
|
101
|
+
},
|
|
102
|
+
provider: config.provider,
|
|
103
|
+
dependsOn: config.dependsOn,
|
|
104
|
+
count: config.count,
|
|
105
|
+
lifecycle: config.lifecycle,
|
|
106
|
+
forEach: config.forEach
|
|
107
|
+
});
|
|
108
|
+
this._length = config.length;
|
|
109
|
+
this._lower = config.lower;
|
|
110
|
+
this._minLower = config.minLower;
|
|
111
|
+
this._minNumeric = config.minNumeric;
|
|
112
|
+
this._minSpecial = config.minSpecial;
|
|
113
|
+
this._minUpper = config.minUpper;
|
|
114
|
+
this._numeric = config.numeric;
|
|
115
|
+
this._overrideSpecial = config.overrideSpecial;
|
|
116
|
+
this._special = config.special;
|
|
117
|
+
this._upper = config.upper;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// ==========
|
|
121
|
+
// ATTRIBUTES
|
|
122
|
+
// ==========
|
|
123
|
+
|
|
124
|
+
// bcrypt_hash - computed: true, optional: false, required: false
|
|
125
|
+
public get bcryptHash() {
|
|
126
|
+
return this.getStringAttribute('bcrypt_hash');
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// length - computed: false, optional: false, required: true
|
|
130
|
+
private _length?: number;
|
|
131
|
+
public get length() {
|
|
132
|
+
return this.getNumberAttribute('length');
|
|
133
|
+
}
|
|
134
|
+
public set length(value: number) {
|
|
135
|
+
this._length = value;
|
|
136
|
+
}
|
|
137
|
+
// Temporarily expose input value. Use with caution.
|
|
138
|
+
public get lengthInput() {
|
|
139
|
+
return this._length;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// lower - computed: true, optional: true, required: false
|
|
143
|
+
private _lower?: boolean | cdktn.IResolvable;
|
|
144
|
+
public get lower() {
|
|
145
|
+
return this.getBooleanAttribute('lower');
|
|
146
|
+
}
|
|
147
|
+
public set lower(value: boolean | cdktn.IResolvable) {
|
|
148
|
+
this._lower = value;
|
|
149
|
+
}
|
|
150
|
+
public resetLower() {
|
|
151
|
+
this._lower = undefined;
|
|
152
|
+
}
|
|
153
|
+
// Temporarily expose input value. Use with caution.
|
|
154
|
+
public get lowerInput() {
|
|
155
|
+
return this._lower;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// min_lower - computed: true, optional: true, required: false
|
|
159
|
+
private _minLower?: number;
|
|
160
|
+
public get minLower() {
|
|
161
|
+
return this.getNumberAttribute('min_lower');
|
|
162
|
+
}
|
|
163
|
+
public set minLower(value: number) {
|
|
164
|
+
this._minLower = value;
|
|
165
|
+
}
|
|
166
|
+
public resetMinLower() {
|
|
167
|
+
this._minLower = undefined;
|
|
168
|
+
}
|
|
169
|
+
// Temporarily expose input value. Use with caution.
|
|
170
|
+
public get minLowerInput() {
|
|
171
|
+
return this._minLower;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// min_numeric - computed: true, optional: true, required: false
|
|
175
|
+
private _minNumeric?: number;
|
|
176
|
+
public get minNumeric() {
|
|
177
|
+
return this.getNumberAttribute('min_numeric');
|
|
178
|
+
}
|
|
179
|
+
public set minNumeric(value: number) {
|
|
180
|
+
this._minNumeric = value;
|
|
181
|
+
}
|
|
182
|
+
public resetMinNumeric() {
|
|
183
|
+
this._minNumeric = undefined;
|
|
184
|
+
}
|
|
185
|
+
// Temporarily expose input value. Use with caution.
|
|
186
|
+
public get minNumericInput() {
|
|
187
|
+
return this._minNumeric;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// min_special - computed: true, optional: true, required: false
|
|
191
|
+
private _minSpecial?: number;
|
|
192
|
+
public get minSpecial() {
|
|
193
|
+
return this.getNumberAttribute('min_special');
|
|
194
|
+
}
|
|
195
|
+
public set minSpecial(value: number) {
|
|
196
|
+
this._minSpecial = value;
|
|
197
|
+
}
|
|
198
|
+
public resetMinSpecial() {
|
|
199
|
+
this._minSpecial = undefined;
|
|
200
|
+
}
|
|
201
|
+
// Temporarily expose input value. Use with caution.
|
|
202
|
+
public get minSpecialInput() {
|
|
203
|
+
return this._minSpecial;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
// min_upper - computed: true, optional: true, required: false
|
|
207
|
+
private _minUpper?: number;
|
|
208
|
+
public get minUpper() {
|
|
209
|
+
return this.getNumberAttribute('min_upper');
|
|
210
|
+
}
|
|
211
|
+
public set minUpper(value: number) {
|
|
212
|
+
this._minUpper = value;
|
|
213
|
+
}
|
|
214
|
+
public resetMinUpper() {
|
|
215
|
+
this._minUpper = undefined;
|
|
216
|
+
}
|
|
217
|
+
// Temporarily expose input value. Use with caution.
|
|
218
|
+
public get minUpperInput() {
|
|
219
|
+
return this._minUpper;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
// numeric - computed: true, optional: true, required: false
|
|
223
|
+
private _numeric?: boolean | cdktn.IResolvable;
|
|
224
|
+
public get numeric() {
|
|
225
|
+
return this.getBooleanAttribute('numeric');
|
|
226
|
+
}
|
|
227
|
+
public set numeric(value: boolean | cdktn.IResolvable) {
|
|
228
|
+
this._numeric = value;
|
|
229
|
+
}
|
|
230
|
+
public resetNumeric() {
|
|
231
|
+
this._numeric = undefined;
|
|
232
|
+
}
|
|
233
|
+
// Temporarily expose input value. Use with caution.
|
|
234
|
+
public get numericInput() {
|
|
235
|
+
return this._numeric;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
// override_special - computed: false, optional: true, required: false
|
|
239
|
+
private _overrideSpecial?: string;
|
|
240
|
+
public get overrideSpecial() {
|
|
241
|
+
return this.getStringAttribute('override_special');
|
|
242
|
+
}
|
|
243
|
+
public set overrideSpecial(value: string) {
|
|
244
|
+
this._overrideSpecial = value;
|
|
245
|
+
}
|
|
246
|
+
public resetOverrideSpecial() {
|
|
247
|
+
this._overrideSpecial = undefined;
|
|
248
|
+
}
|
|
249
|
+
// Temporarily expose input value. Use with caution.
|
|
250
|
+
public get overrideSpecialInput() {
|
|
251
|
+
return this._overrideSpecial;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
// result - computed: true, optional: false, required: false
|
|
255
|
+
public get result() {
|
|
256
|
+
return this.getStringAttribute('result');
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
// special - computed: true, optional: true, required: false
|
|
260
|
+
private _special?: boolean | cdktn.IResolvable;
|
|
261
|
+
public get special() {
|
|
262
|
+
return this.getBooleanAttribute('special');
|
|
263
|
+
}
|
|
264
|
+
public set special(value: boolean | cdktn.IResolvable) {
|
|
265
|
+
this._special = value;
|
|
266
|
+
}
|
|
267
|
+
public resetSpecial() {
|
|
268
|
+
this._special = undefined;
|
|
269
|
+
}
|
|
270
|
+
// Temporarily expose input value. Use with caution.
|
|
271
|
+
public get specialInput() {
|
|
272
|
+
return this._special;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
// upper - computed: true, optional: true, required: false
|
|
276
|
+
private _upper?: boolean | cdktn.IResolvable;
|
|
277
|
+
public get upper() {
|
|
278
|
+
return this.getBooleanAttribute('upper');
|
|
279
|
+
}
|
|
280
|
+
public set upper(value: boolean | cdktn.IResolvable) {
|
|
281
|
+
this._upper = value;
|
|
282
|
+
}
|
|
283
|
+
public resetUpper() {
|
|
284
|
+
this._upper = undefined;
|
|
285
|
+
}
|
|
286
|
+
// Temporarily expose input value. Use with caution.
|
|
287
|
+
public get upperInput() {
|
|
288
|
+
return this._upper;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
// =========
|
|
292
|
+
// SYNTHESIS
|
|
293
|
+
// =========
|
|
294
|
+
|
|
295
|
+
protected synthesizeAttributes(): { [name: string]: any } {
|
|
296
|
+
return {
|
|
297
|
+
length: cdktn.numberToTerraform(this._length),
|
|
298
|
+
lower: cdktn.booleanToTerraform(this._lower),
|
|
299
|
+
min_lower: cdktn.numberToTerraform(this._minLower),
|
|
300
|
+
min_numeric: cdktn.numberToTerraform(this._minNumeric),
|
|
301
|
+
min_special: cdktn.numberToTerraform(this._minSpecial),
|
|
302
|
+
min_upper: cdktn.numberToTerraform(this._minUpper),
|
|
303
|
+
numeric: cdktn.booleanToTerraform(this._numeric),
|
|
304
|
+
override_special: cdktn.stringToTerraform(this._overrideSpecial),
|
|
305
|
+
special: cdktn.booleanToTerraform(this._special),
|
|
306
|
+
upper: cdktn.booleanToTerraform(this._upper),
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
protected synthesizeHclAttributes(): { [name: string]: any } {
|
|
311
|
+
const attrs = {
|
|
312
|
+
length: {
|
|
313
|
+
value: cdktn.numberToHclTerraform(this._length),
|
|
314
|
+
isBlock: false,
|
|
315
|
+
type: "simple",
|
|
316
|
+
storageClassType: "number",
|
|
317
|
+
},
|
|
318
|
+
lower: {
|
|
319
|
+
value: cdktn.booleanToHclTerraform(this._lower),
|
|
320
|
+
isBlock: false,
|
|
321
|
+
type: "simple",
|
|
322
|
+
storageClassType: "boolean",
|
|
323
|
+
},
|
|
324
|
+
min_lower: {
|
|
325
|
+
value: cdktn.numberToHclTerraform(this._minLower),
|
|
326
|
+
isBlock: false,
|
|
327
|
+
type: "simple",
|
|
328
|
+
storageClassType: "number",
|
|
329
|
+
},
|
|
330
|
+
min_numeric: {
|
|
331
|
+
value: cdktn.numberToHclTerraform(this._minNumeric),
|
|
332
|
+
isBlock: false,
|
|
333
|
+
type: "simple",
|
|
334
|
+
storageClassType: "number",
|
|
335
|
+
},
|
|
336
|
+
min_special: {
|
|
337
|
+
value: cdktn.numberToHclTerraform(this._minSpecial),
|
|
338
|
+
isBlock: false,
|
|
339
|
+
type: "simple",
|
|
340
|
+
storageClassType: "number",
|
|
341
|
+
},
|
|
342
|
+
min_upper: {
|
|
343
|
+
value: cdktn.numberToHclTerraform(this._minUpper),
|
|
344
|
+
isBlock: false,
|
|
345
|
+
type: "simple",
|
|
346
|
+
storageClassType: "number",
|
|
347
|
+
},
|
|
348
|
+
numeric: {
|
|
349
|
+
value: cdktn.booleanToHclTerraform(this._numeric),
|
|
350
|
+
isBlock: false,
|
|
351
|
+
type: "simple",
|
|
352
|
+
storageClassType: "boolean",
|
|
353
|
+
},
|
|
354
|
+
override_special: {
|
|
355
|
+
value: cdktn.stringToHclTerraform(this._overrideSpecial),
|
|
356
|
+
isBlock: false,
|
|
357
|
+
type: "simple",
|
|
358
|
+
storageClassType: "string",
|
|
359
|
+
},
|
|
360
|
+
special: {
|
|
361
|
+
value: cdktn.booleanToHclTerraform(this._special),
|
|
362
|
+
isBlock: false,
|
|
363
|
+
type: "simple",
|
|
364
|
+
storageClassType: "boolean",
|
|
365
|
+
},
|
|
366
|
+
upper: {
|
|
367
|
+
value: cdktn.booleanToHclTerraform(this._upper),
|
|
368
|
+
isBlock: false,
|
|
369
|
+
type: "simple",
|
|
370
|
+
storageClassType: "boolean",
|
|
371
|
+
},
|
|
372
|
+
};
|
|
373
|
+
|
|
374
|
+
// remove undefined attributes
|
|
375
|
+
return Object.fromEntries(Object.entries(attrs).filter(([_, value]) => value !== undefined && value.value !== undefined ))
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
"
|
|
379
|
+
`;
|
|
380
|
+
|
|
381
|
+
exports[`generate an ephemeral random_password resource alongside a regular random_uuid resource: provider-index 1`] = `
|
|
382
|
+
"// generated by cdktn get
|
|
383
|
+
export * as uuid from './uuid/index';
|
|
384
|
+
export * as ephemeralRandomBytes from './ephemeral-random-bytes/index';
|
|
385
|
+
export * as ephemeralRandomPassword from './ephemeral-random-password/index';
|
|
386
|
+
|
|
387
|
+
"
|
|
388
|
+
`;
|
|
389
|
+
|
|
390
|
+
exports[`generate an ephemeral random_password resource alongside a regular random_uuid resource: provider-lazy-index 1`] = `
|
|
391
|
+
"// generated by cdktn get
|
|
392
|
+
Object.defineProperty(exports, 'uuid', { get: function () { return require('./uuid'); } });
|
|
393
|
+
Object.defineProperty(exports, 'ephemeralRandomBytes', { get: function () { return require('./ephemeral-random-bytes'); } });
|
|
394
|
+
Object.defineProperty(exports, 'ephemeralRandomPassword', { get: function () { return require('./ephemeral-random-password'); } });
|
|
395
|
+
|
|
396
|
+
"
|
|
397
|
+
`;
|
|
398
|
+
|
|
399
|
+
exports[`generate an ephemeral random_password resource alongside a regular random_uuid resource: random-uuid 1`] = `
|
|
400
|
+
"// https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/uuid
|
|
401
|
+
// generated from terraform resource schema
|
|
402
|
+
|
|
403
|
+
import { Construct } from 'constructs';
|
|
404
|
+
import * as cdktn from 'cdktn';
|
|
405
|
+
|
|
406
|
+
// Configuration
|
|
407
|
+
|
|
408
|
+
export interface UuidConfig extends cdktn.TerraformMetaArguments {
|
|
409
|
+
/**
|
|
410
|
+
* Arbitrary map of values that, when changed, will trigger recreation of resource. See [the main provider documentation](../index.html) for more information.
|
|
411
|
+
*
|
|
412
|
+
* Docs at Terraform Registry: {@link https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/uuid#keepers Uuid#keepers}
|
|
413
|
+
*/
|
|
414
|
+
readonly keepers?: { [key: string]: string };
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
/**
|
|
418
|
+
* Represents a {@link https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/uuid random_uuid}
|
|
419
|
+
*/
|
|
420
|
+
export class Uuid extends cdktn.TerraformResource {
|
|
421
|
+
|
|
422
|
+
// =================
|
|
423
|
+
// STATIC PROPERTIES
|
|
424
|
+
// =================
|
|
425
|
+
public static readonly tfResourceType = "random_uuid";
|
|
426
|
+
|
|
427
|
+
// ==============
|
|
428
|
+
// STATIC Methods
|
|
429
|
+
// ==============
|
|
430
|
+
/**
|
|
431
|
+
* Generates CDKTN code for importing a Uuid resource upon running "cdktn plan <stack-name>"
|
|
432
|
+
* @param scope The scope in which to define this construct
|
|
433
|
+
* @param importToId The construct id used in the generated config for the Uuid to import
|
|
434
|
+
* @param importFromId The id of the existing Uuid that should be imported. Refer to the {@link https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/uuid#import import section} in the documentation of this resource for the id to use
|
|
435
|
+
* @param provider? Optional instance of the provider where the Uuid to import is found
|
|
436
|
+
*/
|
|
437
|
+
public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktn.TerraformProvider) {
|
|
438
|
+
return new cdktn.ImportableResource(scope, importToId, { terraformResourceType: "random_uuid", importId: importFromId, provider });
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
// ===========
|
|
442
|
+
// INITIALIZER
|
|
443
|
+
// ===========
|
|
444
|
+
|
|
445
|
+
/**
|
|
446
|
+
* Create a new {@link https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/uuid random_uuid} Resource
|
|
447
|
+
*
|
|
448
|
+
* @param scope The scope in which to define this construct
|
|
449
|
+
* @param id The scoped construct ID. Must be unique amongst siblings in the same scope
|
|
450
|
+
* @param options UuidConfig = {}
|
|
451
|
+
*/
|
|
452
|
+
public constructor(scope: Construct, id: string, config: UuidConfig = {}) {
|
|
453
|
+
super(scope, id, {
|
|
454
|
+
terraformResourceType: 'random_uuid',
|
|
455
|
+
terraformGeneratorMetadata: {
|
|
456
|
+
providerName: 'random'
|
|
457
|
+
},
|
|
458
|
+
provider: config.provider,
|
|
459
|
+
dependsOn: config.dependsOn,
|
|
460
|
+
count: config.count,
|
|
461
|
+
lifecycle: config.lifecycle,
|
|
462
|
+
provisioners: config.provisioners,
|
|
463
|
+
connection: config.connection,
|
|
464
|
+
forEach: config.forEach
|
|
465
|
+
});
|
|
466
|
+
this._keepers = config.keepers;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
// ==========
|
|
470
|
+
// ATTRIBUTES
|
|
471
|
+
// ==========
|
|
472
|
+
|
|
473
|
+
// id - computed: true, optional: false, required: false
|
|
474
|
+
public get id() {
|
|
475
|
+
return this.getStringAttribute('id');
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
// keepers - computed: false, optional: true, required: false
|
|
479
|
+
private _keepers?: { [key: string]: string };
|
|
480
|
+
public get keepers() {
|
|
481
|
+
return this.getStringMapAttribute('keepers');
|
|
482
|
+
}
|
|
483
|
+
public set keepers(value: { [key: string]: string }) {
|
|
484
|
+
this._keepers = value;
|
|
485
|
+
}
|
|
486
|
+
public resetKeepers() {
|
|
487
|
+
this._keepers = undefined;
|
|
488
|
+
}
|
|
489
|
+
// Temporarily expose input value. Use with caution.
|
|
490
|
+
public get keepersInput() {
|
|
491
|
+
return this._keepers;
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
// result - computed: true, optional: false, required: false
|
|
495
|
+
public get result() {
|
|
496
|
+
return this.getStringAttribute('result');
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
// =========
|
|
500
|
+
// SYNTHESIS
|
|
501
|
+
// =========
|
|
502
|
+
|
|
503
|
+
protected synthesizeAttributes(): { [name: string]: any } {
|
|
504
|
+
return {
|
|
505
|
+
keepers: cdktn.hashMapper(cdktn.stringToTerraform)(this._keepers),
|
|
506
|
+
};
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
protected synthesizeHclAttributes(): { [name: string]: any } {
|
|
510
|
+
const attrs = {
|
|
511
|
+
keepers: {
|
|
512
|
+
value: cdktn.hashMapperHcl(cdktn.stringToHclTerraform)(this._keepers),
|
|
513
|
+
isBlock: false,
|
|
514
|
+
type: "map",
|
|
515
|
+
storageClassType: "stringMap",
|
|
516
|
+
},
|
|
517
|
+
};
|
|
518
|
+
|
|
519
|
+
// remove undefined attributes
|
|
520
|
+
return Object.fromEntries(Object.entries(attrs).filter(([_, value]) => value !== undefined && value.value !== undefined ))
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
"
|
|
524
|
+
`;
|