Skip to content

Commit 68207f7

Browse files
committed
update tests with new ids
1 parent 49bc444 commit 68207f7

13 files changed

+266587
-201
lines changed

packages/cdktf-cli/test/get/__snapshots__/provider.test.js.snap

+262,326
Large diffs are not rendered by default.

packages/cdktf-cli/test/get/generator/__snapshots__/complex-computed-types.test.js.snap

+88-133
Original file line numberDiff line numberDiff line change
@@ -1,123 +1,49 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

33
exports[`generate an acm certifacte resource with complex computed types 1`] = `
4-
"// generated from terraform resource schema
5-
6-
/*
7-
{
8-
\\"version\\": 0,
9-
\\"block\\": {
10-
\\"attributes\\": {
11-
\\"arn\\": {
12-
\\"type\\": \\"string\\",
13-
\\"computed\\": true
14-
},
15-
\\"certificate_authority_arn\\": {
16-
\\"type\\": \\"string\\",
17-
\\"optional\\": true
18-
},
19-
\\"certificate_body\\": {
20-
\\"type\\": \\"string\\",
21-
\\"optional\\": true
22-
},
23-
\\"certificate_chain\\": {
24-
\\"type\\": \\"string\\",
25-
\\"optional\\": true
26-
},
27-
\\"domain_name\\": {
28-
\\"type\\": \\"string\\",
29-
\\"optional\\": true,
30-
\\"computed\\": true
31-
},
32-
\\"domain_validation_options\\": {
33-
\\"type\\": [
34-
\\"list\\",
35-
[
36-
\\"object\\",
37-
{
38-
\\"domain_name\\": \\"string\\",
39-
\\"resource_record_name\\": \\"string\\",
40-
\\"resource_record_type\\": \\"string\\",
41-
\\"resource_record_value\\": \\"string\\"
42-
}
43-
]
44-
],
45-
\\"computed\\": true
46-
},
47-
\\"id\\": {
48-
\\"type\\": \\"string\\",
49-
\\"optional\\": true,
50-
\\"computed\\": true
51-
},
52-
\\"private_key\\": {
53-
\\"type\\": \\"string\\",
54-
\\"optional\\": true,
55-
\\"sensitive\\": true
56-
},
57-
\\"subject_alternative_names\\": {
58-
\\"type\\": [
59-
\\"list\\",
60-
\\"string\\"
61-
],
62-
\\"optional\\": true,
63-
\\"computed\\": true
64-
},
65-
\\"tags\\": {
66-
\\"type\\": [
67-
\\"map\\",
68-
\\"string\\"
69-
],
70-
\\"optional\\": true
71-
},
72-
\\"validation_emails\\": {
73-
\\"type\\": [
74-
\\"list\\",
75-
\\"string\\"
76-
],
77-
\\"computed\\": true
78-
},
79-
\\"validation_method\\": {
80-
\\"type\\": \\"string\\",
81-
\\"optional\\": true,
82-
\\"computed\\": true
83-
}
84-
},
85-
\\"block_types\\": {
86-
\\"options\\": {
87-
\\"nesting_mode\\": \\"list\\",
88-
\\"block\\": {
89-
\\"attributes\\": {
90-
\\"certificate_transparency_logging_preference\\": {
91-
\\"type\\": \\"string\\",
92-
\\"optional\\": true
93-
}
94-
}
95-
},
96-
\\"max_items\\": 1
97-
}
98-
}
99-
}
100-
}
101-
*/
4+
"// https://www.terraform.io/docs/providers/aws/r/acm_certificate.html
5+
// generated from terraform resource schema
6+
1027
import { Construct } from 'constructs';
1038
import { TerraformResource } from 'cdktf';
9+
import { TerraformMetaArguments } from 'cdktf';
10+
import { ComplexComputedList } from \\"cdktf\\";
10411
10512
// Configuration
10613
107-
export interface AcmCertificateConfig {
14+
export interface AcmCertificateConfig extends TerraformMetaArguments {
10815
readonly certificateAuthorityArn?: string;
10916
readonly certificateBody?: string;
11017
readonly certificateChain?: string;
18+
readonly domainName?: string;
11119
readonly privateKey?: string;
20+
readonly subjectAlternativeNames?: string[];
11221
readonly tags?: { [key: string]: string };
22+
readonly validationMethod?: string;
11323
/** options block */
11424
readonly options?: AcmCertificateOptions[];
11525
}
116-
export interface AcmCertificateDomainValidationOptions {
117-
readonly domainName?: string;
118-
readonly resourceRecordName?: string;
119-
readonly resourceRecordType?: string;
120-
readonly resourceRecordValue?: string;
26+
export class AcmCertificateDomainValidationOptions extends ComplexComputedList {
27+
28+
// domain_name - computed: true, optional: false, required: true
29+
public get domainName() {
30+
return this.getStringAttribute('domain_name');
31+
}
32+
33+
// resource_record_name - computed: true, optional: false, required: true
34+
public get resourceRecordName() {
35+
return this.getStringAttribute('resource_record_name');
36+
}
37+
38+
// resource_record_type - computed: true, optional: false, required: true
39+
public get resourceRecordType() {
40+
return this.getStringAttribute('resource_record_type');
41+
}
42+
43+
// resource_record_value - computed: true, optional: false, required: true
44+
public get resourceRecordValue() {
45+
return this.getStringAttribute('resource_record_value');
46+
}
12147
}
12248
export interface AcmCertificateOptions {
12349
readonly certificateTransparencyLoggingPreference?: string;
@@ -133,82 +59,104 @@ export class AcmCertificate extends TerraformResource {
13359
13460
public constructor(scope: Construct, id: string, config: AcmCertificateConfig = {}) {
13561
super(scope, id, {
136-
type: 'aws_acm_certificate',
62+
terraformResourceType: 'aws_acm_certificate',
63+
terraformGeneratorMetadata: {
64+
providerName: 'aws'
65+
},
66+
provider: config.provider,
67+
dependsOn: config.dependsOn,
68+
count: config.count,
69+
lifecycle: config.lifecycle
13770
});
13871
this._certificateAuthorityArn = config.certificateAuthorityArn;
13972
this._certificateBody = config.certificateBody;
14073
this._certificateChain = config.certificateChain;
74+
this._domainName = config.domainName;
14175
this._privateKey = config.privateKey;
76+
this._subjectAlternativeNames = config.subjectAlternativeNames;
14277
this._tags = config.tags;
78+
this._validationMethod = config.validationMethod;
14379
this._options = config.options;
14480
}
14581
14682
// ==========
14783
// ATTRIBUTES
14884
// ==========
14985
150-
// arn
86+
// arn - computed: true, optional: false, required: true
15187
public get arn() {
15288
return this.getStringAttribute('arn');
15389
}
15490
155-
// certificate_authority_arn
91+
// certificate_authority_arn - computed: false, optional: true, required: false
15692
private _certificateAuthorityArn?: string;
15793
public get certificateAuthorityArn() {
158-
return this._certificateAuthorityArn ?? this.getStringAttribute('certificate_authority_arn');
94+
return this._certificateAuthorityArn;
15995
}
160-
public set certificateAuthorityArn(value: string) {
96+
public set certificateAuthorityArn(value: string | undefined) {
16197
this._certificateAuthorityArn = value;
16298
}
16399
164-
// certificate_body
100+
// certificate_body - computed: false, optional: true, required: false
165101
private _certificateBody?: string;
166102
public get certificateBody() {
167-
return this._certificateBody ?? this.getStringAttribute('certificate_body');
103+
return this._certificateBody;
168104
}
169-
public set certificateBody(value: string) {
105+
public set certificateBody(value: string | undefined) {
170106
this._certificateBody = value;
171107
}
172108
173-
// certificate_chain
109+
// certificate_chain - computed: false, optional: true, required: false
174110
private _certificateChain?: string;
175111
public get certificateChain() {
176-
return this._certificateChain ?? this.getStringAttribute('certificate_chain');
112+
return this._certificateChain;
177113
}
178-
public set certificateChain(value: string) {
114+
public set certificateChain(value: string | undefined) {
179115
this._certificateChain = value;
180116
}
181117
182-
// domain_name
118+
// domain_name - computed: true, optional: true, required: false
119+
private _domainName?: string;
183120
public get domainName() {
184-
return this.getStringAttribute('domain_name');
121+
return this._domainName ?? this.getStringAttribute('domain_name');
122+
}
123+
public set domainName(value: string | undefined) {
124+
this._domainName = value;
185125
}
186126
187-
// domain_validation_options
188-
public get domainValidationOptions() {
189-
throw new Error('computed attribute \\"$acm_certificate.domain_validation_options\\" has unsupported type \\"AcmCertificateDomainValidationOptions[]\\"');
127+
// domain_validation_options - computed: true, optional: false, required: true
128+
public domainValidationOptions(index: string) {
129+
return new AcmCertificateDomainValidationOptions(this, 'domain_validation_options', index);
190130
}
191131
192-
// id
132+
// id - computed: true, optional: true, required: false
133+
private _id?: string;
193134
public get id() {
194-
return this.getStringAttribute('id');
135+
return this._id ?? this.getStringAttribute('id');
136+
}
137+
public set id(value: string | undefined) {
138+
this._id = value;
195139
}
196140
197-
// private_key
141+
// private_key - computed: false, optional: true, required: false
198142
private _privateKey?: string;
199143
public get privateKey() {
200-
return this._privateKey ?? this.getStringAttribute('private_key');
144+
return this._privateKey;
201145
}
202-
public set privateKey(value: string) {
146+
public set privateKey(value: string | undefined) {
203147
this._privateKey = value;
204148
}
205149
206-
// subject_alternative_names
150+
// subject_alternative_names - computed: true, optional: true, required: false
151+
private _subjectAlternativeNames?: string[];
207152
public get subjectAlternativeNames() {
208-
return this.getListAttribute('subject_alternative_names');
153+
return this._subjectAlternativeNames ?? this.getListAttribute('subject_alternative_names');
154+
}
155+
public set subjectAlternativeNames(value: string[] | undefined) {
156+
this._subjectAlternativeNames = value;
209157
}
210158
211-
// tags
159+
// tags - computed: false, optional: true, required: false
212160
private _tags?: { [key: string]: string };
213161
public get tags() {
214162
return this._tags;
@@ -217,17 +165,21 @@ export class AcmCertificate extends TerraformResource {
217165
this._tags = value;
218166
}
219167
220-
// validation_emails
168+
// validation_emails - computed: true, optional: false, required: true
221169
public get validationEmails() {
222170
return this.getListAttribute('validation_emails');
223171
}
224172
225-
// validation_method
173+
// validation_method - computed: true, optional: true, required: false
174+
private _validationMethod?: string;
226175
public get validationMethod() {
227-
return this.getStringAttribute('validation_method');
176+
return this._validationMethod ?? this.getStringAttribute('validation_method');
177+
}
178+
public set validationMethod(value: string | undefined) {
179+
this._validationMethod = value;
228180
}
229181
230-
// options
182+
// options - computed: false, optional: true, required: false
231183
private _options?: AcmCertificateOptions[];
232184
public get options() {
233185
return this._options;
@@ -240,13 +192,16 @@ export class AcmCertificate extends TerraformResource {
240192
// SYNTHESIS
241193
// =========
242194
243-
protected synthesizeAttributes() {
195+
protected synthesizeAttributes(): { [name: string]: any } {
244196
return {
245197
certificate_authority_arn: this._certificateAuthorityArn,
246198
certificate_body: this._certificateBody,
247199
certificate_chain: this._certificateChain,
200+
domain_name: this._domainName,
248201
private_key: this._privateKey,
202+
subject_alternative_names: this._subjectAlternativeNames,
249203
tags: this._tags,
204+
validation_method: this._validationMethod,
250205
options: this._options,
251206
};
252207
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`broken attribute description comments 1`] = `
4+
"// https://www.terraform.io/docs/providers/google/r/description_escaping.html
5+
// generated from terraform resource schema
6+
7+
import { Construct } from 'constructs';
8+
import { TerraformResource } from 'cdktf';
9+
import { TerraformMetaArguments } from 'cdktf';
10+
11+
// Configuration
12+
13+
export interface DescriptionEscapingConfig extends TerraformMetaArguments {
14+
/** The resource name of the Cloud KMS CryptoKey to be used to protect access
15+
to messages published on this topic. Your project's PubSub service account
16+
('service-{{PROJECT_NUMBER}}@gcp-sa-pubsub.iam.gserviceaccount.com') must have
17+
'roles/cloudkms.cryptoKeyEncrypterDecrypter' to use this feature.
18+
The expected format is 'projects/*\\\\/locations/*\\\\/keyRings/*\\\\/cryptoKeys/*' */
19+
readonly brokenComments: boolean;
20+
}
21+
22+
// Resource
23+
24+
export class DescriptionEscaping extends TerraformResource {
25+
26+
// ===========
27+
// INITIALIZER
28+
// ===========
29+
30+
public constructor(scope: Construct, id: string, config: DescriptionEscapingConfig) {
31+
super(scope, id, {
32+
terraformResourceType: 'description_escaping',
33+
terraformGeneratorMetadata: {
34+
providerName: 'google'
35+
},
36+
provider: config.provider,
37+
dependsOn: config.dependsOn,
38+
count: config.count,
39+
lifecycle: config.lifecycle
40+
});
41+
this._brokenComments = config.brokenComments;
42+
}
43+
44+
// ==========
45+
// ATTRIBUTES
46+
// ==========
47+
48+
// broken_comments - computed: false, optional: false, required: true
49+
private _brokenComments: boolean;
50+
public get brokenComments() {
51+
return this._brokenComments;
52+
}
53+
public set brokenComments(value: boolean) {
54+
this._brokenComments = value;
55+
}
56+
57+
// =========
58+
// SYNTHESIS
59+
// =========
60+
61+
protected synthesizeAttributes(): { [name: string]: any } {
62+
return {
63+
broken_comments: this._brokenComments,
64+
};
65+
}
66+
}
67+
"
68+
`;

0 commit comments

Comments
 (0)