/
secretLibrary.go
406 lines (353 loc) · 15.8 KB
/
secretLibrary.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
// Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package ad
import (
"context"
"reflect"
"errors"
"github.com/pulumi/pulumi-vault/sdk/v6/go/vault/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// ## Example Usage
//
// <!--Start PulumiCodeChooser -->
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-vault/sdk/v6/go/vault/ad"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// config, err := ad.NewSecretBackend(ctx, "config", &ad.SecretBackendArgs{
// Backend: pulumi.String("ad"),
// Binddn: pulumi.String("CN=Administrator,CN=Users,DC=corp,DC=example,DC=net"),
// Bindpass: pulumi.String("SuperSecretPassw0rd"),
// Url: pulumi.String("ldaps://ad"),
// InsecureTls: pulumi.Bool(true),
// Userdn: pulumi.String("CN=Users,DC=corp,DC=example,DC=net"),
// })
// if err != nil {
// return err
// }
// _, err = ad.NewSecretLibrary(ctx, "qa", &ad.SecretLibraryArgs{
// Backend: config.Backend,
// ServiceAccountNames: pulumi.StringArray{
// pulumi.String("Bob"),
// pulumi.String("Mary"),
// },
// Ttl: pulumi.Int(60),
// DisableCheckInEnforcement: pulumi.Bool(true),
// MaxTtl: pulumi.Int(120),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
// <!--End PulumiCodeChooser -->
//
// ## Import
//
// AD secret backend libraries can be imported using the `path`, e.g.
//
// ```sh
// $ pulumi import vault:ad/secretLibrary:SecretLibrary role ad/library/bob
// ```
type SecretLibrary struct {
pulumi.CustomResourceState
// The path the AD secret backend is mounted at,
// with no leading or trailing `/`s.
Backend pulumi.StringOutput `pulumi:"backend"`
// Disable enforcing that service accounts must be checked in by the entity or client token that checked them out.
DisableCheckInEnforcement pulumi.BoolPtrOutput `pulumi:"disableCheckInEnforcement"`
// The maximum password time-to-live in seconds. Defaults to the configuration
// maxTtl if not provided.
MaxTtl pulumi.IntOutput `pulumi:"maxTtl"`
// The name to identify this set of service accounts.
// Must be unique within the backend.
Name pulumi.StringOutput `pulumi:"name"`
// The namespace to provision the resource in.
// The value should not contain leading or trailing forward slashes.
// The `namespace` is always relative to the provider's configured [namespace](https://www.terraform.io/docs/providers/vault/index.html#namespace).
// *Available only for Vault Enterprise*.
Namespace pulumi.StringPtrOutput `pulumi:"namespace"`
// Specifies the slice of service accounts mapped to this set.
ServiceAccountNames pulumi.StringArrayOutput `pulumi:"serviceAccountNames"`
// The password time-to-live in seconds. Defaults to the configuration
// ttl if not provided.
Ttl pulumi.IntOutput `pulumi:"ttl"`
}
// NewSecretLibrary registers a new resource with the given unique name, arguments, and options.
func NewSecretLibrary(ctx *pulumi.Context,
name string, args *SecretLibraryArgs, opts ...pulumi.ResourceOption) (*SecretLibrary, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.Backend == nil {
return nil, errors.New("invalid value for required argument 'Backend'")
}
if args.ServiceAccountNames == nil {
return nil, errors.New("invalid value for required argument 'ServiceAccountNames'")
}
opts = internal.PkgResourceDefaultOpts(opts)
var resource SecretLibrary
err := ctx.RegisterResource("vault:ad/secretLibrary:SecretLibrary", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetSecretLibrary gets an existing SecretLibrary 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 GetSecretLibrary(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *SecretLibraryState, opts ...pulumi.ResourceOption) (*SecretLibrary, error) {
var resource SecretLibrary
err := ctx.ReadResource("vault:ad/secretLibrary:SecretLibrary", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering SecretLibrary resources.
type secretLibraryState struct {
// The path the AD secret backend is mounted at,
// with no leading or trailing `/`s.
Backend *string `pulumi:"backend"`
// Disable enforcing that service accounts must be checked in by the entity or client token that checked them out.
DisableCheckInEnforcement *bool `pulumi:"disableCheckInEnforcement"`
// The maximum password time-to-live in seconds. Defaults to the configuration
// maxTtl if not provided.
MaxTtl *int `pulumi:"maxTtl"`
// The name to identify this set of service accounts.
// Must be unique within the backend.
Name *string `pulumi:"name"`
// The namespace to provision the resource in.
// The value should not contain leading or trailing forward slashes.
// The `namespace` is always relative to the provider's configured [namespace](https://www.terraform.io/docs/providers/vault/index.html#namespace).
// *Available only for Vault Enterprise*.
Namespace *string `pulumi:"namespace"`
// Specifies the slice of service accounts mapped to this set.
ServiceAccountNames []string `pulumi:"serviceAccountNames"`
// The password time-to-live in seconds. Defaults to the configuration
// ttl if not provided.
Ttl *int `pulumi:"ttl"`
}
type SecretLibraryState struct {
// The path the AD secret backend is mounted at,
// with no leading or trailing `/`s.
Backend pulumi.StringPtrInput
// Disable enforcing that service accounts must be checked in by the entity or client token that checked them out.
DisableCheckInEnforcement pulumi.BoolPtrInput
// The maximum password time-to-live in seconds. Defaults to the configuration
// maxTtl if not provided.
MaxTtl pulumi.IntPtrInput
// The name to identify this set of service accounts.
// Must be unique within the backend.
Name pulumi.StringPtrInput
// The namespace to provision the resource in.
// The value should not contain leading or trailing forward slashes.
// The `namespace` is always relative to the provider's configured [namespace](https://www.terraform.io/docs/providers/vault/index.html#namespace).
// *Available only for Vault Enterprise*.
Namespace pulumi.StringPtrInput
// Specifies the slice of service accounts mapped to this set.
ServiceAccountNames pulumi.StringArrayInput
// The password time-to-live in seconds. Defaults to the configuration
// ttl if not provided.
Ttl pulumi.IntPtrInput
}
func (SecretLibraryState) ElementType() reflect.Type {
return reflect.TypeOf((*secretLibraryState)(nil)).Elem()
}
type secretLibraryArgs struct {
// The path the AD secret backend is mounted at,
// with no leading or trailing `/`s.
Backend string `pulumi:"backend"`
// Disable enforcing that service accounts must be checked in by the entity or client token that checked them out.
DisableCheckInEnforcement *bool `pulumi:"disableCheckInEnforcement"`
// The maximum password time-to-live in seconds. Defaults to the configuration
// maxTtl if not provided.
MaxTtl *int `pulumi:"maxTtl"`
// The name to identify this set of service accounts.
// Must be unique within the backend.
Name *string `pulumi:"name"`
// The namespace to provision the resource in.
// The value should not contain leading or trailing forward slashes.
// The `namespace` is always relative to the provider's configured [namespace](https://www.terraform.io/docs/providers/vault/index.html#namespace).
// *Available only for Vault Enterprise*.
Namespace *string `pulumi:"namespace"`
// Specifies the slice of service accounts mapped to this set.
ServiceAccountNames []string `pulumi:"serviceAccountNames"`
// The password time-to-live in seconds. Defaults to the configuration
// ttl if not provided.
Ttl *int `pulumi:"ttl"`
}
// The set of arguments for constructing a SecretLibrary resource.
type SecretLibraryArgs struct {
// The path the AD secret backend is mounted at,
// with no leading or trailing `/`s.
Backend pulumi.StringInput
// Disable enforcing that service accounts must be checked in by the entity or client token that checked them out.
DisableCheckInEnforcement pulumi.BoolPtrInput
// The maximum password time-to-live in seconds. Defaults to the configuration
// maxTtl if not provided.
MaxTtl pulumi.IntPtrInput
// The name to identify this set of service accounts.
// Must be unique within the backend.
Name pulumi.StringPtrInput
// The namespace to provision the resource in.
// The value should not contain leading or trailing forward slashes.
// The `namespace` is always relative to the provider's configured [namespace](https://www.terraform.io/docs/providers/vault/index.html#namespace).
// *Available only for Vault Enterprise*.
Namespace pulumi.StringPtrInput
// Specifies the slice of service accounts mapped to this set.
ServiceAccountNames pulumi.StringArrayInput
// The password time-to-live in seconds. Defaults to the configuration
// ttl if not provided.
Ttl pulumi.IntPtrInput
}
func (SecretLibraryArgs) ElementType() reflect.Type {
return reflect.TypeOf((*secretLibraryArgs)(nil)).Elem()
}
type SecretLibraryInput interface {
pulumi.Input
ToSecretLibraryOutput() SecretLibraryOutput
ToSecretLibraryOutputWithContext(ctx context.Context) SecretLibraryOutput
}
func (*SecretLibrary) ElementType() reflect.Type {
return reflect.TypeOf((**SecretLibrary)(nil)).Elem()
}
func (i *SecretLibrary) ToSecretLibraryOutput() SecretLibraryOutput {
return i.ToSecretLibraryOutputWithContext(context.Background())
}
func (i *SecretLibrary) ToSecretLibraryOutputWithContext(ctx context.Context) SecretLibraryOutput {
return pulumi.ToOutputWithContext(ctx, i).(SecretLibraryOutput)
}
// SecretLibraryArrayInput is an input type that accepts SecretLibraryArray and SecretLibraryArrayOutput values.
// You can construct a concrete instance of `SecretLibraryArrayInput` via:
//
// SecretLibraryArray{ SecretLibraryArgs{...} }
type SecretLibraryArrayInput interface {
pulumi.Input
ToSecretLibraryArrayOutput() SecretLibraryArrayOutput
ToSecretLibraryArrayOutputWithContext(context.Context) SecretLibraryArrayOutput
}
type SecretLibraryArray []SecretLibraryInput
func (SecretLibraryArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*SecretLibrary)(nil)).Elem()
}
func (i SecretLibraryArray) ToSecretLibraryArrayOutput() SecretLibraryArrayOutput {
return i.ToSecretLibraryArrayOutputWithContext(context.Background())
}
func (i SecretLibraryArray) ToSecretLibraryArrayOutputWithContext(ctx context.Context) SecretLibraryArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(SecretLibraryArrayOutput)
}
// SecretLibraryMapInput is an input type that accepts SecretLibraryMap and SecretLibraryMapOutput values.
// You can construct a concrete instance of `SecretLibraryMapInput` via:
//
// SecretLibraryMap{ "key": SecretLibraryArgs{...} }
type SecretLibraryMapInput interface {
pulumi.Input
ToSecretLibraryMapOutput() SecretLibraryMapOutput
ToSecretLibraryMapOutputWithContext(context.Context) SecretLibraryMapOutput
}
type SecretLibraryMap map[string]SecretLibraryInput
func (SecretLibraryMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*SecretLibrary)(nil)).Elem()
}
func (i SecretLibraryMap) ToSecretLibraryMapOutput() SecretLibraryMapOutput {
return i.ToSecretLibraryMapOutputWithContext(context.Background())
}
func (i SecretLibraryMap) ToSecretLibraryMapOutputWithContext(ctx context.Context) SecretLibraryMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(SecretLibraryMapOutput)
}
type SecretLibraryOutput struct{ *pulumi.OutputState }
func (SecretLibraryOutput) ElementType() reflect.Type {
return reflect.TypeOf((**SecretLibrary)(nil)).Elem()
}
func (o SecretLibraryOutput) ToSecretLibraryOutput() SecretLibraryOutput {
return o
}
func (o SecretLibraryOutput) ToSecretLibraryOutputWithContext(ctx context.Context) SecretLibraryOutput {
return o
}
// The path the AD secret backend is mounted at,
// with no leading or trailing `/`s.
func (o SecretLibraryOutput) Backend() pulumi.StringOutput {
return o.ApplyT(func(v *SecretLibrary) pulumi.StringOutput { return v.Backend }).(pulumi.StringOutput)
}
// Disable enforcing that service accounts must be checked in by the entity or client token that checked them out.
func (o SecretLibraryOutput) DisableCheckInEnforcement() pulumi.BoolPtrOutput {
return o.ApplyT(func(v *SecretLibrary) pulumi.BoolPtrOutput { return v.DisableCheckInEnforcement }).(pulumi.BoolPtrOutput)
}
// The maximum password time-to-live in seconds. Defaults to the configuration
// maxTtl if not provided.
func (o SecretLibraryOutput) MaxTtl() pulumi.IntOutput {
return o.ApplyT(func(v *SecretLibrary) pulumi.IntOutput { return v.MaxTtl }).(pulumi.IntOutput)
}
// The name to identify this set of service accounts.
// Must be unique within the backend.
func (o SecretLibraryOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v *SecretLibrary) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
}
// The namespace to provision the resource in.
// The value should not contain leading or trailing forward slashes.
// The `namespace` is always relative to the provider's configured [namespace](https://www.terraform.io/docs/providers/vault/index.html#namespace).
// *Available only for Vault Enterprise*.
func (o SecretLibraryOutput) Namespace() pulumi.StringPtrOutput {
return o.ApplyT(func(v *SecretLibrary) pulumi.StringPtrOutput { return v.Namespace }).(pulumi.StringPtrOutput)
}
// Specifies the slice of service accounts mapped to this set.
func (o SecretLibraryOutput) ServiceAccountNames() pulumi.StringArrayOutput {
return o.ApplyT(func(v *SecretLibrary) pulumi.StringArrayOutput { return v.ServiceAccountNames }).(pulumi.StringArrayOutput)
}
// The password time-to-live in seconds. Defaults to the configuration
// ttl if not provided.
func (o SecretLibraryOutput) Ttl() pulumi.IntOutput {
return o.ApplyT(func(v *SecretLibrary) pulumi.IntOutput { return v.Ttl }).(pulumi.IntOutput)
}
type SecretLibraryArrayOutput struct{ *pulumi.OutputState }
func (SecretLibraryArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*SecretLibrary)(nil)).Elem()
}
func (o SecretLibraryArrayOutput) ToSecretLibraryArrayOutput() SecretLibraryArrayOutput {
return o
}
func (o SecretLibraryArrayOutput) ToSecretLibraryArrayOutputWithContext(ctx context.Context) SecretLibraryArrayOutput {
return o
}
func (o SecretLibraryArrayOutput) Index(i pulumi.IntInput) SecretLibraryOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *SecretLibrary {
return vs[0].([]*SecretLibrary)[vs[1].(int)]
}).(SecretLibraryOutput)
}
type SecretLibraryMapOutput struct{ *pulumi.OutputState }
func (SecretLibraryMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*SecretLibrary)(nil)).Elem()
}
func (o SecretLibraryMapOutput) ToSecretLibraryMapOutput() SecretLibraryMapOutput {
return o
}
func (o SecretLibraryMapOutput) ToSecretLibraryMapOutputWithContext(ctx context.Context) SecretLibraryMapOutput {
return o
}
func (o SecretLibraryMapOutput) MapIndex(k pulumi.StringInput) SecretLibraryOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *SecretLibrary {
return vs[0].(map[string]*SecretLibrary)[vs[1].(string)]
}).(SecretLibraryOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*SecretLibraryInput)(nil)).Elem(), &SecretLibrary{})
pulumi.RegisterInputType(reflect.TypeOf((*SecretLibraryArrayInput)(nil)).Elem(), SecretLibraryArray{})
pulumi.RegisterInputType(reflect.TypeOf((*SecretLibraryMapInput)(nil)).Elem(), SecretLibraryMap{})
pulumi.RegisterOutputType(SecretLibraryOutput{})
pulumi.RegisterOutputType(SecretLibraryArrayOutput{})
pulumi.RegisterOutputType(SecretLibraryMapOutput{})
}