/
userPool.go
298 lines (285 loc) · 22.1 KB
/
userPool.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
// *** 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 cognito
import (
"reflect"
"github.com/pulumi/pulumi/sdk/go/pulumi"
)
// Provides a Cognito User Pool resource.
type UserPool struct {
pulumi.CustomResourceState
// The configuration for AdminCreateUser requests.
AdminCreateUserConfig UserPoolAdminCreateUserConfigOutput `pulumi:"adminCreateUserConfig"`
// Attributes supported as an alias for this user pool. Possible values: phone_number, email, or preferred_username. Conflicts with `usernameAttributes`.
AliasAttributes pulumi.StringArrayOutput `pulumi:"aliasAttributes"`
// The ARN of the user pool.
Arn pulumi.StringOutput `pulumi:"arn"`
// The attributes to be auto-verified. Possible values: email, phone_number.
AutoVerifiedAttributes pulumi.StringArrayOutput `pulumi:"autoVerifiedAttributes"`
// The date the user pool was created.
CreationDate pulumi.StringOutput `pulumi:"creationDate"`
// The configuration for the user pool's device tracking.
DeviceConfiguration UserPoolDeviceConfigurationPtrOutput `pulumi:"deviceConfiguration"`
// The Email Configuration.
EmailConfiguration UserPoolEmailConfigurationPtrOutput `pulumi:"emailConfiguration"`
// A string representing the email verification message. Conflicts with `verificationMessageTemplate` configuration block `emailMessage` argument.
EmailVerificationMessage pulumi.StringOutput `pulumi:"emailVerificationMessage"`
// A string representing the email verification subject. Conflicts with `verificationMessageTemplate` configuration block `emailSubject` argument.
EmailVerificationSubject pulumi.StringOutput `pulumi:"emailVerificationSubject"`
// The endpoint name of the user pool. Example format: cognito-idp.REGION.amazonaws.com/xxxx_yyyyy
Endpoint pulumi.StringOutput `pulumi:"endpoint"`
// A container for the AWS Lambda triggers associated with the user pool.
LambdaConfig UserPoolLambdaConfigOutput `pulumi:"lambdaConfig"`
// The date the user pool was last modified.
LastModifiedDate pulumi.StringOutput `pulumi:"lastModifiedDate"`
// Multi-Factor Authentication (MFA) configuration for the User Pool. Defaults of `OFF`. Valid values:
MfaConfiguration pulumi.StringPtrOutput `pulumi:"mfaConfiguration"`
// The name of the attribute.
Name pulumi.StringOutput `pulumi:"name"`
// A container for information about the user pool password policy.
PasswordPolicy UserPoolPasswordPolicyOutput `pulumi:"passwordPolicy"`
// A container with the schema attributes of a user pool. Schema attributes from the [standard attribute set](https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-settings-attributes.html#cognito-user-pools-standard-attributes) only need to be specified if they are different from the default configuration. Maximum of 50 attributes.
Schemas UserPoolSchemaArrayOutput `pulumi:"schemas"`
// A string representing the SMS authentication message. The message must contain the `{####}` placeholder, which will be replaced with the code.
SmsAuthenticationMessage pulumi.StringPtrOutput `pulumi:"smsAuthenticationMessage"`
// Configuration block for Short Message Service (SMS) settings. Detailed below. These settings apply to SMS user verification and SMS Multi-Factor Authentication (MFA). Due to Cognito API restrictions, the SMS configuration cannot be removed without recreating the Cognito User Pool. For user data safety, this resource will ignore the removal of this configuration by disabling drift detection. To force resource recreation after this configuration has been applied, see the [`up` command and use --replace](https://www.pulumi.com/docs/reference/cli/pulumi_up/).
SmsConfiguration UserPoolSmsConfigurationOutput `pulumi:"smsConfiguration"`
// A string representing the SMS verification message. Conflicts with `verificationMessageTemplate` configuration block `smsMessage` argument.
SmsVerificationMessage pulumi.StringOutput `pulumi:"smsVerificationMessage"`
// Configuration block for software token Mult-Factor Authentication (MFA) settings. Detailed below.
SoftwareTokenMfaConfiguration UserPoolSoftwareTokenMfaConfigurationPtrOutput `pulumi:"softwareTokenMfaConfiguration"`
// A mapping of tags to assign to the User Pool.
Tags pulumi.MapOutput `pulumi:"tags"`
// Configuration block for user pool add-ons to enable user pool advanced security mode features.
UserPoolAddOns UserPoolUserPoolAddOnsPtrOutput `pulumi:"userPoolAddOns"`
// Specifies whether email addresses or phone numbers can be specified as usernames when a user signs up. Conflicts with `aliasAttributes`.
UsernameAttributes pulumi.StringArrayOutput `pulumi:"usernameAttributes"`
// The Username Configuration.
UsernameConfiguration UserPoolUsernameConfigurationPtrOutput `pulumi:"usernameConfiguration"`
// The verification message templates configuration.
VerificationMessageTemplate UserPoolVerificationMessageTemplateOutput `pulumi:"verificationMessageTemplate"`
}
// NewUserPool registers a new resource with the given unique name, arguments, and options.
func NewUserPool(ctx *pulumi.Context,
name string, args *UserPoolArgs, opts ...pulumi.ResourceOption) (*UserPool, error) {
if args == nil {
args = &UserPoolArgs{}
}
var resource UserPool
err := ctx.RegisterResource("aws:cognito/userPool:UserPool", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetUserPool gets an existing UserPool 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 GetUserPool(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *UserPoolState, opts ...pulumi.ResourceOption) (*UserPool, error) {
var resource UserPool
err := ctx.ReadResource("aws:cognito/userPool:UserPool", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering UserPool resources.
type userPoolState struct {
// The configuration for AdminCreateUser requests.
AdminCreateUserConfig *UserPoolAdminCreateUserConfig `pulumi:"adminCreateUserConfig"`
// Attributes supported as an alias for this user pool. Possible values: phone_number, email, or preferred_username. Conflicts with `usernameAttributes`.
AliasAttributes []string `pulumi:"aliasAttributes"`
// The ARN of the user pool.
Arn *string `pulumi:"arn"`
// The attributes to be auto-verified. Possible values: email, phone_number.
AutoVerifiedAttributes []string `pulumi:"autoVerifiedAttributes"`
// The date the user pool was created.
CreationDate *string `pulumi:"creationDate"`
// The configuration for the user pool's device tracking.
DeviceConfiguration *UserPoolDeviceConfiguration `pulumi:"deviceConfiguration"`
// The Email Configuration.
EmailConfiguration *UserPoolEmailConfiguration `pulumi:"emailConfiguration"`
// A string representing the email verification message. Conflicts with `verificationMessageTemplate` configuration block `emailMessage` argument.
EmailVerificationMessage *string `pulumi:"emailVerificationMessage"`
// A string representing the email verification subject. Conflicts with `verificationMessageTemplate` configuration block `emailSubject` argument.
EmailVerificationSubject *string `pulumi:"emailVerificationSubject"`
// The endpoint name of the user pool. Example format: cognito-idp.REGION.amazonaws.com/xxxx_yyyyy
Endpoint *string `pulumi:"endpoint"`
// A container for the AWS Lambda triggers associated with the user pool.
LambdaConfig *UserPoolLambdaConfig `pulumi:"lambdaConfig"`
// The date the user pool was last modified.
LastModifiedDate *string `pulumi:"lastModifiedDate"`
// Multi-Factor Authentication (MFA) configuration for the User Pool. Defaults of `OFF`. Valid values:
MfaConfiguration *string `pulumi:"mfaConfiguration"`
// The name of the attribute.
Name *string `pulumi:"name"`
// A container for information about the user pool password policy.
PasswordPolicy *UserPoolPasswordPolicy `pulumi:"passwordPolicy"`
// A container with the schema attributes of a user pool. Schema attributes from the [standard attribute set](https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-settings-attributes.html#cognito-user-pools-standard-attributes) only need to be specified if they are different from the default configuration. Maximum of 50 attributes.
Schemas []UserPoolSchema `pulumi:"schemas"`
// A string representing the SMS authentication message. The message must contain the `{####}` placeholder, which will be replaced with the code.
SmsAuthenticationMessage *string `pulumi:"smsAuthenticationMessage"`
// Configuration block for Short Message Service (SMS) settings. Detailed below. These settings apply to SMS user verification and SMS Multi-Factor Authentication (MFA). Due to Cognito API restrictions, the SMS configuration cannot be removed without recreating the Cognito User Pool. For user data safety, this resource will ignore the removal of this configuration by disabling drift detection. To force resource recreation after this configuration has been applied, see the [`up` command and use --replace](https://www.pulumi.com/docs/reference/cli/pulumi_up/).
SmsConfiguration *UserPoolSmsConfiguration `pulumi:"smsConfiguration"`
// A string representing the SMS verification message. Conflicts with `verificationMessageTemplate` configuration block `smsMessage` argument.
SmsVerificationMessage *string `pulumi:"smsVerificationMessage"`
// Configuration block for software token Mult-Factor Authentication (MFA) settings. Detailed below.
SoftwareTokenMfaConfiguration *UserPoolSoftwareTokenMfaConfiguration `pulumi:"softwareTokenMfaConfiguration"`
// A mapping of tags to assign to the User Pool.
Tags map[string]interface{} `pulumi:"tags"`
// Configuration block for user pool add-ons to enable user pool advanced security mode features.
UserPoolAddOns *UserPoolUserPoolAddOns `pulumi:"userPoolAddOns"`
// Specifies whether email addresses or phone numbers can be specified as usernames when a user signs up. Conflicts with `aliasAttributes`.
UsernameAttributes []string `pulumi:"usernameAttributes"`
// The Username Configuration.
UsernameConfiguration *UserPoolUsernameConfiguration `pulumi:"usernameConfiguration"`
// The verification message templates configuration.
VerificationMessageTemplate *UserPoolVerificationMessageTemplate `pulumi:"verificationMessageTemplate"`
}
type UserPoolState struct {
// The configuration for AdminCreateUser requests.
AdminCreateUserConfig UserPoolAdminCreateUserConfigPtrInput
// Attributes supported as an alias for this user pool. Possible values: phone_number, email, or preferred_username. Conflicts with `usernameAttributes`.
AliasAttributes pulumi.StringArrayInput
// The ARN of the user pool.
Arn pulumi.StringPtrInput
// The attributes to be auto-verified. Possible values: email, phone_number.
AutoVerifiedAttributes pulumi.StringArrayInput
// The date the user pool was created.
CreationDate pulumi.StringPtrInput
// The configuration for the user pool's device tracking.
DeviceConfiguration UserPoolDeviceConfigurationPtrInput
// The Email Configuration.
EmailConfiguration UserPoolEmailConfigurationPtrInput
// A string representing the email verification message. Conflicts with `verificationMessageTemplate` configuration block `emailMessage` argument.
EmailVerificationMessage pulumi.StringPtrInput
// A string representing the email verification subject. Conflicts with `verificationMessageTemplate` configuration block `emailSubject` argument.
EmailVerificationSubject pulumi.StringPtrInput
// The endpoint name of the user pool. Example format: cognito-idp.REGION.amazonaws.com/xxxx_yyyyy
Endpoint pulumi.StringPtrInput
// A container for the AWS Lambda triggers associated with the user pool.
LambdaConfig UserPoolLambdaConfigPtrInput
// The date the user pool was last modified.
LastModifiedDate pulumi.StringPtrInput
// Multi-Factor Authentication (MFA) configuration for the User Pool. Defaults of `OFF`. Valid values:
MfaConfiguration pulumi.StringPtrInput
// The name of the attribute.
Name pulumi.StringPtrInput
// A container for information about the user pool password policy.
PasswordPolicy UserPoolPasswordPolicyPtrInput
// A container with the schema attributes of a user pool. Schema attributes from the [standard attribute set](https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-settings-attributes.html#cognito-user-pools-standard-attributes) only need to be specified if they are different from the default configuration. Maximum of 50 attributes.
Schemas UserPoolSchemaArrayInput
// A string representing the SMS authentication message. The message must contain the `{####}` placeholder, which will be replaced with the code.
SmsAuthenticationMessage pulumi.StringPtrInput
// Configuration block for Short Message Service (SMS) settings. Detailed below. These settings apply to SMS user verification and SMS Multi-Factor Authentication (MFA). Due to Cognito API restrictions, the SMS configuration cannot be removed without recreating the Cognito User Pool. For user data safety, this resource will ignore the removal of this configuration by disabling drift detection. To force resource recreation after this configuration has been applied, see the [`up` command and use --replace](https://www.pulumi.com/docs/reference/cli/pulumi_up/).
SmsConfiguration UserPoolSmsConfigurationPtrInput
// A string representing the SMS verification message. Conflicts with `verificationMessageTemplate` configuration block `smsMessage` argument.
SmsVerificationMessage pulumi.StringPtrInput
// Configuration block for software token Mult-Factor Authentication (MFA) settings. Detailed below.
SoftwareTokenMfaConfiguration UserPoolSoftwareTokenMfaConfigurationPtrInput
// A mapping of tags to assign to the User Pool.
Tags pulumi.MapInput
// Configuration block for user pool add-ons to enable user pool advanced security mode features.
UserPoolAddOns UserPoolUserPoolAddOnsPtrInput
// Specifies whether email addresses or phone numbers can be specified as usernames when a user signs up. Conflicts with `aliasAttributes`.
UsernameAttributes pulumi.StringArrayInput
// The Username Configuration.
UsernameConfiguration UserPoolUsernameConfigurationPtrInput
// The verification message templates configuration.
VerificationMessageTemplate UserPoolVerificationMessageTemplatePtrInput
}
func (UserPoolState) ElementType() reflect.Type {
return reflect.TypeOf((*userPoolState)(nil)).Elem()
}
type userPoolArgs struct {
// The configuration for AdminCreateUser requests.
AdminCreateUserConfig *UserPoolAdminCreateUserConfig `pulumi:"adminCreateUserConfig"`
// Attributes supported as an alias for this user pool. Possible values: phone_number, email, or preferred_username. Conflicts with `usernameAttributes`.
AliasAttributes []string `pulumi:"aliasAttributes"`
// The attributes to be auto-verified. Possible values: email, phone_number.
AutoVerifiedAttributes []string `pulumi:"autoVerifiedAttributes"`
// The configuration for the user pool's device tracking.
DeviceConfiguration *UserPoolDeviceConfiguration `pulumi:"deviceConfiguration"`
// The Email Configuration.
EmailConfiguration *UserPoolEmailConfiguration `pulumi:"emailConfiguration"`
// A string representing the email verification message. Conflicts with `verificationMessageTemplate` configuration block `emailMessage` argument.
EmailVerificationMessage *string `pulumi:"emailVerificationMessage"`
// A string representing the email verification subject. Conflicts with `verificationMessageTemplate` configuration block `emailSubject` argument.
EmailVerificationSubject *string `pulumi:"emailVerificationSubject"`
// A container for the AWS Lambda triggers associated with the user pool.
LambdaConfig *UserPoolLambdaConfig `pulumi:"lambdaConfig"`
// Multi-Factor Authentication (MFA) configuration for the User Pool. Defaults of `OFF`. Valid values:
MfaConfiguration *string `pulumi:"mfaConfiguration"`
// The name of the attribute.
Name *string `pulumi:"name"`
// A container for information about the user pool password policy.
PasswordPolicy *UserPoolPasswordPolicy `pulumi:"passwordPolicy"`
// A container with the schema attributes of a user pool. Schema attributes from the [standard attribute set](https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-settings-attributes.html#cognito-user-pools-standard-attributes) only need to be specified if they are different from the default configuration. Maximum of 50 attributes.
Schemas []UserPoolSchema `pulumi:"schemas"`
// A string representing the SMS authentication message. The message must contain the `{####}` placeholder, which will be replaced with the code.
SmsAuthenticationMessage *string `pulumi:"smsAuthenticationMessage"`
// Configuration block for Short Message Service (SMS) settings. Detailed below. These settings apply to SMS user verification and SMS Multi-Factor Authentication (MFA). Due to Cognito API restrictions, the SMS configuration cannot be removed without recreating the Cognito User Pool. For user data safety, this resource will ignore the removal of this configuration by disabling drift detection. To force resource recreation after this configuration has been applied, see the [`up` command and use --replace](https://www.pulumi.com/docs/reference/cli/pulumi_up/).
SmsConfiguration *UserPoolSmsConfiguration `pulumi:"smsConfiguration"`
// A string representing the SMS verification message. Conflicts with `verificationMessageTemplate` configuration block `smsMessage` argument.
SmsVerificationMessage *string `pulumi:"smsVerificationMessage"`
// Configuration block for software token Mult-Factor Authentication (MFA) settings. Detailed below.
SoftwareTokenMfaConfiguration *UserPoolSoftwareTokenMfaConfiguration `pulumi:"softwareTokenMfaConfiguration"`
// A mapping of tags to assign to the User Pool.
Tags map[string]interface{} `pulumi:"tags"`
// Configuration block for user pool add-ons to enable user pool advanced security mode features.
UserPoolAddOns *UserPoolUserPoolAddOns `pulumi:"userPoolAddOns"`
// Specifies whether email addresses or phone numbers can be specified as usernames when a user signs up. Conflicts with `aliasAttributes`.
UsernameAttributes []string `pulumi:"usernameAttributes"`
// The Username Configuration.
UsernameConfiguration *UserPoolUsernameConfiguration `pulumi:"usernameConfiguration"`
// The verification message templates configuration.
VerificationMessageTemplate *UserPoolVerificationMessageTemplate `pulumi:"verificationMessageTemplate"`
}
// The set of arguments for constructing a UserPool resource.
type UserPoolArgs struct {
// The configuration for AdminCreateUser requests.
AdminCreateUserConfig UserPoolAdminCreateUserConfigPtrInput
// Attributes supported as an alias for this user pool. Possible values: phone_number, email, or preferred_username. Conflicts with `usernameAttributes`.
AliasAttributes pulumi.StringArrayInput
// The attributes to be auto-verified. Possible values: email, phone_number.
AutoVerifiedAttributes pulumi.StringArrayInput
// The configuration for the user pool's device tracking.
DeviceConfiguration UserPoolDeviceConfigurationPtrInput
// The Email Configuration.
EmailConfiguration UserPoolEmailConfigurationPtrInput
// A string representing the email verification message. Conflicts with `verificationMessageTemplate` configuration block `emailMessage` argument.
EmailVerificationMessage pulumi.StringPtrInput
// A string representing the email verification subject. Conflicts with `verificationMessageTemplate` configuration block `emailSubject` argument.
EmailVerificationSubject pulumi.StringPtrInput
// A container for the AWS Lambda triggers associated with the user pool.
LambdaConfig UserPoolLambdaConfigPtrInput
// Multi-Factor Authentication (MFA) configuration for the User Pool. Defaults of `OFF`. Valid values:
MfaConfiguration pulumi.StringPtrInput
// The name of the attribute.
Name pulumi.StringPtrInput
// A container for information about the user pool password policy.
PasswordPolicy UserPoolPasswordPolicyPtrInput
// A container with the schema attributes of a user pool. Schema attributes from the [standard attribute set](https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-settings-attributes.html#cognito-user-pools-standard-attributes) only need to be specified if they are different from the default configuration. Maximum of 50 attributes.
Schemas UserPoolSchemaArrayInput
// A string representing the SMS authentication message. The message must contain the `{####}` placeholder, which will be replaced with the code.
SmsAuthenticationMessage pulumi.StringPtrInput
// Configuration block for Short Message Service (SMS) settings. Detailed below. These settings apply to SMS user verification and SMS Multi-Factor Authentication (MFA). Due to Cognito API restrictions, the SMS configuration cannot be removed without recreating the Cognito User Pool. For user data safety, this resource will ignore the removal of this configuration by disabling drift detection. To force resource recreation after this configuration has been applied, see the [`up` command and use --replace](https://www.pulumi.com/docs/reference/cli/pulumi_up/).
SmsConfiguration UserPoolSmsConfigurationPtrInput
// A string representing the SMS verification message. Conflicts with `verificationMessageTemplate` configuration block `smsMessage` argument.
SmsVerificationMessage pulumi.StringPtrInput
// Configuration block for software token Mult-Factor Authentication (MFA) settings. Detailed below.
SoftwareTokenMfaConfiguration UserPoolSoftwareTokenMfaConfigurationPtrInput
// A mapping of tags to assign to the User Pool.
Tags pulumi.MapInput
// Configuration block for user pool add-ons to enable user pool advanced security mode features.
UserPoolAddOns UserPoolUserPoolAddOnsPtrInput
// Specifies whether email addresses or phone numbers can be specified as usernames when a user signs up. Conflicts with `aliasAttributes`.
UsernameAttributes pulumi.StringArrayInput
// The Username Configuration.
UsernameConfiguration UserPoolUsernameConfigurationPtrInput
// The verification message templates configuration.
VerificationMessageTemplate UserPoolVerificationMessageTemplatePtrInput
}
func (UserPoolArgs) ElementType() reflect.Type {
return reflect.TypeOf((*userPoolArgs)(nil)).Elem()
}