github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/iam/userLoginProfile.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 "errors" 11 "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal" 12 "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 13 ) 14 15 // Manages an IAM User Login Profile with limited support for password creation during this provider resource creation. Uses PGP to encrypt the password for safe transport to the user. PGP keys can be obtained from Keybase. 16 // 17 // > To reset an IAM User login password via this provider, you can use delete and recreate this resource or change any of the arguments. 18 // 19 // ## Example Usage 20 // 21 // <!--Start PulumiCodeChooser --> 22 // ```go 23 // package main 24 // 25 // import ( 26 // 27 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam" 28 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 29 // 30 // ) 31 // 32 // func main() { 33 // pulumi.Run(func(ctx *pulumi.Context) error { 34 // example, err := iam.NewUser(ctx, "example", &iam.UserArgs{ 35 // Name: pulumi.String("example"), 36 // Path: pulumi.String("/"), 37 // ForceDestroy: pulumi.Bool(true), 38 // }) 39 // if err != nil { 40 // return err 41 // } 42 // exampleUserLoginProfile, err := iam.NewUserLoginProfile(ctx, "example", &iam.UserLoginProfileArgs{ 43 // User: example.Name, 44 // PgpKey: pulumi.String("keybase:some_person_that_exists"), 45 // }) 46 // if err != nil { 47 // return err 48 // } 49 // ctx.Export("password", exampleUserLoginProfile.EncryptedPassword) 50 // return nil 51 // }) 52 // } 53 // 54 // ``` 55 // <!--End PulumiCodeChooser --> 56 // 57 // ## Import 58 // 59 // Using `pulumi import`, import IAM User Login Profiles without password information via the IAM User name. For example: 60 // 61 // ```sh 62 // $ pulumi import aws:iam/userLoginProfile:UserLoginProfile example myusername 63 // ``` 64 // Since Pulumi has no method to read the PGP or password information during import, use the resource options `ignore_changes` argument to ignore them (unless you want to recreate a password). For example: 65 type UserLoginProfile struct { 66 pulumi.CustomResourceState 67 68 // The encrypted password, base64 encoded. Only available if password was handled on resource creation, not import. 69 EncryptedPassword pulumi.StringOutput `pulumi:"encryptedPassword"` 70 // The fingerprint of the PGP key used to encrypt the password. Only available if password was handled on this provider resource creation, not import. 71 KeyFingerprint pulumi.StringOutput `pulumi:"keyFingerprint"` 72 // The plain text password, only available when `pgpKey` is not provided. 73 Password pulumi.StringOutput `pulumi:"password"` 74 // The length of the generated password on resource creation. Only applies on resource creation. Drift detection is not possible with this argument. Default value is `20`. 75 PasswordLength pulumi.IntPtrOutput `pulumi:"passwordLength"` 76 // Whether the user should be forced to reset the generated password on resource creation. Only applies on resource creation. 77 PasswordResetRequired pulumi.BoolOutput `pulumi:"passwordResetRequired"` 78 // Either a base-64 encoded PGP public key, or a keybase username in the form `keybase:username`. Only applies on resource creation. Drift detection is not possible with this argument. 79 PgpKey pulumi.StringPtrOutput `pulumi:"pgpKey"` 80 // The IAM user's name. 81 User pulumi.StringOutput `pulumi:"user"` 82 } 83 84 // NewUserLoginProfile registers a new resource with the given unique name, arguments, and options. 85 func NewUserLoginProfile(ctx *pulumi.Context, 86 name string, args *UserLoginProfileArgs, opts ...pulumi.ResourceOption) (*UserLoginProfile, error) { 87 if args == nil { 88 return nil, errors.New("missing one or more required arguments") 89 } 90 91 if args.User == nil { 92 return nil, errors.New("invalid value for required argument 'User'") 93 } 94 opts = internal.PkgResourceDefaultOpts(opts) 95 var resource UserLoginProfile 96 err := ctx.RegisterResource("aws:iam/userLoginProfile:UserLoginProfile", name, args, &resource, opts...) 97 if err != nil { 98 return nil, err 99 } 100 return &resource, nil 101 } 102 103 // GetUserLoginProfile gets an existing UserLoginProfile resource's state with the given name, ID, and optional 104 // state properties that are used to uniquely qualify the lookup (nil if not required). 105 func GetUserLoginProfile(ctx *pulumi.Context, 106 name string, id pulumi.IDInput, state *UserLoginProfileState, opts ...pulumi.ResourceOption) (*UserLoginProfile, error) { 107 var resource UserLoginProfile 108 err := ctx.ReadResource("aws:iam/userLoginProfile:UserLoginProfile", name, id, state, &resource, opts...) 109 if err != nil { 110 return nil, err 111 } 112 return &resource, nil 113 } 114 115 // Input properties used for looking up and filtering UserLoginProfile resources. 116 type userLoginProfileState struct { 117 // The encrypted password, base64 encoded. Only available if password was handled on resource creation, not import. 118 EncryptedPassword *string `pulumi:"encryptedPassword"` 119 // The fingerprint of the PGP key used to encrypt the password. Only available if password was handled on this provider resource creation, not import. 120 KeyFingerprint *string `pulumi:"keyFingerprint"` 121 // The plain text password, only available when `pgpKey` is not provided. 122 Password *string `pulumi:"password"` 123 // The length of the generated password on resource creation. Only applies on resource creation. Drift detection is not possible with this argument. Default value is `20`. 124 PasswordLength *int `pulumi:"passwordLength"` 125 // Whether the user should be forced to reset the generated password on resource creation. Only applies on resource creation. 126 PasswordResetRequired *bool `pulumi:"passwordResetRequired"` 127 // Either a base-64 encoded PGP public key, or a keybase username in the form `keybase:username`. Only applies on resource creation. Drift detection is not possible with this argument. 128 PgpKey *string `pulumi:"pgpKey"` 129 // The IAM user's name. 130 User *string `pulumi:"user"` 131 } 132 133 type UserLoginProfileState struct { 134 // The encrypted password, base64 encoded. Only available if password was handled on resource creation, not import. 135 EncryptedPassword pulumi.StringPtrInput 136 // The fingerprint of the PGP key used to encrypt the password. Only available if password was handled on this provider resource creation, not import. 137 KeyFingerprint pulumi.StringPtrInput 138 // The plain text password, only available when `pgpKey` is not provided. 139 Password pulumi.StringPtrInput 140 // The length of the generated password on resource creation. Only applies on resource creation. Drift detection is not possible with this argument. Default value is `20`. 141 PasswordLength pulumi.IntPtrInput 142 // Whether the user should be forced to reset the generated password on resource creation. Only applies on resource creation. 143 PasswordResetRequired pulumi.BoolPtrInput 144 // Either a base-64 encoded PGP public key, or a keybase username in the form `keybase:username`. Only applies on resource creation. Drift detection is not possible with this argument. 145 PgpKey pulumi.StringPtrInput 146 // The IAM user's name. 147 User pulumi.StringPtrInput 148 } 149 150 func (UserLoginProfileState) ElementType() reflect.Type { 151 return reflect.TypeOf((*userLoginProfileState)(nil)).Elem() 152 } 153 154 type userLoginProfileArgs struct { 155 // The length of the generated password on resource creation. Only applies on resource creation. Drift detection is not possible with this argument. Default value is `20`. 156 PasswordLength *int `pulumi:"passwordLength"` 157 // Whether the user should be forced to reset the generated password on resource creation. Only applies on resource creation. 158 PasswordResetRequired *bool `pulumi:"passwordResetRequired"` 159 // Either a base-64 encoded PGP public key, or a keybase username in the form `keybase:username`. Only applies on resource creation. Drift detection is not possible with this argument. 160 PgpKey *string `pulumi:"pgpKey"` 161 // The IAM user's name. 162 User string `pulumi:"user"` 163 } 164 165 // The set of arguments for constructing a UserLoginProfile resource. 166 type UserLoginProfileArgs struct { 167 // The length of the generated password on resource creation. Only applies on resource creation. Drift detection is not possible with this argument. Default value is `20`. 168 PasswordLength pulumi.IntPtrInput 169 // Whether the user should be forced to reset the generated password on resource creation. Only applies on resource creation. 170 PasswordResetRequired pulumi.BoolPtrInput 171 // Either a base-64 encoded PGP public key, or a keybase username in the form `keybase:username`. Only applies on resource creation. Drift detection is not possible with this argument. 172 PgpKey pulumi.StringPtrInput 173 // The IAM user's name. 174 User pulumi.StringInput 175 } 176 177 func (UserLoginProfileArgs) ElementType() reflect.Type { 178 return reflect.TypeOf((*userLoginProfileArgs)(nil)).Elem() 179 } 180 181 type UserLoginProfileInput interface { 182 pulumi.Input 183 184 ToUserLoginProfileOutput() UserLoginProfileOutput 185 ToUserLoginProfileOutputWithContext(ctx context.Context) UserLoginProfileOutput 186 } 187 188 func (*UserLoginProfile) ElementType() reflect.Type { 189 return reflect.TypeOf((**UserLoginProfile)(nil)).Elem() 190 } 191 192 func (i *UserLoginProfile) ToUserLoginProfileOutput() UserLoginProfileOutput { 193 return i.ToUserLoginProfileOutputWithContext(context.Background()) 194 } 195 196 func (i *UserLoginProfile) ToUserLoginProfileOutputWithContext(ctx context.Context) UserLoginProfileOutput { 197 return pulumi.ToOutputWithContext(ctx, i).(UserLoginProfileOutput) 198 } 199 200 // UserLoginProfileArrayInput is an input type that accepts UserLoginProfileArray and UserLoginProfileArrayOutput values. 201 // You can construct a concrete instance of `UserLoginProfileArrayInput` via: 202 // 203 // UserLoginProfileArray{ UserLoginProfileArgs{...} } 204 type UserLoginProfileArrayInput interface { 205 pulumi.Input 206 207 ToUserLoginProfileArrayOutput() UserLoginProfileArrayOutput 208 ToUserLoginProfileArrayOutputWithContext(context.Context) UserLoginProfileArrayOutput 209 } 210 211 type UserLoginProfileArray []UserLoginProfileInput 212 213 func (UserLoginProfileArray) ElementType() reflect.Type { 214 return reflect.TypeOf((*[]*UserLoginProfile)(nil)).Elem() 215 } 216 217 func (i UserLoginProfileArray) ToUserLoginProfileArrayOutput() UserLoginProfileArrayOutput { 218 return i.ToUserLoginProfileArrayOutputWithContext(context.Background()) 219 } 220 221 func (i UserLoginProfileArray) ToUserLoginProfileArrayOutputWithContext(ctx context.Context) UserLoginProfileArrayOutput { 222 return pulumi.ToOutputWithContext(ctx, i).(UserLoginProfileArrayOutput) 223 } 224 225 // UserLoginProfileMapInput is an input type that accepts UserLoginProfileMap and UserLoginProfileMapOutput values. 226 // You can construct a concrete instance of `UserLoginProfileMapInput` via: 227 // 228 // UserLoginProfileMap{ "key": UserLoginProfileArgs{...} } 229 type UserLoginProfileMapInput interface { 230 pulumi.Input 231 232 ToUserLoginProfileMapOutput() UserLoginProfileMapOutput 233 ToUserLoginProfileMapOutputWithContext(context.Context) UserLoginProfileMapOutput 234 } 235 236 type UserLoginProfileMap map[string]UserLoginProfileInput 237 238 func (UserLoginProfileMap) ElementType() reflect.Type { 239 return reflect.TypeOf((*map[string]*UserLoginProfile)(nil)).Elem() 240 } 241 242 func (i UserLoginProfileMap) ToUserLoginProfileMapOutput() UserLoginProfileMapOutput { 243 return i.ToUserLoginProfileMapOutputWithContext(context.Background()) 244 } 245 246 func (i UserLoginProfileMap) ToUserLoginProfileMapOutputWithContext(ctx context.Context) UserLoginProfileMapOutput { 247 return pulumi.ToOutputWithContext(ctx, i).(UserLoginProfileMapOutput) 248 } 249 250 type UserLoginProfileOutput struct{ *pulumi.OutputState } 251 252 func (UserLoginProfileOutput) ElementType() reflect.Type { 253 return reflect.TypeOf((**UserLoginProfile)(nil)).Elem() 254 } 255 256 func (o UserLoginProfileOutput) ToUserLoginProfileOutput() UserLoginProfileOutput { 257 return o 258 } 259 260 func (o UserLoginProfileOutput) ToUserLoginProfileOutputWithContext(ctx context.Context) UserLoginProfileOutput { 261 return o 262 } 263 264 // The encrypted password, base64 encoded. Only available if password was handled on resource creation, not import. 265 func (o UserLoginProfileOutput) EncryptedPassword() pulumi.StringOutput { 266 return o.ApplyT(func(v *UserLoginProfile) pulumi.StringOutput { return v.EncryptedPassword }).(pulumi.StringOutput) 267 } 268 269 // The fingerprint of the PGP key used to encrypt the password. Only available if password was handled on this provider resource creation, not import. 270 func (o UserLoginProfileOutput) KeyFingerprint() pulumi.StringOutput { 271 return o.ApplyT(func(v *UserLoginProfile) pulumi.StringOutput { return v.KeyFingerprint }).(pulumi.StringOutput) 272 } 273 274 // The plain text password, only available when `pgpKey` is not provided. 275 func (o UserLoginProfileOutput) Password() pulumi.StringOutput { 276 return o.ApplyT(func(v *UserLoginProfile) pulumi.StringOutput { return v.Password }).(pulumi.StringOutput) 277 } 278 279 // The length of the generated password on resource creation. Only applies on resource creation. Drift detection is not possible with this argument. Default value is `20`. 280 func (o UserLoginProfileOutput) PasswordLength() pulumi.IntPtrOutput { 281 return o.ApplyT(func(v *UserLoginProfile) pulumi.IntPtrOutput { return v.PasswordLength }).(pulumi.IntPtrOutput) 282 } 283 284 // Whether the user should be forced to reset the generated password on resource creation. Only applies on resource creation. 285 func (o UserLoginProfileOutput) PasswordResetRequired() pulumi.BoolOutput { 286 return o.ApplyT(func(v *UserLoginProfile) pulumi.BoolOutput { return v.PasswordResetRequired }).(pulumi.BoolOutput) 287 } 288 289 // Either a base-64 encoded PGP public key, or a keybase username in the form `keybase:username`. Only applies on resource creation. Drift detection is not possible with this argument. 290 func (o UserLoginProfileOutput) PgpKey() pulumi.StringPtrOutput { 291 return o.ApplyT(func(v *UserLoginProfile) pulumi.StringPtrOutput { return v.PgpKey }).(pulumi.StringPtrOutput) 292 } 293 294 // The IAM user's name. 295 func (o UserLoginProfileOutput) User() pulumi.StringOutput { 296 return o.ApplyT(func(v *UserLoginProfile) pulumi.StringOutput { return v.User }).(pulumi.StringOutput) 297 } 298 299 type UserLoginProfileArrayOutput struct{ *pulumi.OutputState } 300 301 func (UserLoginProfileArrayOutput) ElementType() reflect.Type { 302 return reflect.TypeOf((*[]*UserLoginProfile)(nil)).Elem() 303 } 304 305 func (o UserLoginProfileArrayOutput) ToUserLoginProfileArrayOutput() UserLoginProfileArrayOutput { 306 return o 307 } 308 309 func (o UserLoginProfileArrayOutput) ToUserLoginProfileArrayOutputWithContext(ctx context.Context) UserLoginProfileArrayOutput { 310 return o 311 } 312 313 func (o UserLoginProfileArrayOutput) Index(i pulumi.IntInput) UserLoginProfileOutput { 314 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *UserLoginProfile { 315 return vs[0].([]*UserLoginProfile)[vs[1].(int)] 316 }).(UserLoginProfileOutput) 317 } 318 319 type UserLoginProfileMapOutput struct{ *pulumi.OutputState } 320 321 func (UserLoginProfileMapOutput) ElementType() reflect.Type { 322 return reflect.TypeOf((*map[string]*UserLoginProfile)(nil)).Elem() 323 } 324 325 func (o UserLoginProfileMapOutput) ToUserLoginProfileMapOutput() UserLoginProfileMapOutput { 326 return o 327 } 328 329 func (o UserLoginProfileMapOutput) ToUserLoginProfileMapOutputWithContext(ctx context.Context) UserLoginProfileMapOutput { 330 return o 331 } 332 333 func (o UserLoginProfileMapOutput) MapIndex(k pulumi.StringInput) UserLoginProfileOutput { 334 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *UserLoginProfile { 335 return vs[0].(map[string]*UserLoginProfile)[vs[1].(string)] 336 }).(UserLoginProfileOutput) 337 } 338 339 func init() { 340 pulumi.RegisterInputType(reflect.TypeOf((*UserLoginProfileInput)(nil)).Elem(), &UserLoginProfile{}) 341 pulumi.RegisterInputType(reflect.TypeOf((*UserLoginProfileArrayInput)(nil)).Elem(), UserLoginProfileArray{}) 342 pulumi.RegisterInputType(reflect.TypeOf((*UserLoginProfileMapInput)(nil)).Elem(), UserLoginProfileMap{}) 343 pulumi.RegisterOutputType(UserLoginProfileOutput{}) 344 pulumi.RegisterOutputType(UserLoginProfileArrayOutput{}) 345 pulumi.RegisterOutputType(UserLoginProfileMapOutput{}) 346 }