/
certifiate.go
495 lines (435 loc) · 17.7 KB
/
certifiate.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package keyvault
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
// Manages a Key Vault Certificate.
//
// ## Example Usage
// ### Generating a new certificate
//
// ```go
// package main
//
// import (
// "github.com/pulumi/pulumi-azure/sdk/v3/go/azure/core"
// "github.com/pulumi/pulumi-azure/sdk/v3/go/azure/keyvault"
// "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// current, err := core.GetClientConfig(ctx, nil, nil)
// if err != nil {
// return err
// }
// exampleResourceGroup, err := core.NewResourceGroup(ctx, "exampleResourceGroup", &core.ResourceGroupArgs{
// Location: pulumi.String("West Europe"),
// })
// if err != nil {
// return err
// }
// exampleKeyVault, err := keyvault.NewKeyVault(ctx, "exampleKeyVault", &keyvault.KeyVaultArgs{
// Location: exampleResourceGroup.Location,
// ResourceGroupName: exampleResourceGroup.Name,
// TenantId: pulumi.String(current.TenantId),
// SkuName: pulumi.String("standard"),
// SoftDeleteRetentionDays: pulumi.Int(7),
// AccessPolicies: keyvault.KeyVaultAccessPolicyArray{
// &keyvault.KeyVaultAccessPolicyArgs{
// TenantId: pulumi.String(current.TenantId),
// ObjectId: pulumi.String(current.ObjectId),
// CertificatePermissions: pulumi.StringArray{
// pulumi.String("create"),
// pulumi.String("delete"),
// pulumi.String("deleteissuers"),
// pulumi.String("get"),
// pulumi.String("getissuers"),
// pulumi.String("import"),
// pulumi.String("list"),
// pulumi.String("listissuers"),
// pulumi.String("managecontacts"),
// pulumi.String("manageissuers"),
// pulumi.String("purge"),
// pulumi.String("setissuers"),
// pulumi.String("update"),
// },
// KeyPermissions: pulumi.StringArray{
// pulumi.String("backup"),
// pulumi.String("create"),
// pulumi.String("decrypt"),
// pulumi.String("delete"),
// pulumi.String("encrypt"),
// pulumi.String("get"),
// pulumi.String("import"),
// pulumi.String("list"),
// pulumi.String("purge"),
// pulumi.String("recover"),
// pulumi.String("restore"),
// pulumi.String("sign"),
// pulumi.String("unwrapKey"),
// pulumi.String("update"),
// pulumi.String("verify"),
// pulumi.String("wrapKey"),
// },
// SecretPermissions: pulumi.StringArray{
// pulumi.String("backup"),
// pulumi.String("delete"),
// pulumi.String("get"),
// pulumi.String("list"),
// pulumi.String("purge"),
// pulumi.String("recover"),
// pulumi.String("restore"),
// pulumi.String("set"),
// },
// },
// },
// })
// if err != nil {
// return err
// }
// _, err = keyvault.NewCertificate(ctx, "exampleCertificate", &keyvault.CertificateArgs{
// KeyVaultId: exampleKeyVault.ID(),
// CertificatePolicy: &keyvault.CertificateCertificatePolicyArgs{
// IssuerParameters: &keyvault.CertificateCertificatePolicyIssuerParametersArgs{
// Name: pulumi.String("Self"),
// },
// KeyProperties: &keyvault.CertificateCertificatePolicyKeyPropertiesArgs{
// Exportable: pulumi.Bool(true),
// KeySize: pulumi.Int(2048),
// KeyType: pulumi.String("RSA"),
// ReuseKey: pulumi.Bool(true),
// },
// LifetimeActions: keyvault.CertificateCertificatePolicyLifetimeActionArray{
// &keyvault.CertificateCertificatePolicyLifetimeActionArgs{
// Action: &keyvault.CertificateCertificatePolicyLifetimeActionActionArgs{
// ActionType: pulumi.String("AutoRenew"),
// },
// Trigger: &keyvault.CertificateCertificatePolicyLifetimeActionTriggerArgs{
// DaysBeforeExpiry: pulumi.Int(30),
// },
// },
// },
// SecretProperties: &keyvault.CertificateCertificatePolicySecretPropertiesArgs{
// ContentType: pulumi.String("application/x-pkcs12"),
// },
// X509CertificateProperties: &keyvault.CertificateCertificatePolicyX509CertificatePropertiesArgs{
// ExtendedKeyUsages: pulumi.StringArray{
// pulumi.String("1.3.6.1.5.5.7.3.1"),
// },
// KeyUsages: pulumi.StringArray{
// pulumi.String("cRLSign"),
// pulumi.String("dataEncipherment"),
// pulumi.String("digitalSignature"),
// pulumi.String("keyAgreement"),
// pulumi.String("keyCertSign"),
// pulumi.String("keyEncipherment"),
// },
// SubjectAlternativeNames: &keyvault.CertificateCertificatePolicyX509CertificatePropertiesSubjectAlternativeNamesArgs{
// DnsNames: pulumi.StringArray{
// pulumi.String("internal.contoso.com"),
// pulumi.String("domain.hello.world"),
// },
// },
// Subject: pulumi.String("CN=hello-world"),
// ValidityInMonths: pulumi.Int(12),
// },
// },
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
//
// ## Import
//
// Key Vault Certificates can be imported using the `resource id`, e.g.
//
// ```sh
// $ pulumi import azure:keyvault/certifiate:Certifiate example "https://example-keyvault.vault.azure.net/certificates/example/fdf067c93bbb4b22bff4d8b7a9a56217"
// ```
//
// Deprecated: azure.keyvault.Certifiate has been deprecated in favor of azure.keyvault.Certificate
type Certifiate struct {
pulumi.CustomResourceState
// A `certificate` block as defined below, used to Import an existing certificate.
Certificate CertifiateCertificatePtrOutput `pulumi:"certificate"`
// A `certificateAttribute` block as defined below.
CertificateAttributes CertifiateCertificateAttributeArrayOutput `pulumi:"certificateAttributes"`
// The raw Key Vault Certificate data represented as a hexadecimal string.
CertificateData pulumi.StringOutput `pulumi:"certificateData"`
// The Base64 encoded Key Vault Certificate data.
CertificateDataBase64 pulumi.StringOutput `pulumi:"certificateDataBase64"`
// A `certificatePolicy` block as defined below.
CertificatePolicy CertifiateCertificatePolicyOutput `pulumi:"certificatePolicy"`
// The ID of the Key Vault where the Certificate should be created.
KeyVaultId pulumi.StringOutput `pulumi:"keyVaultId"`
// Specifies the name of the Key Vault Certificate. Changing this forces a new resource to be created.
Name pulumi.StringOutput `pulumi:"name"`
// The ID of the associated Key Vault Secret.
SecretId pulumi.StringOutput `pulumi:"secretId"`
// A mapping of tags to assign to the resource.
Tags pulumi.StringMapOutput `pulumi:"tags"`
// The X509 Thumbprint of the Key Vault Certificate represented as a hexadecimal string.
Thumbprint pulumi.StringOutput `pulumi:"thumbprint"`
// The current version of the Key Vault Certificate.
Version pulumi.StringOutput `pulumi:"version"`
}
// NewCertifiate registers a new resource with the given unique name, arguments, and options.
func NewCertifiate(ctx *pulumi.Context,
name string, args *CertifiateArgs, opts ...pulumi.ResourceOption) (*Certifiate, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.CertificatePolicy == nil {
return nil, errors.New("invalid value for required argument 'CertificatePolicy'")
}
if args.KeyVaultId == nil {
return nil, errors.New("invalid value for required argument 'KeyVaultId'")
}
var resource Certifiate
err := ctx.RegisterResource("azure:keyvault/certifiate:Certifiate", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetCertifiate gets an existing Certifiate resource's state with the given name, ID, and optional
// state properties that are used to uniquely qualify the lookup (nil if not required).
func GetCertifiate(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *CertifiateState, opts ...pulumi.ResourceOption) (*Certifiate, error) {
var resource Certifiate
err := ctx.ReadResource("azure:keyvault/certifiate:Certifiate", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering Certifiate resources.
type certifiateState struct {
// A `certificate` block as defined below, used to Import an existing certificate.
Certificate *CertifiateCertificate `pulumi:"certificate"`
// A `certificateAttribute` block as defined below.
CertificateAttributes []CertifiateCertificateAttribute `pulumi:"certificateAttributes"`
// The raw Key Vault Certificate data represented as a hexadecimal string.
CertificateData *string `pulumi:"certificateData"`
// The Base64 encoded Key Vault Certificate data.
CertificateDataBase64 *string `pulumi:"certificateDataBase64"`
// A `certificatePolicy` block as defined below.
CertificatePolicy *CertifiateCertificatePolicy `pulumi:"certificatePolicy"`
// The ID of the Key Vault where the Certificate should be created.
KeyVaultId *string `pulumi:"keyVaultId"`
// Specifies the name of the Key Vault Certificate. Changing this forces a new resource to be created.
Name *string `pulumi:"name"`
// The ID of the associated Key Vault Secret.
SecretId *string `pulumi:"secretId"`
// A mapping of tags to assign to the resource.
Tags map[string]string `pulumi:"tags"`
// The X509 Thumbprint of the Key Vault Certificate represented as a hexadecimal string.
Thumbprint *string `pulumi:"thumbprint"`
// The current version of the Key Vault Certificate.
Version *string `pulumi:"version"`
}
type CertifiateState struct {
// A `certificate` block as defined below, used to Import an existing certificate.
Certificate CertifiateCertificatePtrInput
// A `certificateAttribute` block as defined below.
CertificateAttributes CertifiateCertificateAttributeArrayInput
// The raw Key Vault Certificate data represented as a hexadecimal string.
CertificateData pulumi.StringPtrInput
// The Base64 encoded Key Vault Certificate data.
CertificateDataBase64 pulumi.StringPtrInput
// A `certificatePolicy` block as defined below.
CertificatePolicy CertifiateCertificatePolicyPtrInput
// The ID of the Key Vault where the Certificate should be created.
KeyVaultId pulumi.StringPtrInput
// Specifies the name of the Key Vault Certificate. Changing this forces a new resource to be created.
Name pulumi.StringPtrInput
// The ID of the associated Key Vault Secret.
SecretId pulumi.StringPtrInput
// A mapping of tags to assign to the resource.
Tags pulumi.StringMapInput
// The X509 Thumbprint of the Key Vault Certificate represented as a hexadecimal string.
Thumbprint pulumi.StringPtrInput
// The current version of the Key Vault Certificate.
Version pulumi.StringPtrInput
}
func (CertifiateState) ElementType() reflect.Type {
return reflect.TypeOf((*certifiateState)(nil)).Elem()
}
type certifiateArgs struct {
// A `certificate` block as defined below, used to Import an existing certificate.
Certificate *CertifiateCertificate `pulumi:"certificate"`
// A `certificatePolicy` block as defined below.
CertificatePolicy CertifiateCertificatePolicy `pulumi:"certificatePolicy"`
// The ID of the Key Vault where the Certificate should be created.
KeyVaultId string `pulumi:"keyVaultId"`
// Specifies the name of the Key Vault Certificate. Changing this forces a new resource to be created.
Name *string `pulumi:"name"`
// A mapping of tags to assign to the resource.
Tags map[string]string `pulumi:"tags"`
}
// The set of arguments for constructing a Certifiate resource.
type CertifiateArgs struct {
// A `certificate` block as defined below, used to Import an existing certificate.
Certificate CertifiateCertificatePtrInput
// A `certificatePolicy` block as defined below.
CertificatePolicy CertifiateCertificatePolicyInput
// The ID of the Key Vault where the Certificate should be created.
KeyVaultId pulumi.StringInput
// Specifies the name of the Key Vault Certificate. Changing this forces a new resource to be created.
Name pulumi.StringPtrInput
// A mapping of tags to assign to the resource.
Tags pulumi.StringMapInput
}
func (CertifiateArgs) ElementType() reflect.Type {
return reflect.TypeOf((*certifiateArgs)(nil)).Elem()
}
type CertifiateInput interface {
pulumi.Input
ToCertifiateOutput() CertifiateOutput
ToCertifiateOutputWithContext(ctx context.Context) CertifiateOutput
}
func (*Certifiate) ElementType() reflect.Type {
return reflect.TypeOf((*Certifiate)(nil))
}
func (i *Certifiate) ToCertifiateOutput() CertifiateOutput {
return i.ToCertifiateOutputWithContext(context.Background())
}
func (i *Certifiate) ToCertifiateOutputWithContext(ctx context.Context) CertifiateOutput {
return pulumi.ToOutputWithContext(ctx, i).(CertifiateOutput)
}
func (i *Certifiate) ToCertifiatePtrOutput() CertifiatePtrOutput {
return i.ToCertifiatePtrOutputWithContext(context.Background())
}
func (i *Certifiate) ToCertifiatePtrOutputWithContext(ctx context.Context) CertifiatePtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(CertifiatePtrOutput)
}
type CertifiatePtrInput interface {
pulumi.Input
ToCertifiatePtrOutput() CertifiatePtrOutput
ToCertifiatePtrOutputWithContext(ctx context.Context) CertifiatePtrOutput
}
type certifiatePtrType CertifiateArgs
func (*certifiatePtrType) ElementType() reflect.Type {
return reflect.TypeOf((**Certifiate)(nil))
}
func (i *certifiatePtrType) ToCertifiatePtrOutput() CertifiatePtrOutput {
return i.ToCertifiatePtrOutputWithContext(context.Background())
}
func (i *certifiatePtrType) ToCertifiatePtrOutputWithContext(ctx context.Context) CertifiatePtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(CertifiatePtrOutput)
}
// CertifiateArrayInput is an input type that accepts CertifiateArray and CertifiateArrayOutput values.
// You can construct a concrete instance of `CertifiateArrayInput` via:
//
// CertifiateArray{ CertifiateArgs{...} }
type CertifiateArrayInput interface {
pulumi.Input
ToCertifiateArrayOutput() CertifiateArrayOutput
ToCertifiateArrayOutputWithContext(context.Context) CertifiateArrayOutput
}
type CertifiateArray []CertifiateInput
func (CertifiateArray) ElementType() reflect.Type {
return reflect.TypeOf(([]*Certifiate)(nil))
}
func (i CertifiateArray) ToCertifiateArrayOutput() CertifiateArrayOutput {
return i.ToCertifiateArrayOutputWithContext(context.Background())
}
func (i CertifiateArray) ToCertifiateArrayOutputWithContext(ctx context.Context) CertifiateArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(CertifiateArrayOutput)
}
// CertifiateMapInput is an input type that accepts CertifiateMap and CertifiateMapOutput values.
// You can construct a concrete instance of `CertifiateMapInput` via:
//
// CertifiateMap{ "key": CertifiateArgs{...} }
type CertifiateMapInput interface {
pulumi.Input
ToCertifiateMapOutput() CertifiateMapOutput
ToCertifiateMapOutputWithContext(context.Context) CertifiateMapOutput
}
type CertifiateMap map[string]CertifiateInput
func (CertifiateMap) ElementType() reflect.Type {
return reflect.TypeOf((map[string]*Certifiate)(nil))
}
func (i CertifiateMap) ToCertifiateMapOutput() CertifiateMapOutput {
return i.ToCertifiateMapOutputWithContext(context.Background())
}
func (i CertifiateMap) ToCertifiateMapOutputWithContext(ctx context.Context) CertifiateMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(CertifiateMapOutput)
}
type CertifiateOutput struct {
*pulumi.OutputState
}
func (CertifiateOutput) ElementType() reflect.Type {
return reflect.TypeOf((*Certifiate)(nil))
}
func (o CertifiateOutput) ToCertifiateOutput() CertifiateOutput {
return o
}
func (o CertifiateOutput) ToCertifiateOutputWithContext(ctx context.Context) CertifiateOutput {
return o
}
func (o CertifiateOutput) ToCertifiatePtrOutput() CertifiatePtrOutput {
return o.ToCertifiatePtrOutputWithContext(context.Background())
}
func (o CertifiateOutput) ToCertifiatePtrOutputWithContext(ctx context.Context) CertifiatePtrOutput {
return o.ApplyT(func(v Certifiate) *Certifiate {
return &v
}).(CertifiatePtrOutput)
}
type CertifiatePtrOutput struct {
*pulumi.OutputState
}
func (CertifiatePtrOutput) ElementType() reflect.Type {
return reflect.TypeOf((**Certifiate)(nil))
}
func (o CertifiatePtrOutput) ToCertifiatePtrOutput() CertifiatePtrOutput {
return o
}
func (o CertifiatePtrOutput) ToCertifiatePtrOutputWithContext(ctx context.Context) CertifiatePtrOutput {
return o
}
type CertifiateArrayOutput struct{ *pulumi.OutputState }
func (CertifiateArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]Certifiate)(nil))
}
func (o CertifiateArrayOutput) ToCertifiateArrayOutput() CertifiateArrayOutput {
return o
}
func (o CertifiateArrayOutput) ToCertifiateArrayOutputWithContext(ctx context.Context) CertifiateArrayOutput {
return o
}
func (o CertifiateArrayOutput) Index(i pulumi.IntInput) CertifiateOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) Certifiate {
return vs[0].([]Certifiate)[vs[1].(int)]
}).(CertifiateOutput)
}
type CertifiateMapOutput struct{ *pulumi.OutputState }
func (CertifiateMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]Certifiate)(nil))
}
func (o CertifiateMapOutput) ToCertifiateMapOutput() CertifiateMapOutput {
return o
}
func (o CertifiateMapOutput) ToCertifiateMapOutputWithContext(ctx context.Context) CertifiateMapOutput {
return o
}
func (o CertifiateMapOutput) MapIndex(k pulumi.StringInput) CertifiateOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) Certifiate {
return vs[0].(map[string]Certifiate)[vs[1].(string)]
}).(CertifiateOutput)
}
func init() {
pulumi.RegisterOutputType(CertifiateOutput{})
pulumi.RegisterOutputType(CertifiatePtrOutput{})
pulumi.RegisterOutputType(CertifiateArrayOutput{})
pulumi.RegisterOutputType(CertifiateMapOutput{})
}