github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/iam/virtualMfaDevice.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 // Provides an IAM Virtual MFA Device. 16 // 17 // > **Note:** All attributes will be stored in the raw state as plain-text. 18 // **Note:** A virtual MFA device cannot be directly associated with an IAM User from the provider. 19 // 20 // To associate the virtual MFA device with a user and enable it, use the code returned in either `base32StringSeed` or `qrCodePng` to generate TOTP authentication codes. 21 // The authentication codes can then be used with the AWS CLI command [`aws iam enable-mfa-device`](https://docs.aws.amazon.com/cli/latest/reference/iam/enable-mfa-device.html) or the AWS API call [`EnableMFADevice`](https://docs.aws.amazon.com/IAM/latest/APIReference/API_EnableMFADevice.html). 22 // 23 // ## Example Usage 24 // 25 // **Using certs on file:** 26 // 27 // <!--Start PulumiCodeChooser --> 28 // ```go 29 // package main 30 // 31 // import ( 32 // 33 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam" 34 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 35 // 36 // ) 37 // 38 // func main() { 39 // pulumi.Run(func(ctx *pulumi.Context) error { 40 // _, err := iam.NewVirtualMfaDevice(ctx, "example", &iam.VirtualMfaDeviceArgs{ 41 // VirtualMfaDeviceName: pulumi.String("example"), 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 Virtual MFA Devices using the `arn`. For example: 56 // 57 // ```sh 58 // $ pulumi import aws:iam/virtualMfaDevice:VirtualMfaDevice example arn:aws:iam::123456789012:mfa/example 59 // ``` 60 type VirtualMfaDevice struct { 61 pulumi.CustomResourceState 62 63 // The Amazon Resource Name (ARN) specifying the virtual mfa device. 64 Arn pulumi.StringOutput `pulumi:"arn"` 65 // The base32 seed defined as specified in [RFC3548](https://tools.ietf.org/html/rfc3548.txt). The `base32StringSeed` is base64-encoded. 66 Base32StringSeed pulumi.StringOutput `pulumi:"base32StringSeed"` 67 // The date and time when the virtual MFA device was enabled. 68 EnableDate pulumi.StringOutput `pulumi:"enableDate"` 69 // The path for the virtual MFA device. 70 Path pulumi.StringPtrOutput `pulumi:"path"` 71 // A QR code PNG image that encodes `otpauth://totp/$virtualMFADeviceName@$AccountName?secret=$Base32String` where `$virtualMFADeviceName` is one of the create call arguments. AccountName is the user name if set (otherwise, the account ID), and Base32String is the seed in base32 format. 72 QrCodePng pulumi.StringOutput `pulumi:"qrCodePng"` 73 // Map of resource tags for the virtual mfa device. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 74 Tags pulumi.StringMapOutput `pulumi:"tags"` 75 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 76 // 77 // Deprecated: Please use `tags` instead. 78 TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"` 79 // The associated IAM User name if the virtual MFA device is enabled. 80 UserName pulumi.StringOutput `pulumi:"userName"` 81 // The name of the virtual MFA device. Use with path to uniquely identify a virtual MFA device. 82 VirtualMfaDeviceName pulumi.StringOutput `pulumi:"virtualMfaDeviceName"` 83 } 84 85 // NewVirtualMfaDevice registers a new resource with the given unique name, arguments, and options. 86 func NewVirtualMfaDevice(ctx *pulumi.Context, 87 name string, args *VirtualMfaDeviceArgs, opts ...pulumi.ResourceOption) (*VirtualMfaDevice, error) { 88 if args == nil { 89 return nil, errors.New("missing one or more required arguments") 90 } 91 92 if args.VirtualMfaDeviceName == nil { 93 return nil, errors.New("invalid value for required argument 'VirtualMfaDeviceName'") 94 } 95 opts = internal.PkgResourceDefaultOpts(opts) 96 var resource VirtualMfaDevice 97 err := ctx.RegisterResource("aws:iam/virtualMfaDevice:VirtualMfaDevice", name, args, &resource, opts...) 98 if err != nil { 99 return nil, err 100 } 101 return &resource, nil 102 } 103 104 // GetVirtualMfaDevice gets an existing VirtualMfaDevice resource's state with the given name, ID, and optional 105 // state properties that are used to uniquely qualify the lookup (nil if not required). 106 func GetVirtualMfaDevice(ctx *pulumi.Context, 107 name string, id pulumi.IDInput, state *VirtualMfaDeviceState, opts ...pulumi.ResourceOption) (*VirtualMfaDevice, error) { 108 var resource VirtualMfaDevice 109 err := ctx.ReadResource("aws:iam/virtualMfaDevice:VirtualMfaDevice", name, id, state, &resource, opts...) 110 if err != nil { 111 return nil, err 112 } 113 return &resource, nil 114 } 115 116 // Input properties used for looking up and filtering VirtualMfaDevice resources. 117 type virtualMfaDeviceState struct { 118 // The Amazon Resource Name (ARN) specifying the virtual mfa device. 119 Arn *string `pulumi:"arn"` 120 // The base32 seed defined as specified in [RFC3548](https://tools.ietf.org/html/rfc3548.txt). The `base32StringSeed` is base64-encoded. 121 Base32StringSeed *string `pulumi:"base32StringSeed"` 122 // The date and time when the virtual MFA device was enabled. 123 EnableDate *string `pulumi:"enableDate"` 124 // The path for the virtual MFA device. 125 Path *string `pulumi:"path"` 126 // A QR code PNG image that encodes `otpauth://totp/$virtualMFADeviceName@$AccountName?secret=$Base32String` where `$virtualMFADeviceName` is one of the create call arguments. AccountName is the user name if set (otherwise, the account ID), and Base32String is the seed in base32 format. 127 QrCodePng *string `pulumi:"qrCodePng"` 128 // Map of resource tags for the virtual mfa device. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 129 Tags map[string]string `pulumi:"tags"` 130 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 131 // 132 // Deprecated: Please use `tags` instead. 133 TagsAll map[string]string `pulumi:"tagsAll"` 134 // The associated IAM User name if the virtual MFA device is enabled. 135 UserName *string `pulumi:"userName"` 136 // The name of the virtual MFA device. Use with path to uniquely identify a virtual MFA device. 137 VirtualMfaDeviceName *string `pulumi:"virtualMfaDeviceName"` 138 } 139 140 type VirtualMfaDeviceState struct { 141 // The Amazon Resource Name (ARN) specifying the virtual mfa device. 142 Arn pulumi.StringPtrInput 143 // The base32 seed defined as specified in [RFC3548](https://tools.ietf.org/html/rfc3548.txt). The `base32StringSeed` is base64-encoded. 144 Base32StringSeed pulumi.StringPtrInput 145 // The date and time when the virtual MFA device was enabled. 146 EnableDate pulumi.StringPtrInput 147 // The path for the virtual MFA device. 148 Path pulumi.StringPtrInput 149 // A QR code PNG image that encodes `otpauth://totp/$virtualMFADeviceName@$AccountName?secret=$Base32String` where `$virtualMFADeviceName` is one of the create call arguments. AccountName is the user name if set (otherwise, the account ID), and Base32String is the seed in base32 format. 150 QrCodePng pulumi.StringPtrInput 151 // Map of resource tags for the virtual mfa device. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 152 Tags pulumi.StringMapInput 153 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 154 // 155 // Deprecated: Please use `tags` instead. 156 TagsAll pulumi.StringMapInput 157 // The associated IAM User name if the virtual MFA device is enabled. 158 UserName pulumi.StringPtrInput 159 // The name of the virtual MFA device. Use with path to uniquely identify a virtual MFA device. 160 VirtualMfaDeviceName pulumi.StringPtrInput 161 } 162 163 func (VirtualMfaDeviceState) ElementType() reflect.Type { 164 return reflect.TypeOf((*virtualMfaDeviceState)(nil)).Elem() 165 } 166 167 type virtualMfaDeviceArgs struct { 168 // The path for the virtual MFA device. 169 Path *string `pulumi:"path"` 170 // Map of resource tags for the virtual mfa device. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 171 Tags map[string]string `pulumi:"tags"` 172 // The name of the virtual MFA device. Use with path to uniquely identify a virtual MFA device. 173 VirtualMfaDeviceName string `pulumi:"virtualMfaDeviceName"` 174 } 175 176 // The set of arguments for constructing a VirtualMfaDevice resource. 177 type VirtualMfaDeviceArgs struct { 178 // The path for the virtual MFA device. 179 Path pulumi.StringPtrInput 180 // Map of resource tags for the virtual mfa device. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 181 Tags pulumi.StringMapInput 182 // The name of the virtual MFA device. Use with path to uniquely identify a virtual MFA device. 183 VirtualMfaDeviceName pulumi.StringInput 184 } 185 186 func (VirtualMfaDeviceArgs) ElementType() reflect.Type { 187 return reflect.TypeOf((*virtualMfaDeviceArgs)(nil)).Elem() 188 } 189 190 type VirtualMfaDeviceInput interface { 191 pulumi.Input 192 193 ToVirtualMfaDeviceOutput() VirtualMfaDeviceOutput 194 ToVirtualMfaDeviceOutputWithContext(ctx context.Context) VirtualMfaDeviceOutput 195 } 196 197 func (*VirtualMfaDevice) ElementType() reflect.Type { 198 return reflect.TypeOf((**VirtualMfaDevice)(nil)).Elem() 199 } 200 201 func (i *VirtualMfaDevice) ToVirtualMfaDeviceOutput() VirtualMfaDeviceOutput { 202 return i.ToVirtualMfaDeviceOutputWithContext(context.Background()) 203 } 204 205 func (i *VirtualMfaDevice) ToVirtualMfaDeviceOutputWithContext(ctx context.Context) VirtualMfaDeviceOutput { 206 return pulumi.ToOutputWithContext(ctx, i).(VirtualMfaDeviceOutput) 207 } 208 209 // VirtualMfaDeviceArrayInput is an input type that accepts VirtualMfaDeviceArray and VirtualMfaDeviceArrayOutput values. 210 // You can construct a concrete instance of `VirtualMfaDeviceArrayInput` via: 211 // 212 // VirtualMfaDeviceArray{ VirtualMfaDeviceArgs{...} } 213 type VirtualMfaDeviceArrayInput interface { 214 pulumi.Input 215 216 ToVirtualMfaDeviceArrayOutput() VirtualMfaDeviceArrayOutput 217 ToVirtualMfaDeviceArrayOutputWithContext(context.Context) VirtualMfaDeviceArrayOutput 218 } 219 220 type VirtualMfaDeviceArray []VirtualMfaDeviceInput 221 222 func (VirtualMfaDeviceArray) ElementType() reflect.Type { 223 return reflect.TypeOf((*[]*VirtualMfaDevice)(nil)).Elem() 224 } 225 226 func (i VirtualMfaDeviceArray) ToVirtualMfaDeviceArrayOutput() VirtualMfaDeviceArrayOutput { 227 return i.ToVirtualMfaDeviceArrayOutputWithContext(context.Background()) 228 } 229 230 func (i VirtualMfaDeviceArray) ToVirtualMfaDeviceArrayOutputWithContext(ctx context.Context) VirtualMfaDeviceArrayOutput { 231 return pulumi.ToOutputWithContext(ctx, i).(VirtualMfaDeviceArrayOutput) 232 } 233 234 // VirtualMfaDeviceMapInput is an input type that accepts VirtualMfaDeviceMap and VirtualMfaDeviceMapOutput values. 235 // You can construct a concrete instance of `VirtualMfaDeviceMapInput` via: 236 // 237 // VirtualMfaDeviceMap{ "key": VirtualMfaDeviceArgs{...} } 238 type VirtualMfaDeviceMapInput interface { 239 pulumi.Input 240 241 ToVirtualMfaDeviceMapOutput() VirtualMfaDeviceMapOutput 242 ToVirtualMfaDeviceMapOutputWithContext(context.Context) VirtualMfaDeviceMapOutput 243 } 244 245 type VirtualMfaDeviceMap map[string]VirtualMfaDeviceInput 246 247 func (VirtualMfaDeviceMap) ElementType() reflect.Type { 248 return reflect.TypeOf((*map[string]*VirtualMfaDevice)(nil)).Elem() 249 } 250 251 func (i VirtualMfaDeviceMap) ToVirtualMfaDeviceMapOutput() VirtualMfaDeviceMapOutput { 252 return i.ToVirtualMfaDeviceMapOutputWithContext(context.Background()) 253 } 254 255 func (i VirtualMfaDeviceMap) ToVirtualMfaDeviceMapOutputWithContext(ctx context.Context) VirtualMfaDeviceMapOutput { 256 return pulumi.ToOutputWithContext(ctx, i).(VirtualMfaDeviceMapOutput) 257 } 258 259 type VirtualMfaDeviceOutput struct{ *pulumi.OutputState } 260 261 func (VirtualMfaDeviceOutput) ElementType() reflect.Type { 262 return reflect.TypeOf((**VirtualMfaDevice)(nil)).Elem() 263 } 264 265 func (o VirtualMfaDeviceOutput) ToVirtualMfaDeviceOutput() VirtualMfaDeviceOutput { 266 return o 267 } 268 269 func (o VirtualMfaDeviceOutput) ToVirtualMfaDeviceOutputWithContext(ctx context.Context) VirtualMfaDeviceOutput { 270 return o 271 } 272 273 // The Amazon Resource Name (ARN) specifying the virtual mfa device. 274 func (o VirtualMfaDeviceOutput) Arn() pulumi.StringOutput { 275 return o.ApplyT(func(v *VirtualMfaDevice) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput) 276 } 277 278 // The base32 seed defined as specified in [RFC3548](https://tools.ietf.org/html/rfc3548.txt). The `base32StringSeed` is base64-encoded. 279 func (o VirtualMfaDeviceOutput) Base32StringSeed() pulumi.StringOutput { 280 return o.ApplyT(func(v *VirtualMfaDevice) pulumi.StringOutput { return v.Base32StringSeed }).(pulumi.StringOutput) 281 } 282 283 // The date and time when the virtual MFA device was enabled. 284 func (o VirtualMfaDeviceOutput) EnableDate() pulumi.StringOutput { 285 return o.ApplyT(func(v *VirtualMfaDevice) pulumi.StringOutput { return v.EnableDate }).(pulumi.StringOutput) 286 } 287 288 // The path for the virtual MFA device. 289 func (o VirtualMfaDeviceOutput) Path() pulumi.StringPtrOutput { 290 return o.ApplyT(func(v *VirtualMfaDevice) pulumi.StringPtrOutput { return v.Path }).(pulumi.StringPtrOutput) 291 } 292 293 // A QR code PNG image that encodes `otpauth://totp/$virtualMFADeviceName@$AccountName?secret=$Base32String` where `$virtualMFADeviceName` is one of the create call arguments. AccountName is the user name if set (otherwise, the account ID), and Base32String is the seed in base32 format. 294 func (o VirtualMfaDeviceOutput) QrCodePng() pulumi.StringOutput { 295 return o.ApplyT(func(v *VirtualMfaDevice) pulumi.StringOutput { return v.QrCodePng }).(pulumi.StringOutput) 296 } 297 298 // Map of resource tags for the virtual mfa device. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 299 func (o VirtualMfaDeviceOutput) Tags() pulumi.StringMapOutput { 300 return o.ApplyT(func(v *VirtualMfaDevice) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput) 301 } 302 303 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 304 // 305 // Deprecated: Please use `tags` instead. 306 func (o VirtualMfaDeviceOutput) TagsAll() pulumi.StringMapOutput { 307 return o.ApplyT(func(v *VirtualMfaDevice) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput) 308 } 309 310 // The associated IAM User name if the virtual MFA device is enabled. 311 func (o VirtualMfaDeviceOutput) UserName() pulumi.StringOutput { 312 return o.ApplyT(func(v *VirtualMfaDevice) pulumi.StringOutput { return v.UserName }).(pulumi.StringOutput) 313 } 314 315 // The name of the virtual MFA device. Use with path to uniquely identify a virtual MFA device. 316 func (o VirtualMfaDeviceOutput) VirtualMfaDeviceName() pulumi.StringOutput { 317 return o.ApplyT(func(v *VirtualMfaDevice) pulumi.StringOutput { return v.VirtualMfaDeviceName }).(pulumi.StringOutput) 318 } 319 320 type VirtualMfaDeviceArrayOutput struct{ *pulumi.OutputState } 321 322 func (VirtualMfaDeviceArrayOutput) ElementType() reflect.Type { 323 return reflect.TypeOf((*[]*VirtualMfaDevice)(nil)).Elem() 324 } 325 326 func (o VirtualMfaDeviceArrayOutput) ToVirtualMfaDeviceArrayOutput() VirtualMfaDeviceArrayOutput { 327 return o 328 } 329 330 func (o VirtualMfaDeviceArrayOutput) ToVirtualMfaDeviceArrayOutputWithContext(ctx context.Context) VirtualMfaDeviceArrayOutput { 331 return o 332 } 333 334 func (o VirtualMfaDeviceArrayOutput) Index(i pulumi.IntInput) VirtualMfaDeviceOutput { 335 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *VirtualMfaDevice { 336 return vs[0].([]*VirtualMfaDevice)[vs[1].(int)] 337 }).(VirtualMfaDeviceOutput) 338 } 339 340 type VirtualMfaDeviceMapOutput struct{ *pulumi.OutputState } 341 342 func (VirtualMfaDeviceMapOutput) ElementType() reflect.Type { 343 return reflect.TypeOf((*map[string]*VirtualMfaDevice)(nil)).Elem() 344 } 345 346 func (o VirtualMfaDeviceMapOutput) ToVirtualMfaDeviceMapOutput() VirtualMfaDeviceMapOutput { 347 return o 348 } 349 350 func (o VirtualMfaDeviceMapOutput) ToVirtualMfaDeviceMapOutputWithContext(ctx context.Context) VirtualMfaDeviceMapOutput { 351 return o 352 } 353 354 func (o VirtualMfaDeviceMapOutput) MapIndex(k pulumi.StringInput) VirtualMfaDeviceOutput { 355 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *VirtualMfaDevice { 356 return vs[0].(map[string]*VirtualMfaDevice)[vs[1].(string)] 357 }).(VirtualMfaDeviceOutput) 358 } 359 360 func init() { 361 pulumi.RegisterInputType(reflect.TypeOf((*VirtualMfaDeviceInput)(nil)).Elem(), &VirtualMfaDevice{}) 362 pulumi.RegisterInputType(reflect.TypeOf((*VirtualMfaDeviceArrayInput)(nil)).Elem(), VirtualMfaDeviceArray{}) 363 pulumi.RegisterInputType(reflect.TypeOf((*VirtualMfaDeviceMapInput)(nil)).Elem(), VirtualMfaDeviceMap{}) 364 pulumi.RegisterOutputType(VirtualMfaDeviceOutput{}) 365 pulumi.RegisterOutputType(VirtualMfaDeviceArrayOutput{}) 366 pulumi.RegisterOutputType(VirtualMfaDeviceMapOutput{}) 367 }