/
ldapConfiguration.go
486 lines (430 loc) · 32.7 KB
/
ldapConfiguration.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
// 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 mongodbatlas
import (
"context"
"reflect"
"errors"
"github.com/pulumi/pulumi-mongodbatlas/sdk/v3/go/mongodbatlas/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// `LdapConfiguration` provides an LDAP Configuration resource. This allows an LDAP configuration for an Atlas project to be crated and managed. This endpoint doesn’t verify connectivity using the provided LDAP over TLS configuration details. To verify a configuration before saving it, use the resource to verify the LDAP configuration.
//
// ## Example Usage
//
// <!--Start PulumiCodeChooser -->
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-mongodbatlas/sdk/v3/go/mongodbatlas"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// testProject, err := mongodbatlas.NewProject(ctx, "testProject", &mongodbatlas.ProjectArgs{
// OrgId: pulumi.String("ORG ID"),
// })
// if err != nil {
// return err
// }
// _, err = mongodbatlas.NewLdapConfiguration(ctx, "testLdapConfiguration", &mongodbatlas.LdapConfigurationArgs{
// ProjectId: testProject.ID(),
// AuthenticationEnabled: pulumi.Bool(true),
// Hostname: pulumi.String("HOSTNAME"),
// Port: pulumi.Int(636),
// BindUsername: pulumi.String("USERNAME"),
// BindPassword: pulumi.String("PASSWORD"),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
// <!--End PulumiCodeChooser -->
//
// ### LDAP With User To DN Mapping
//
// <!--Start PulumiCodeChooser -->
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-mongodbatlas/sdk/v3/go/mongodbatlas"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// testProject, err := mongodbatlas.NewProject(ctx, "testProject", &mongodbatlas.ProjectArgs{
// OrgId: pulumi.String("ORG ID"),
// })
// if err != nil {
// return err
// }
// _, err = mongodbatlas.NewLdapConfiguration(ctx, "testLdapConfiguration", &mongodbatlas.LdapConfigurationArgs{
// ProjectId: testProject.ID(),
// AuthenticationEnabled: pulumi.Bool(true),
// Hostname: pulumi.String("HOSTNAME"),
// Port: pulumi.Int(636),
// BindUsername: pulumi.String("USERNAME"),
// BindPassword: pulumi.String("PASSWORD"),
// CaCertificate: pulumi.String("CA CERTIFICATE"),
// AuthzQueryTemplate: pulumi.String("{USER}?memberOf?base"),
// UserToDnMappings: mongodbatlas.LdapConfigurationUserToDnMappingArray{
// &mongodbatlas.LdapConfigurationUserToDnMappingArgs{
// Match: pulumi.String("(.+)"),
// LdapQuery: pulumi.String("DC=example,DC=com??sub?(userPrincipalName={0})"),
// },
// },
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
// <!--End PulumiCodeChooser -->
//
// ## Import
//
// LDAP Configuration must be imported using project ID, e.g.
//
// ```sh
// $ pulumi import mongodbatlas:index/ldapConfiguration:LdapConfiguration test 5d09d6a59ccf6445652a444a
// ```
// For more information see: [MongoDB Atlas API Reference.](https://docs.atlas.mongodb.com/reference/api/ldaps-configuration-save)
type LdapConfiguration struct {
pulumi.CustomResourceState
// Specifies whether user authentication with LDAP is enabled.
AuthenticationEnabled pulumi.BoolOutput `pulumi:"authenticationEnabled"`
// Specifies whether user authorization with LDAP is enabled. You cannot enable user authorization with LDAP without first enabling user authentication with LDAP.
AuthorizationEnabled pulumi.BoolOutput `pulumi:"authorizationEnabled"`
// An LDAP query template that Atlas executes to obtain the LDAP groups to which the authenticated user belongs. Used only for user authorization. Use the {USER} placeholder in the URL to substitute the authenticated username. The query is relative to the host specified with hostname. The formatting for the query must conform to RFC4515 and RFC 4516. If you do not provide a query template, Atlas attempts to use the default value: `{USER}?memberOf?base`.
AuthzQueryTemplate pulumi.StringOutput `pulumi:"authzQueryTemplate"`
// The password used to authenticate the `bindUsername`.
BindPassword pulumi.StringOutput `pulumi:"bindPassword"`
// The user DN that Atlas uses to connect to the LDAP server. Must be the full DN, such as `CN=BindUser,CN=Users,DC=myldapserver,DC=mycompany,DC=com`.
BindUsername pulumi.StringOutput `pulumi:"bindUsername"`
// CA certificate used to verify the identify of the LDAP server. Self-signed certificates are allowed.
CaCertificate pulumi.StringOutput `pulumi:"caCertificate"`
// The hostname or IP address of the LDAP server. The server must be visible to the internet or connected to your Atlas cluster with VPC Peering.
Hostname pulumi.StringOutput `pulumi:"hostname"`
// The port to which the LDAP server listens for client connections. Default: `636`
Port pulumi.IntPtrOutput `pulumi:"port"`
// The unique ID for the project to configure LDAP.
ProjectId pulumi.StringOutput `pulumi:"projectId"`
// Maps an LDAP username for authentication to an LDAP Distinguished Name (DN). Each document contains a `match` regular expression and either a `substitution` or `ldapQuery` template used to transform the LDAP username extracted from the regular expression. Atlas steps through the each document in the array in the given order, checking the authentication username against the `match` filter. If a match is found, Atlas applies the transformation and uses the output to authenticate the user. Atlas does not check the remaining documents in the array. For more details and examples see the [MongoDB Atlas API Reference](https://docs.atlas.mongodb.com/reference/api/ldaps-configuration-save/).
// * `user_to_dn_mapping.0.match` - (Optional) A regular expression to match against a provided LDAP username. Each parenthesis-enclosed section represents a regular expression capture group used by the `substitution` or `ldapQuery` template.
// * `user_to_dn_mapping.0.substitution` - (Optional) An LDAP Distinguished Name (DN) formatting template that converts the LDAP name matched by the `match` regular expression into an LDAP Distinguished Name. Each bracket-enclosed numeric value is replaced by the corresponding regular expression capture group extracted from the LDAP username that matched the `match` regular expression.
// * `user_to_dn_mapping.0.ldap_query` - (Optional) An LDAP query formatting template that inserts the LDAP name matched by the `match` regular expression into an LDAP query URI as specified by RFC 4515 and RFC 4516. Each numeric value is replaced by the corresponding regular expression capture group extracted from the LDAP username that matched the `match` regular expression.
UserToDnMappings LdapConfigurationUserToDnMappingArrayOutput `pulumi:"userToDnMappings"`
}
// NewLdapConfiguration registers a new resource with the given unique name, arguments, and options.
func NewLdapConfiguration(ctx *pulumi.Context,
name string, args *LdapConfigurationArgs, opts ...pulumi.ResourceOption) (*LdapConfiguration, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.AuthenticationEnabled == nil {
return nil, errors.New("invalid value for required argument 'AuthenticationEnabled'")
}
if args.BindPassword == nil {
return nil, errors.New("invalid value for required argument 'BindPassword'")
}
if args.BindUsername == nil {
return nil, errors.New("invalid value for required argument 'BindUsername'")
}
if args.Hostname == nil {
return nil, errors.New("invalid value for required argument 'Hostname'")
}
if args.ProjectId == nil {
return nil, errors.New("invalid value for required argument 'ProjectId'")
}
if args.BindPassword != nil {
args.BindPassword = pulumi.ToSecret(args.BindPassword).(pulumi.StringInput)
}
secrets := pulumi.AdditionalSecretOutputs([]string{
"bindPassword",
})
opts = append(opts, secrets)
opts = internal.PkgResourceDefaultOpts(opts)
var resource LdapConfiguration
err := ctx.RegisterResource("mongodbatlas:index/ldapConfiguration:LdapConfiguration", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetLdapConfiguration gets an existing LdapConfiguration 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 GetLdapConfiguration(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *LdapConfigurationState, opts ...pulumi.ResourceOption) (*LdapConfiguration, error) {
var resource LdapConfiguration
err := ctx.ReadResource("mongodbatlas:index/ldapConfiguration:LdapConfiguration", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering LdapConfiguration resources.
type ldapConfigurationState struct {
// Specifies whether user authentication with LDAP is enabled.
AuthenticationEnabled *bool `pulumi:"authenticationEnabled"`
// Specifies whether user authorization with LDAP is enabled. You cannot enable user authorization with LDAP without first enabling user authentication with LDAP.
AuthorizationEnabled *bool `pulumi:"authorizationEnabled"`
// An LDAP query template that Atlas executes to obtain the LDAP groups to which the authenticated user belongs. Used only for user authorization. Use the {USER} placeholder in the URL to substitute the authenticated username. The query is relative to the host specified with hostname. The formatting for the query must conform to RFC4515 and RFC 4516. If you do not provide a query template, Atlas attempts to use the default value: `{USER}?memberOf?base`.
AuthzQueryTemplate *string `pulumi:"authzQueryTemplate"`
// The password used to authenticate the `bindUsername`.
BindPassword *string `pulumi:"bindPassword"`
// The user DN that Atlas uses to connect to the LDAP server. Must be the full DN, such as `CN=BindUser,CN=Users,DC=myldapserver,DC=mycompany,DC=com`.
BindUsername *string `pulumi:"bindUsername"`
// CA certificate used to verify the identify of the LDAP server. Self-signed certificates are allowed.
CaCertificate *string `pulumi:"caCertificate"`
// The hostname or IP address of the LDAP server. The server must be visible to the internet or connected to your Atlas cluster with VPC Peering.
Hostname *string `pulumi:"hostname"`
// The port to which the LDAP server listens for client connections. Default: `636`
Port *int `pulumi:"port"`
// The unique ID for the project to configure LDAP.
ProjectId *string `pulumi:"projectId"`
// Maps an LDAP username for authentication to an LDAP Distinguished Name (DN). Each document contains a `match` regular expression and either a `substitution` or `ldapQuery` template used to transform the LDAP username extracted from the regular expression. Atlas steps through the each document in the array in the given order, checking the authentication username against the `match` filter. If a match is found, Atlas applies the transformation and uses the output to authenticate the user. Atlas does not check the remaining documents in the array. For more details and examples see the [MongoDB Atlas API Reference](https://docs.atlas.mongodb.com/reference/api/ldaps-configuration-save/).
// * `user_to_dn_mapping.0.match` - (Optional) A regular expression to match against a provided LDAP username. Each parenthesis-enclosed section represents a regular expression capture group used by the `substitution` or `ldapQuery` template.
// * `user_to_dn_mapping.0.substitution` - (Optional) An LDAP Distinguished Name (DN) formatting template that converts the LDAP name matched by the `match` regular expression into an LDAP Distinguished Name. Each bracket-enclosed numeric value is replaced by the corresponding regular expression capture group extracted from the LDAP username that matched the `match` regular expression.
// * `user_to_dn_mapping.0.ldap_query` - (Optional) An LDAP query formatting template that inserts the LDAP name matched by the `match` regular expression into an LDAP query URI as specified by RFC 4515 and RFC 4516. Each numeric value is replaced by the corresponding regular expression capture group extracted from the LDAP username that matched the `match` regular expression.
UserToDnMappings []LdapConfigurationUserToDnMapping `pulumi:"userToDnMappings"`
}
type LdapConfigurationState struct {
// Specifies whether user authentication with LDAP is enabled.
AuthenticationEnabled pulumi.BoolPtrInput
// Specifies whether user authorization with LDAP is enabled. You cannot enable user authorization with LDAP without first enabling user authentication with LDAP.
AuthorizationEnabled pulumi.BoolPtrInput
// An LDAP query template that Atlas executes to obtain the LDAP groups to which the authenticated user belongs. Used only for user authorization. Use the {USER} placeholder in the URL to substitute the authenticated username. The query is relative to the host specified with hostname. The formatting for the query must conform to RFC4515 and RFC 4516. If you do not provide a query template, Atlas attempts to use the default value: `{USER}?memberOf?base`.
AuthzQueryTemplate pulumi.StringPtrInput
// The password used to authenticate the `bindUsername`.
BindPassword pulumi.StringPtrInput
// The user DN that Atlas uses to connect to the LDAP server. Must be the full DN, such as `CN=BindUser,CN=Users,DC=myldapserver,DC=mycompany,DC=com`.
BindUsername pulumi.StringPtrInput
// CA certificate used to verify the identify of the LDAP server. Self-signed certificates are allowed.
CaCertificate pulumi.StringPtrInput
// The hostname or IP address of the LDAP server. The server must be visible to the internet or connected to your Atlas cluster with VPC Peering.
Hostname pulumi.StringPtrInput
// The port to which the LDAP server listens for client connections. Default: `636`
Port pulumi.IntPtrInput
// The unique ID for the project to configure LDAP.
ProjectId pulumi.StringPtrInput
// Maps an LDAP username for authentication to an LDAP Distinguished Name (DN). Each document contains a `match` regular expression and either a `substitution` or `ldapQuery` template used to transform the LDAP username extracted from the regular expression. Atlas steps through the each document in the array in the given order, checking the authentication username against the `match` filter. If a match is found, Atlas applies the transformation and uses the output to authenticate the user. Atlas does not check the remaining documents in the array. For more details and examples see the [MongoDB Atlas API Reference](https://docs.atlas.mongodb.com/reference/api/ldaps-configuration-save/).
// * `user_to_dn_mapping.0.match` - (Optional) A regular expression to match against a provided LDAP username. Each parenthesis-enclosed section represents a regular expression capture group used by the `substitution` or `ldapQuery` template.
// * `user_to_dn_mapping.0.substitution` - (Optional) An LDAP Distinguished Name (DN) formatting template that converts the LDAP name matched by the `match` regular expression into an LDAP Distinguished Name. Each bracket-enclosed numeric value is replaced by the corresponding regular expression capture group extracted from the LDAP username that matched the `match` regular expression.
// * `user_to_dn_mapping.0.ldap_query` - (Optional) An LDAP query formatting template that inserts the LDAP name matched by the `match` regular expression into an LDAP query URI as specified by RFC 4515 and RFC 4516. Each numeric value is replaced by the corresponding regular expression capture group extracted from the LDAP username that matched the `match` regular expression.
UserToDnMappings LdapConfigurationUserToDnMappingArrayInput
}
func (LdapConfigurationState) ElementType() reflect.Type {
return reflect.TypeOf((*ldapConfigurationState)(nil)).Elem()
}
type ldapConfigurationArgs struct {
// Specifies whether user authentication with LDAP is enabled.
AuthenticationEnabled bool `pulumi:"authenticationEnabled"`
// Specifies whether user authorization with LDAP is enabled. You cannot enable user authorization with LDAP without first enabling user authentication with LDAP.
AuthorizationEnabled *bool `pulumi:"authorizationEnabled"`
// An LDAP query template that Atlas executes to obtain the LDAP groups to which the authenticated user belongs. Used only for user authorization. Use the {USER} placeholder in the URL to substitute the authenticated username. The query is relative to the host specified with hostname. The formatting for the query must conform to RFC4515 and RFC 4516. If you do not provide a query template, Atlas attempts to use the default value: `{USER}?memberOf?base`.
AuthzQueryTemplate *string `pulumi:"authzQueryTemplate"`
// The password used to authenticate the `bindUsername`.
BindPassword string `pulumi:"bindPassword"`
// The user DN that Atlas uses to connect to the LDAP server. Must be the full DN, such as `CN=BindUser,CN=Users,DC=myldapserver,DC=mycompany,DC=com`.
BindUsername string `pulumi:"bindUsername"`
// CA certificate used to verify the identify of the LDAP server. Self-signed certificates are allowed.
CaCertificate *string `pulumi:"caCertificate"`
// The hostname or IP address of the LDAP server. The server must be visible to the internet or connected to your Atlas cluster with VPC Peering.
Hostname string `pulumi:"hostname"`
// The port to which the LDAP server listens for client connections. Default: `636`
Port *int `pulumi:"port"`
// The unique ID for the project to configure LDAP.
ProjectId string `pulumi:"projectId"`
// Maps an LDAP username for authentication to an LDAP Distinguished Name (DN). Each document contains a `match` regular expression and either a `substitution` or `ldapQuery` template used to transform the LDAP username extracted from the regular expression. Atlas steps through the each document in the array in the given order, checking the authentication username against the `match` filter. If a match is found, Atlas applies the transformation and uses the output to authenticate the user. Atlas does not check the remaining documents in the array. For more details and examples see the [MongoDB Atlas API Reference](https://docs.atlas.mongodb.com/reference/api/ldaps-configuration-save/).
// * `user_to_dn_mapping.0.match` - (Optional) A regular expression to match against a provided LDAP username. Each parenthesis-enclosed section represents a regular expression capture group used by the `substitution` or `ldapQuery` template.
// * `user_to_dn_mapping.0.substitution` - (Optional) An LDAP Distinguished Name (DN) formatting template that converts the LDAP name matched by the `match` regular expression into an LDAP Distinguished Name. Each bracket-enclosed numeric value is replaced by the corresponding regular expression capture group extracted from the LDAP username that matched the `match` regular expression.
// * `user_to_dn_mapping.0.ldap_query` - (Optional) An LDAP query formatting template that inserts the LDAP name matched by the `match` regular expression into an LDAP query URI as specified by RFC 4515 and RFC 4516. Each numeric value is replaced by the corresponding regular expression capture group extracted from the LDAP username that matched the `match` regular expression.
UserToDnMappings []LdapConfigurationUserToDnMapping `pulumi:"userToDnMappings"`
}
// The set of arguments for constructing a LdapConfiguration resource.
type LdapConfigurationArgs struct {
// Specifies whether user authentication with LDAP is enabled.
AuthenticationEnabled pulumi.BoolInput
// Specifies whether user authorization with LDAP is enabled. You cannot enable user authorization with LDAP without first enabling user authentication with LDAP.
AuthorizationEnabled pulumi.BoolPtrInput
// An LDAP query template that Atlas executes to obtain the LDAP groups to which the authenticated user belongs. Used only for user authorization. Use the {USER} placeholder in the URL to substitute the authenticated username. The query is relative to the host specified with hostname. The formatting for the query must conform to RFC4515 and RFC 4516. If you do not provide a query template, Atlas attempts to use the default value: `{USER}?memberOf?base`.
AuthzQueryTemplate pulumi.StringPtrInput
// The password used to authenticate the `bindUsername`.
BindPassword pulumi.StringInput
// The user DN that Atlas uses to connect to the LDAP server. Must be the full DN, such as `CN=BindUser,CN=Users,DC=myldapserver,DC=mycompany,DC=com`.
BindUsername pulumi.StringInput
// CA certificate used to verify the identify of the LDAP server. Self-signed certificates are allowed.
CaCertificate pulumi.StringPtrInput
// The hostname or IP address of the LDAP server. The server must be visible to the internet or connected to your Atlas cluster with VPC Peering.
Hostname pulumi.StringInput
// The port to which the LDAP server listens for client connections. Default: `636`
Port pulumi.IntPtrInput
// The unique ID for the project to configure LDAP.
ProjectId pulumi.StringInput
// Maps an LDAP username for authentication to an LDAP Distinguished Name (DN). Each document contains a `match` regular expression and either a `substitution` or `ldapQuery` template used to transform the LDAP username extracted from the regular expression. Atlas steps through the each document in the array in the given order, checking the authentication username against the `match` filter. If a match is found, Atlas applies the transformation and uses the output to authenticate the user. Atlas does not check the remaining documents in the array. For more details and examples see the [MongoDB Atlas API Reference](https://docs.atlas.mongodb.com/reference/api/ldaps-configuration-save/).
// * `user_to_dn_mapping.0.match` - (Optional) A regular expression to match against a provided LDAP username. Each parenthesis-enclosed section represents a regular expression capture group used by the `substitution` or `ldapQuery` template.
// * `user_to_dn_mapping.0.substitution` - (Optional) An LDAP Distinguished Name (DN) formatting template that converts the LDAP name matched by the `match` regular expression into an LDAP Distinguished Name. Each bracket-enclosed numeric value is replaced by the corresponding regular expression capture group extracted from the LDAP username that matched the `match` regular expression.
// * `user_to_dn_mapping.0.ldap_query` - (Optional) An LDAP query formatting template that inserts the LDAP name matched by the `match` regular expression into an LDAP query URI as specified by RFC 4515 and RFC 4516. Each numeric value is replaced by the corresponding regular expression capture group extracted from the LDAP username that matched the `match` regular expression.
UserToDnMappings LdapConfigurationUserToDnMappingArrayInput
}
func (LdapConfigurationArgs) ElementType() reflect.Type {
return reflect.TypeOf((*ldapConfigurationArgs)(nil)).Elem()
}
type LdapConfigurationInput interface {
pulumi.Input
ToLdapConfigurationOutput() LdapConfigurationOutput
ToLdapConfigurationOutputWithContext(ctx context.Context) LdapConfigurationOutput
}
func (*LdapConfiguration) ElementType() reflect.Type {
return reflect.TypeOf((**LdapConfiguration)(nil)).Elem()
}
func (i *LdapConfiguration) ToLdapConfigurationOutput() LdapConfigurationOutput {
return i.ToLdapConfigurationOutputWithContext(context.Background())
}
func (i *LdapConfiguration) ToLdapConfigurationOutputWithContext(ctx context.Context) LdapConfigurationOutput {
return pulumi.ToOutputWithContext(ctx, i).(LdapConfigurationOutput)
}
// LdapConfigurationArrayInput is an input type that accepts LdapConfigurationArray and LdapConfigurationArrayOutput values.
// You can construct a concrete instance of `LdapConfigurationArrayInput` via:
//
// LdapConfigurationArray{ LdapConfigurationArgs{...} }
type LdapConfigurationArrayInput interface {
pulumi.Input
ToLdapConfigurationArrayOutput() LdapConfigurationArrayOutput
ToLdapConfigurationArrayOutputWithContext(context.Context) LdapConfigurationArrayOutput
}
type LdapConfigurationArray []LdapConfigurationInput
func (LdapConfigurationArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*LdapConfiguration)(nil)).Elem()
}
func (i LdapConfigurationArray) ToLdapConfigurationArrayOutput() LdapConfigurationArrayOutput {
return i.ToLdapConfigurationArrayOutputWithContext(context.Background())
}
func (i LdapConfigurationArray) ToLdapConfigurationArrayOutputWithContext(ctx context.Context) LdapConfigurationArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(LdapConfigurationArrayOutput)
}
// LdapConfigurationMapInput is an input type that accepts LdapConfigurationMap and LdapConfigurationMapOutput values.
// You can construct a concrete instance of `LdapConfigurationMapInput` via:
//
// LdapConfigurationMap{ "key": LdapConfigurationArgs{...} }
type LdapConfigurationMapInput interface {
pulumi.Input
ToLdapConfigurationMapOutput() LdapConfigurationMapOutput
ToLdapConfigurationMapOutputWithContext(context.Context) LdapConfigurationMapOutput
}
type LdapConfigurationMap map[string]LdapConfigurationInput
func (LdapConfigurationMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*LdapConfiguration)(nil)).Elem()
}
func (i LdapConfigurationMap) ToLdapConfigurationMapOutput() LdapConfigurationMapOutput {
return i.ToLdapConfigurationMapOutputWithContext(context.Background())
}
func (i LdapConfigurationMap) ToLdapConfigurationMapOutputWithContext(ctx context.Context) LdapConfigurationMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(LdapConfigurationMapOutput)
}
type LdapConfigurationOutput struct{ *pulumi.OutputState }
func (LdapConfigurationOutput) ElementType() reflect.Type {
return reflect.TypeOf((**LdapConfiguration)(nil)).Elem()
}
func (o LdapConfigurationOutput) ToLdapConfigurationOutput() LdapConfigurationOutput {
return o
}
func (o LdapConfigurationOutput) ToLdapConfigurationOutputWithContext(ctx context.Context) LdapConfigurationOutput {
return o
}
// Specifies whether user authentication with LDAP is enabled.
func (o LdapConfigurationOutput) AuthenticationEnabled() pulumi.BoolOutput {
return o.ApplyT(func(v *LdapConfiguration) pulumi.BoolOutput { return v.AuthenticationEnabled }).(pulumi.BoolOutput)
}
// Specifies whether user authorization with LDAP is enabled. You cannot enable user authorization with LDAP without first enabling user authentication with LDAP.
func (o LdapConfigurationOutput) AuthorizationEnabled() pulumi.BoolOutput {
return o.ApplyT(func(v *LdapConfiguration) pulumi.BoolOutput { return v.AuthorizationEnabled }).(pulumi.BoolOutput)
}
// An LDAP query template that Atlas executes to obtain the LDAP groups to which the authenticated user belongs. Used only for user authorization. Use the {USER} placeholder in the URL to substitute the authenticated username. The query is relative to the host specified with hostname. The formatting for the query must conform to RFC4515 and RFC 4516. If you do not provide a query template, Atlas attempts to use the default value: `{USER}?memberOf?base`.
func (o LdapConfigurationOutput) AuthzQueryTemplate() pulumi.StringOutput {
return o.ApplyT(func(v *LdapConfiguration) pulumi.StringOutput { return v.AuthzQueryTemplate }).(pulumi.StringOutput)
}
// The password used to authenticate the `bindUsername`.
func (o LdapConfigurationOutput) BindPassword() pulumi.StringOutput {
return o.ApplyT(func(v *LdapConfiguration) pulumi.StringOutput { return v.BindPassword }).(pulumi.StringOutput)
}
// The user DN that Atlas uses to connect to the LDAP server. Must be the full DN, such as `CN=BindUser,CN=Users,DC=myldapserver,DC=mycompany,DC=com`.
func (o LdapConfigurationOutput) BindUsername() pulumi.StringOutput {
return o.ApplyT(func(v *LdapConfiguration) pulumi.StringOutput { return v.BindUsername }).(pulumi.StringOutput)
}
// CA certificate used to verify the identify of the LDAP server. Self-signed certificates are allowed.
func (o LdapConfigurationOutput) CaCertificate() pulumi.StringOutput {
return o.ApplyT(func(v *LdapConfiguration) pulumi.StringOutput { return v.CaCertificate }).(pulumi.StringOutput)
}
// The hostname or IP address of the LDAP server. The server must be visible to the internet or connected to your Atlas cluster with VPC Peering.
func (o LdapConfigurationOutput) Hostname() pulumi.StringOutput {
return o.ApplyT(func(v *LdapConfiguration) pulumi.StringOutput { return v.Hostname }).(pulumi.StringOutput)
}
// The port to which the LDAP server listens for client connections. Default: `636`
func (o LdapConfigurationOutput) Port() pulumi.IntPtrOutput {
return o.ApplyT(func(v *LdapConfiguration) pulumi.IntPtrOutput { return v.Port }).(pulumi.IntPtrOutput)
}
// The unique ID for the project to configure LDAP.
func (o LdapConfigurationOutput) ProjectId() pulumi.StringOutput {
return o.ApplyT(func(v *LdapConfiguration) pulumi.StringOutput { return v.ProjectId }).(pulumi.StringOutput)
}
// Maps an LDAP username for authentication to an LDAP Distinguished Name (DN). Each document contains a `match` regular expression and either a `substitution` or `ldapQuery` template used to transform the LDAP username extracted from the regular expression. Atlas steps through the each document in the array in the given order, checking the authentication username against the `match` filter. If a match is found, Atlas applies the transformation and uses the output to authenticate the user. Atlas does not check the remaining documents in the array. For more details and examples see the [MongoDB Atlas API Reference](https://docs.atlas.mongodb.com/reference/api/ldaps-configuration-save/).
// * `user_to_dn_mapping.0.match` - (Optional) A regular expression to match against a provided LDAP username. Each parenthesis-enclosed section represents a regular expression capture group used by the `substitution` or `ldapQuery` template.
// * `user_to_dn_mapping.0.substitution` - (Optional) An LDAP Distinguished Name (DN) formatting template that converts the LDAP name matched by the `match` regular expression into an LDAP Distinguished Name. Each bracket-enclosed numeric value is replaced by the corresponding regular expression capture group extracted from the LDAP username that matched the `match` regular expression.
// * `user_to_dn_mapping.0.ldap_query` - (Optional) An LDAP query formatting template that inserts the LDAP name matched by the `match` regular expression into an LDAP query URI as specified by RFC 4515 and RFC 4516. Each numeric value is replaced by the corresponding regular expression capture group extracted from the LDAP username that matched the `match` regular expression.
func (o LdapConfigurationOutput) UserToDnMappings() LdapConfigurationUserToDnMappingArrayOutput {
return o.ApplyT(func(v *LdapConfiguration) LdapConfigurationUserToDnMappingArrayOutput { return v.UserToDnMappings }).(LdapConfigurationUserToDnMappingArrayOutput)
}
type LdapConfigurationArrayOutput struct{ *pulumi.OutputState }
func (LdapConfigurationArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*LdapConfiguration)(nil)).Elem()
}
func (o LdapConfigurationArrayOutput) ToLdapConfigurationArrayOutput() LdapConfigurationArrayOutput {
return o
}
func (o LdapConfigurationArrayOutput) ToLdapConfigurationArrayOutputWithContext(ctx context.Context) LdapConfigurationArrayOutput {
return o
}
func (o LdapConfigurationArrayOutput) Index(i pulumi.IntInput) LdapConfigurationOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *LdapConfiguration {
return vs[0].([]*LdapConfiguration)[vs[1].(int)]
}).(LdapConfigurationOutput)
}
type LdapConfigurationMapOutput struct{ *pulumi.OutputState }
func (LdapConfigurationMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*LdapConfiguration)(nil)).Elem()
}
func (o LdapConfigurationMapOutput) ToLdapConfigurationMapOutput() LdapConfigurationMapOutput {
return o
}
func (o LdapConfigurationMapOutput) ToLdapConfigurationMapOutputWithContext(ctx context.Context) LdapConfigurationMapOutput {
return o
}
func (o LdapConfigurationMapOutput) MapIndex(k pulumi.StringInput) LdapConfigurationOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *LdapConfiguration {
return vs[0].(map[string]*LdapConfiguration)[vs[1].(string)]
}).(LdapConfigurationOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*LdapConfigurationInput)(nil)).Elem(), &LdapConfiguration{})
pulumi.RegisterInputType(reflect.TypeOf((*LdapConfigurationArrayInput)(nil)).Elem(), LdapConfigurationArray{})
pulumi.RegisterInputType(reflect.TypeOf((*LdapConfigurationMapInput)(nil)).Elem(), LdapConfigurationMap{})
pulumi.RegisterOutputType(LdapConfigurationOutput{})
pulumi.RegisterOutputType(LdapConfigurationArrayOutput{})
pulumi.RegisterOutputType(LdapConfigurationMapOutput{})
}