github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/iam/accountPasswordPolicy.go (about) 1 // Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT. 2 // *** WARNING: Do not edit by hand unless you're certain you know what you are doing! *** 3 4 package iam 5 6 import ( 7 "context" 8 "reflect" 9 10 "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal" 11 "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 12 ) 13 14 // > **Note:** There is only a single policy allowed per AWS account. An existing policy will be lost when using this resource as an effect of this limitation. 15 // 16 // Manages Password Policy for the AWS Account. 17 // See more about [Account Password Policy](http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_passwords_account-policy.html) 18 // in the official AWS docs. 19 // 20 // ## Example Usage 21 // 22 // <!--Start PulumiCodeChooser --> 23 // ```go 24 // package main 25 // 26 // import ( 27 // 28 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam" 29 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 30 // 31 // ) 32 // 33 // func main() { 34 // pulumi.Run(func(ctx *pulumi.Context) error { 35 // _, err := iam.NewAccountPasswordPolicy(ctx, "strict", &iam.AccountPasswordPolicyArgs{ 36 // MinimumPasswordLength: pulumi.Int(8), 37 // RequireLowercaseCharacters: pulumi.Bool(true), 38 // RequireNumbers: pulumi.Bool(true), 39 // RequireUppercaseCharacters: pulumi.Bool(true), 40 // RequireSymbols: pulumi.Bool(true), 41 // AllowUsersToChangePassword: pulumi.Bool(true), 42 // }) 43 // if err != nil { 44 // return err 45 // } 46 // return nil 47 // }) 48 // } 49 // 50 // ``` 51 // <!--End PulumiCodeChooser --> 52 // 53 // ## Import 54 // 55 // Using `pulumi import`, import IAM Account Password Policy using the word `iam-account-password-policy`. For example: 56 // 57 // ```sh 58 // $ pulumi import aws:iam/accountPasswordPolicy:AccountPasswordPolicy strict iam-account-password-policy 59 // ``` 60 type AccountPasswordPolicy struct { 61 pulumi.CustomResourceState 62 63 // Whether to allow users to change their own password 64 AllowUsersToChangePassword pulumi.BoolPtrOutput `pulumi:"allowUsersToChangePassword"` 65 // Indicates whether passwords in the account expire. Returns `true` if `maxPasswordAge` contains a value greater than `0`. Returns `false` if it is `0` or _not present_. 66 ExpirePasswords pulumi.BoolOutput `pulumi:"expirePasswords"` 67 // Whether users are prevented from setting a new password after their password has expired (i.e., require administrator reset) 68 HardExpiry pulumi.BoolOutput `pulumi:"hardExpiry"` 69 // The number of days that an user password is valid. 70 MaxPasswordAge pulumi.IntOutput `pulumi:"maxPasswordAge"` 71 // Minimum length to require for user passwords. 72 MinimumPasswordLength pulumi.IntPtrOutput `pulumi:"minimumPasswordLength"` 73 // The number of previous passwords that users are prevented from reusing. 74 PasswordReusePrevention pulumi.IntOutput `pulumi:"passwordReusePrevention"` 75 // Whether to require lowercase characters for user passwords. 76 RequireLowercaseCharacters pulumi.BoolOutput `pulumi:"requireLowercaseCharacters"` 77 // Whether to require numbers for user passwords. 78 RequireNumbers pulumi.BoolOutput `pulumi:"requireNumbers"` 79 // Whether to require symbols for user passwords. 80 RequireSymbols pulumi.BoolOutput `pulumi:"requireSymbols"` 81 // Whether to require uppercase characters for user passwords. 82 RequireUppercaseCharacters pulumi.BoolOutput `pulumi:"requireUppercaseCharacters"` 83 } 84 85 // NewAccountPasswordPolicy registers a new resource with the given unique name, arguments, and options. 86 func NewAccountPasswordPolicy(ctx *pulumi.Context, 87 name string, args *AccountPasswordPolicyArgs, opts ...pulumi.ResourceOption) (*AccountPasswordPolicy, error) { 88 if args == nil { 89 args = &AccountPasswordPolicyArgs{} 90 } 91 92 opts = internal.PkgResourceDefaultOpts(opts) 93 var resource AccountPasswordPolicy 94 err := ctx.RegisterResource("aws:iam/accountPasswordPolicy:AccountPasswordPolicy", name, args, &resource, opts...) 95 if err != nil { 96 return nil, err 97 } 98 return &resource, nil 99 } 100 101 // GetAccountPasswordPolicy gets an existing AccountPasswordPolicy resource's state with the given name, ID, and optional 102 // state properties that are used to uniquely qualify the lookup (nil if not required). 103 func GetAccountPasswordPolicy(ctx *pulumi.Context, 104 name string, id pulumi.IDInput, state *AccountPasswordPolicyState, opts ...pulumi.ResourceOption) (*AccountPasswordPolicy, error) { 105 var resource AccountPasswordPolicy 106 err := ctx.ReadResource("aws:iam/accountPasswordPolicy:AccountPasswordPolicy", name, id, state, &resource, opts...) 107 if err != nil { 108 return nil, err 109 } 110 return &resource, nil 111 } 112 113 // Input properties used for looking up and filtering AccountPasswordPolicy resources. 114 type accountPasswordPolicyState struct { 115 // Whether to allow users to change their own password 116 AllowUsersToChangePassword *bool `pulumi:"allowUsersToChangePassword"` 117 // Indicates whether passwords in the account expire. Returns `true` if `maxPasswordAge` contains a value greater than `0`. Returns `false` if it is `0` or _not present_. 118 ExpirePasswords *bool `pulumi:"expirePasswords"` 119 // Whether users are prevented from setting a new password after their password has expired (i.e., require administrator reset) 120 HardExpiry *bool `pulumi:"hardExpiry"` 121 // The number of days that an user password is valid. 122 MaxPasswordAge *int `pulumi:"maxPasswordAge"` 123 // Minimum length to require for user passwords. 124 MinimumPasswordLength *int `pulumi:"minimumPasswordLength"` 125 // The number of previous passwords that users are prevented from reusing. 126 PasswordReusePrevention *int `pulumi:"passwordReusePrevention"` 127 // Whether to require lowercase characters for user passwords. 128 RequireLowercaseCharacters *bool `pulumi:"requireLowercaseCharacters"` 129 // Whether to require numbers for user passwords. 130 RequireNumbers *bool `pulumi:"requireNumbers"` 131 // Whether to require symbols for user passwords. 132 RequireSymbols *bool `pulumi:"requireSymbols"` 133 // Whether to require uppercase characters for user passwords. 134 RequireUppercaseCharacters *bool `pulumi:"requireUppercaseCharacters"` 135 } 136 137 type AccountPasswordPolicyState struct { 138 // Whether to allow users to change their own password 139 AllowUsersToChangePassword pulumi.BoolPtrInput 140 // Indicates whether passwords in the account expire. Returns `true` if `maxPasswordAge` contains a value greater than `0`. Returns `false` if it is `0` or _not present_. 141 ExpirePasswords pulumi.BoolPtrInput 142 // Whether users are prevented from setting a new password after their password has expired (i.e., require administrator reset) 143 HardExpiry pulumi.BoolPtrInput 144 // The number of days that an user password is valid. 145 MaxPasswordAge pulumi.IntPtrInput 146 // Minimum length to require for user passwords. 147 MinimumPasswordLength pulumi.IntPtrInput 148 // The number of previous passwords that users are prevented from reusing. 149 PasswordReusePrevention pulumi.IntPtrInput 150 // Whether to require lowercase characters for user passwords. 151 RequireLowercaseCharacters pulumi.BoolPtrInput 152 // Whether to require numbers for user passwords. 153 RequireNumbers pulumi.BoolPtrInput 154 // Whether to require symbols for user passwords. 155 RequireSymbols pulumi.BoolPtrInput 156 // Whether to require uppercase characters for user passwords. 157 RequireUppercaseCharacters pulumi.BoolPtrInput 158 } 159 160 func (AccountPasswordPolicyState) ElementType() reflect.Type { 161 return reflect.TypeOf((*accountPasswordPolicyState)(nil)).Elem() 162 } 163 164 type accountPasswordPolicyArgs struct { 165 // Whether to allow users to change their own password 166 AllowUsersToChangePassword *bool `pulumi:"allowUsersToChangePassword"` 167 // Whether users are prevented from setting a new password after their password has expired (i.e., require administrator reset) 168 HardExpiry *bool `pulumi:"hardExpiry"` 169 // The number of days that an user password is valid. 170 MaxPasswordAge *int `pulumi:"maxPasswordAge"` 171 // Minimum length to require for user passwords. 172 MinimumPasswordLength *int `pulumi:"minimumPasswordLength"` 173 // The number of previous passwords that users are prevented from reusing. 174 PasswordReusePrevention *int `pulumi:"passwordReusePrevention"` 175 // Whether to require lowercase characters for user passwords. 176 RequireLowercaseCharacters *bool `pulumi:"requireLowercaseCharacters"` 177 // Whether to require numbers for user passwords. 178 RequireNumbers *bool `pulumi:"requireNumbers"` 179 // Whether to require symbols for user passwords. 180 RequireSymbols *bool `pulumi:"requireSymbols"` 181 // Whether to require uppercase characters for user passwords. 182 RequireUppercaseCharacters *bool `pulumi:"requireUppercaseCharacters"` 183 } 184 185 // The set of arguments for constructing a AccountPasswordPolicy resource. 186 type AccountPasswordPolicyArgs struct { 187 // Whether to allow users to change their own password 188 AllowUsersToChangePassword pulumi.BoolPtrInput 189 // Whether users are prevented from setting a new password after their password has expired (i.e., require administrator reset) 190 HardExpiry pulumi.BoolPtrInput 191 // The number of days that an user password is valid. 192 MaxPasswordAge pulumi.IntPtrInput 193 // Minimum length to require for user passwords. 194 MinimumPasswordLength pulumi.IntPtrInput 195 // The number of previous passwords that users are prevented from reusing. 196 PasswordReusePrevention pulumi.IntPtrInput 197 // Whether to require lowercase characters for user passwords. 198 RequireLowercaseCharacters pulumi.BoolPtrInput 199 // Whether to require numbers for user passwords. 200 RequireNumbers pulumi.BoolPtrInput 201 // Whether to require symbols for user passwords. 202 RequireSymbols pulumi.BoolPtrInput 203 // Whether to require uppercase characters for user passwords. 204 RequireUppercaseCharacters pulumi.BoolPtrInput 205 } 206 207 func (AccountPasswordPolicyArgs) ElementType() reflect.Type { 208 return reflect.TypeOf((*accountPasswordPolicyArgs)(nil)).Elem() 209 } 210 211 type AccountPasswordPolicyInput interface { 212 pulumi.Input 213 214 ToAccountPasswordPolicyOutput() AccountPasswordPolicyOutput 215 ToAccountPasswordPolicyOutputWithContext(ctx context.Context) AccountPasswordPolicyOutput 216 } 217 218 func (*AccountPasswordPolicy) ElementType() reflect.Type { 219 return reflect.TypeOf((**AccountPasswordPolicy)(nil)).Elem() 220 } 221 222 func (i *AccountPasswordPolicy) ToAccountPasswordPolicyOutput() AccountPasswordPolicyOutput { 223 return i.ToAccountPasswordPolicyOutputWithContext(context.Background()) 224 } 225 226 func (i *AccountPasswordPolicy) ToAccountPasswordPolicyOutputWithContext(ctx context.Context) AccountPasswordPolicyOutput { 227 return pulumi.ToOutputWithContext(ctx, i).(AccountPasswordPolicyOutput) 228 } 229 230 // AccountPasswordPolicyArrayInput is an input type that accepts AccountPasswordPolicyArray and AccountPasswordPolicyArrayOutput values. 231 // You can construct a concrete instance of `AccountPasswordPolicyArrayInput` via: 232 // 233 // AccountPasswordPolicyArray{ AccountPasswordPolicyArgs{...} } 234 type AccountPasswordPolicyArrayInput interface { 235 pulumi.Input 236 237 ToAccountPasswordPolicyArrayOutput() AccountPasswordPolicyArrayOutput 238 ToAccountPasswordPolicyArrayOutputWithContext(context.Context) AccountPasswordPolicyArrayOutput 239 } 240 241 type AccountPasswordPolicyArray []AccountPasswordPolicyInput 242 243 func (AccountPasswordPolicyArray) ElementType() reflect.Type { 244 return reflect.TypeOf((*[]*AccountPasswordPolicy)(nil)).Elem() 245 } 246 247 func (i AccountPasswordPolicyArray) ToAccountPasswordPolicyArrayOutput() AccountPasswordPolicyArrayOutput { 248 return i.ToAccountPasswordPolicyArrayOutputWithContext(context.Background()) 249 } 250 251 func (i AccountPasswordPolicyArray) ToAccountPasswordPolicyArrayOutputWithContext(ctx context.Context) AccountPasswordPolicyArrayOutput { 252 return pulumi.ToOutputWithContext(ctx, i).(AccountPasswordPolicyArrayOutput) 253 } 254 255 // AccountPasswordPolicyMapInput is an input type that accepts AccountPasswordPolicyMap and AccountPasswordPolicyMapOutput values. 256 // You can construct a concrete instance of `AccountPasswordPolicyMapInput` via: 257 // 258 // AccountPasswordPolicyMap{ "key": AccountPasswordPolicyArgs{...} } 259 type AccountPasswordPolicyMapInput interface { 260 pulumi.Input 261 262 ToAccountPasswordPolicyMapOutput() AccountPasswordPolicyMapOutput 263 ToAccountPasswordPolicyMapOutputWithContext(context.Context) AccountPasswordPolicyMapOutput 264 } 265 266 type AccountPasswordPolicyMap map[string]AccountPasswordPolicyInput 267 268 func (AccountPasswordPolicyMap) ElementType() reflect.Type { 269 return reflect.TypeOf((*map[string]*AccountPasswordPolicy)(nil)).Elem() 270 } 271 272 func (i AccountPasswordPolicyMap) ToAccountPasswordPolicyMapOutput() AccountPasswordPolicyMapOutput { 273 return i.ToAccountPasswordPolicyMapOutputWithContext(context.Background()) 274 } 275 276 func (i AccountPasswordPolicyMap) ToAccountPasswordPolicyMapOutputWithContext(ctx context.Context) AccountPasswordPolicyMapOutput { 277 return pulumi.ToOutputWithContext(ctx, i).(AccountPasswordPolicyMapOutput) 278 } 279 280 type AccountPasswordPolicyOutput struct{ *pulumi.OutputState } 281 282 func (AccountPasswordPolicyOutput) ElementType() reflect.Type { 283 return reflect.TypeOf((**AccountPasswordPolicy)(nil)).Elem() 284 } 285 286 func (o AccountPasswordPolicyOutput) ToAccountPasswordPolicyOutput() AccountPasswordPolicyOutput { 287 return o 288 } 289 290 func (o AccountPasswordPolicyOutput) ToAccountPasswordPolicyOutputWithContext(ctx context.Context) AccountPasswordPolicyOutput { 291 return o 292 } 293 294 // Whether to allow users to change their own password 295 func (o AccountPasswordPolicyOutput) AllowUsersToChangePassword() pulumi.BoolPtrOutput { 296 return o.ApplyT(func(v *AccountPasswordPolicy) pulumi.BoolPtrOutput { return v.AllowUsersToChangePassword }).(pulumi.BoolPtrOutput) 297 } 298 299 // Indicates whether passwords in the account expire. Returns `true` if `maxPasswordAge` contains a value greater than `0`. Returns `false` if it is `0` or _not present_. 300 func (o AccountPasswordPolicyOutput) ExpirePasswords() pulumi.BoolOutput { 301 return o.ApplyT(func(v *AccountPasswordPolicy) pulumi.BoolOutput { return v.ExpirePasswords }).(pulumi.BoolOutput) 302 } 303 304 // Whether users are prevented from setting a new password after their password has expired (i.e., require administrator reset) 305 func (o AccountPasswordPolicyOutput) HardExpiry() pulumi.BoolOutput { 306 return o.ApplyT(func(v *AccountPasswordPolicy) pulumi.BoolOutput { return v.HardExpiry }).(pulumi.BoolOutput) 307 } 308 309 // The number of days that an user password is valid. 310 func (o AccountPasswordPolicyOutput) MaxPasswordAge() pulumi.IntOutput { 311 return o.ApplyT(func(v *AccountPasswordPolicy) pulumi.IntOutput { return v.MaxPasswordAge }).(pulumi.IntOutput) 312 } 313 314 // Minimum length to require for user passwords. 315 func (o AccountPasswordPolicyOutput) MinimumPasswordLength() pulumi.IntPtrOutput { 316 return o.ApplyT(func(v *AccountPasswordPolicy) pulumi.IntPtrOutput { return v.MinimumPasswordLength }).(pulumi.IntPtrOutput) 317 } 318 319 // The number of previous passwords that users are prevented from reusing. 320 func (o AccountPasswordPolicyOutput) PasswordReusePrevention() pulumi.IntOutput { 321 return o.ApplyT(func(v *AccountPasswordPolicy) pulumi.IntOutput { return v.PasswordReusePrevention }).(pulumi.IntOutput) 322 } 323 324 // Whether to require lowercase characters for user passwords. 325 func (o AccountPasswordPolicyOutput) RequireLowercaseCharacters() pulumi.BoolOutput { 326 return o.ApplyT(func(v *AccountPasswordPolicy) pulumi.BoolOutput { return v.RequireLowercaseCharacters }).(pulumi.BoolOutput) 327 } 328 329 // Whether to require numbers for user passwords. 330 func (o AccountPasswordPolicyOutput) RequireNumbers() pulumi.BoolOutput { 331 return o.ApplyT(func(v *AccountPasswordPolicy) pulumi.BoolOutput { return v.RequireNumbers }).(pulumi.BoolOutput) 332 } 333 334 // Whether to require symbols for user passwords. 335 func (o AccountPasswordPolicyOutput) RequireSymbols() pulumi.BoolOutput { 336 return o.ApplyT(func(v *AccountPasswordPolicy) pulumi.BoolOutput { return v.RequireSymbols }).(pulumi.BoolOutput) 337 } 338 339 // Whether to require uppercase characters for user passwords. 340 func (o AccountPasswordPolicyOutput) RequireUppercaseCharacters() pulumi.BoolOutput { 341 return o.ApplyT(func(v *AccountPasswordPolicy) pulumi.BoolOutput { return v.RequireUppercaseCharacters }).(pulumi.BoolOutput) 342 } 343 344 type AccountPasswordPolicyArrayOutput struct{ *pulumi.OutputState } 345 346 func (AccountPasswordPolicyArrayOutput) ElementType() reflect.Type { 347 return reflect.TypeOf((*[]*AccountPasswordPolicy)(nil)).Elem() 348 } 349 350 func (o AccountPasswordPolicyArrayOutput) ToAccountPasswordPolicyArrayOutput() AccountPasswordPolicyArrayOutput { 351 return o 352 } 353 354 func (o AccountPasswordPolicyArrayOutput) ToAccountPasswordPolicyArrayOutputWithContext(ctx context.Context) AccountPasswordPolicyArrayOutput { 355 return o 356 } 357 358 func (o AccountPasswordPolicyArrayOutput) Index(i pulumi.IntInput) AccountPasswordPolicyOutput { 359 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *AccountPasswordPolicy { 360 return vs[0].([]*AccountPasswordPolicy)[vs[1].(int)] 361 }).(AccountPasswordPolicyOutput) 362 } 363 364 type AccountPasswordPolicyMapOutput struct{ *pulumi.OutputState } 365 366 func (AccountPasswordPolicyMapOutput) ElementType() reflect.Type { 367 return reflect.TypeOf((*map[string]*AccountPasswordPolicy)(nil)).Elem() 368 } 369 370 func (o AccountPasswordPolicyMapOutput) ToAccountPasswordPolicyMapOutput() AccountPasswordPolicyMapOutput { 371 return o 372 } 373 374 func (o AccountPasswordPolicyMapOutput) ToAccountPasswordPolicyMapOutputWithContext(ctx context.Context) AccountPasswordPolicyMapOutput { 375 return o 376 } 377 378 func (o AccountPasswordPolicyMapOutput) MapIndex(k pulumi.StringInput) AccountPasswordPolicyOutput { 379 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *AccountPasswordPolicy { 380 return vs[0].(map[string]*AccountPasswordPolicy)[vs[1].(string)] 381 }).(AccountPasswordPolicyOutput) 382 } 383 384 func init() { 385 pulumi.RegisterInputType(reflect.TypeOf((*AccountPasswordPolicyInput)(nil)).Elem(), &AccountPasswordPolicy{}) 386 pulumi.RegisterInputType(reflect.TypeOf((*AccountPasswordPolicyArrayInput)(nil)).Elem(), AccountPasswordPolicyArray{}) 387 pulumi.RegisterInputType(reflect.TypeOf((*AccountPasswordPolicyMapInput)(nil)).Elem(), AccountPasswordPolicyMap{}) 388 pulumi.RegisterOutputType(AccountPasswordPolicyOutput{}) 389 pulumi.RegisterOutputType(AccountPasswordPolicyArrayOutput{}) 390 pulumi.RegisterOutputType(AccountPasswordPolicyMapOutput{}) 391 }