1. Packages
  2. AWS
  3. API Docs
  4. iam
  5. VirtualMfaDevice
AWS v6.77.0 published on Wednesday, Apr 9, 2025 by Pulumi

aws.iam.VirtualMfaDevice

Explore with Pulumi AI

Provides an IAM Virtual MFA Device.

Note: All attributes will be stored in the raw state as plain-text. Note: A virtual MFA device cannot be directly associated with an IAM User from the provider. To associate the virtual MFA device with a user and enable it, use the code returned in either base_32_string_seed or qr_code_png to generate TOTP authentication codes. The authentication codes can then be used with the AWS CLI command aws iam enable-mfa-device or the AWS API call EnableMFADevice.

Example Usage

Using certs on file:

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const example = new aws.iam.VirtualMfaDevice("example", {virtualMfaDeviceName: "example"});
Copy
import pulumi
import pulumi_aws as aws

example = aws.iam.VirtualMfaDevice("example", virtual_mfa_device_name="example")
Copy
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := iam.NewVirtualMfaDevice(ctx, "example", &iam.VirtualMfaDeviceArgs{
			VirtualMfaDeviceName: pulumi.String("example"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var example = new Aws.Iam.VirtualMfaDevice("example", new()
    {
        VirtualMfaDeviceName = "example",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.iam.VirtualMfaDevice;
import com.pulumi.aws.iam.VirtualMfaDeviceArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var example = new VirtualMfaDevice("example", VirtualMfaDeviceArgs.builder()
            .virtualMfaDeviceName("example")
            .build());

    }
}
Copy
resources:
  example:
    type: aws:iam:VirtualMfaDevice
    properties:
      virtualMfaDeviceName: example
Copy

Create VirtualMfaDevice Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new VirtualMfaDevice(name: string, args: VirtualMfaDeviceArgs, opts?: CustomResourceOptions);
@overload
def VirtualMfaDevice(resource_name: str,
                     args: VirtualMfaDeviceArgs,
                     opts: Optional[ResourceOptions] = None)

@overload
def VirtualMfaDevice(resource_name: str,
                     opts: Optional[ResourceOptions] = None,
                     virtual_mfa_device_name: Optional[str] = None,
                     path: Optional[str] = None,
                     tags: Optional[Mapping[str, str]] = None)
func NewVirtualMfaDevice(ctx *Context, name string, args VirtualMfaDeviceArgs, opts ...ResourceOption) (*VirtualMfaDevice, error)
public VirtualMfaDevice(string name, VirtualMfaDeviceArgs args, CustomResourceOptions? opts = null)
public VirtualMfaDevice(String name, VirtualMfaDeviceArgs args)
public VirtualMfaDevice(String name, VirtualMfaDeviceArgs args, CustomResourceOptions options)
type: aws:iam:VirtualMfaDevice
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. VirtualMfaDeviceArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. VirtualMfaDeviceArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. VirtualMfaDeviceArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. VirtualMfaDeviceArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. VirtualMfaDeviceArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var virtualMfaDeviceResource = new Aws.Iam.VirtualMfaDevice("virtualMfaDeviceResource", new()
{
    VirtualMfaDeviceName = "string",
    Path = "string",
    Tags = 
    {
        { "string", "string" },
    },
});
Copy
example, err := iam.NewVirtualMfaDevice(ctx, "virtualMfaDeviceResource", &iam.VirtualMfaDeviceArgs{
	VirtualMfaDeviceName: pulumi.String("string"),
	Path:                 pulumi.String("string"),
	Tags: pulumi.StringMap{
		"string": pulumi.String("string"),
	},
})
Copy
var virtualMfaDeviceResource = new VirtualMfaDevice("virtualMfaDeviceResource", VirtualMfaDeviceArgs.builder()
    .virtualMfaDeviceName("string")
    .path("string")
    .tags(Map.of("string", "string"))
    .build());
Copy
virtual_mfa_device_resource = aws.iam.VirtualMfaDevice("virtualMfaDeviceResource",
    virtual_mfa_device_name="string",
    path="string",
    tags={
        "string": "string",
    })
Copy
const virtualMfaDeviceResource = new aws.iam.VirtualMfaDevice("virtualMfaDeviceResource", {
    virtualMfaDeviceName: "string",
    path: "string",
    tags: {
        string: "string",
    },
});
Copy
type: aws:iam:VirtualMfaDevice
properties:
    path: string
    tags:
        string: string
    virtualMfaDeviceName: string
Copy

VirtualMfaDevice Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The VirtualMfaDevice resource accepts the following input properties:

VirtualMfaDeviceName
This property is required.
Changes to this property will trigger replacement.
string
The name of the virtual MFA device. Use with path to uniquely identify a virtual MFA device.
Path Changes to this property will trigger replacement. string
The path for the virtual MFA device.
Tags Dictionary<string, string>
Map of resource tags for the virtual mfa device. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
VirtualMfaDeviceName
This property is required.
Changes to this property will trigger replacement.
string
The name of the virtual MFA device. Use with path to uniquely identify a virtual MFA device.
Path Changes to this property will trigger replacement. string
The path for the virtual MFA device.
Tags map[string]string
Map of resource tags for the virtual mfa device. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
virtualMfaDeviceName
This property is required.
Changes to this property will trigger replacement.
String
The name of the virtual MFA device. Use with path to uniquely identify a virtual MFA device.
path Changes to this property will trigger replacement. String
The path for the virtual MFA device.
tags Map<String,String>
Map of resource tags for the virtual mfa device. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
virtualMfaDeviceName
This property is required.
Changes to this property will trigger replacement.
string
The name of the virtual MFA device. Use with path to uniquely identify a virtual MFA device.
path Changes to this property will trigger replacement. string
The path for the virtual MFA device.
tags {[key: string]: string}
Map of resource tags for the virtual mfa device. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
virtual_mfa_device_name
This property is required.
Changes to this property will trigger replacement.
str
The name of the virtual MFA device. Use with path to uniquely identify a virtual MFA device.
path Changes to this property will trigger replacement. str
The path for the virtual MFA device.
tags Mapping[str, str]
Map of resource tags for the virtual mfa device. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
virtualMfaDeviceName
This property is required.
Changes to this property will trigger replacement.
String
The name of the virtual MFA device. Use with path to uniquely identify a virtual MFA device.
path Changes to this property will trigger replacement. String
The path for the virtual MFA device.
tags Map<String>
Map of resource tags for the virtual mfa device. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

Outputs

All input properties are implicitly available as output properties. Additionally, the VirtualMfaDevice resource produces the following output properties:

Arn string
The Amazon Resource Name (ARN) specifying the virtual mfa device.
Base32StringSeed string
The base32 seed defined as specified in RFC3548. The base_32_string_seed is base64-encoded.
EnableDate string
The date and time when the virtual MFA device was enabled.
Id string
The provider-assigned unique ID for this managed resource.
QrCodePng string
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.
TagsAll Dictionary<string, string>
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

UserName string
The associated IAM User name if the virtual MFA device is enabled.
Arn string
The Amazon Resource Name (ARN) specifying the virtual mfa device.
Base32StringSeed string
The base32 seed defined as specified in RFC3548. The base_32_string_seed is base64-encoded.
EnableDate string
The date and time when the virtual MFA device was enabled.
Id string
The provider-assigned unique ID for this managed resource.
QrCodePng string
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.
TagsAll map[string]string
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

UserName string
The associated IAM User name if the virtual MFA device is enabled.
arn String
The Amazon Resource Name (ARN) specifying the virtual mfa device.
base32StringSeed String
The base32 seed defined as specified in RFC3548. The base_32_string_seed is base64-encoded.
enableDate String
The date and time when the virtual MFA device was enabled.
id String
The provider-assigned unique ID for this managed resource.
qrCodePng String
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.
tagsAll Map<String,String>
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

userName String
The associated IAM User name if the virtual MFA device is enabled.
arn string
The Amazon Resource Name (ARN) specifying the virtual mfa device.
base32StringSeed string
The base32 seed defined as specified in RFC3548. The base_32_string_seed is base64-encoded.
enableDate string
The date and time when the virtual MFA device was enabled.
id string
The provider-assigned unique ID for this managed resource.
qrCodePng string
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.
tagsAll {[key: string]: string}
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

userName string
The associated IAM User name if the virtual MFA device is enabled.
arn str
The Amazon Resource Name (ARN) specifying the virtual mfa device.
base32_string_seed str
The base32 seed defined as specified in RFC3548. The base_32_string_seed is base64-encoded.
enable_date str
The date and time when the virtual MFA device was enabled.
id str
The provider-assigned unique ID for this managed resource.
qr_code_png str
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.
tags_all Mapping[str, str]
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

user_name str
The associated IAM User name if the virtual MFA device is enabled.
arn String
The Amazon Resource Name (ARN) specifying the virtual mfa device.
base32StringSeed String
The base32 seed defined as specified in RFC3548. The base_32_string_seed is base64-encoded.
enableDate String
The date and time when the virtual MFA device was enabled.
id String
The provider-assigned unique ID for this managed resource.
qrCodePng String
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.
tagsAll Map<String>
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

userName String
The associated IAM User name if the virtual MFA device is enabled.

Look up Existing VirtualMfaDevice Resource

Get an existing VirtualMfaDevice resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: VirtualMfaDeviceState, opts?: CustomResourceOptions): VirtualMfaDevice
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        arn: Optional[str] = None,
        base32_string_seed: Optional[str] = None,
        enable_date: Optional[str] = None,
        path: Optional[str] = None,
        qr_code_png: Optional[str] = None,
        tags: Optional[Mapping[str, str]] = None,
        tags_all: Optional[Mapping[str, str]] = None,
        user_name: Optional[str] = None,
        virtual_mfa_device_name: Optional[str] = None) -> VirtualMfaDevice
func GetVirtualMfaDevice(ctx *Context, name string, id IDInput, state *VirtualMfaDeviceState, opts ...ResourceOption) (*VirtualMfaDevice, error)
public static VirtualMfaDevice Get(string name, Input<string> id, VirtualMfaDeviceState? state, CustomResourceOptions? opts = null)
public static VirtualMfaDevice get(String name, Output<String> id, VirtualMfaDeviceState state, CustomResourceOptions options)
resources:  _:    type: aws:iam:VirtualMfaDevice    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
Arn string
The Amazon Resource Name (ARN) specifying the virtual mfa device.
Base32StringSeed string
The base32 seed defined as specified in RFC3548. The base_32_string_seed is base64-encoded.
EnableDate string
The date and time when the virtual MFA device was enabled.
Path Changes to this property will trigger replacement. string
The path for the virtual MFA device.
QrCodePng string
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.
Tags Dictionary<string, string>
Map of resource tags for the virtual mfa device. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
TagsAll Dictionary<string, string>
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

UserName string
The associated IAM User name if the virtual MFA device is enabled.
VirtualMfaDeviceName Changes to this property will trigger replacement. string
The name of the virtual MFA device. Use with path to uniquely identify a virtual MFA device.
Arn string
The Amazon Resource Name (ARN) specifying the virtual mfa device.
Base32StringSeed string
The base32 seed defined as specified in RFC3548. The base_32_string_seed is base64-encoded.
EnableDate string
The date and time when the virtual MFA device was enabled.
Path Changes to this property will trigger replacement. string
The path for the virtual MFA device.
QrCodePng string
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.
Tags map[string]string
Map of resource tags for the virtual mfa device. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
TagsAll map[string]string
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

UserName string
The associated IAM User name if the virtual MFA device is enabled.
VirtualMfaDeviceName Changes to this property will trigger replacement. string
The name of the virtual MFA device. Use with path to uniquely identify a virtual MFA device.
arn String
The Amazon Resource Name (ARN) specifying the virtual mfa device.
base32StringSeed String
The base32 seed defined as specified in RFC3548. The base_32_string_seed is base64-encoded.
enableDate String
The date and time when the virtual MFA device was enabled.
path Changes to this property will trigger replacement. String
The path for the virtual MFA device.
qrCodePng String
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.
tags Map<String,String>
Map of resource tags for the virtual mfa device. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
tagsAll Map<String,String>
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

userName String
The associated IAM User name if the virtual MFA device is enabled.
virtualMfaDeviceName Changes to this property will trigger replacement. String
The name of the virtual MFA device. Use with path to uniquely identify a virtual MFA device.
arn string
The Amazon Resource Name (ARN) specifying the virtual mfa device.
base32StringSeed string
The base32 seed defined as specified in RFC3548. The base_32_string_seed is base64-encoded.
enableDate string
The date and time when the virtual MFA device was enabled.
path Changes to this property will trigger replacement. string
The path for the virtual MFA device.
qrCodePng string
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.
tags {[key: string]: string}
Map of resource tags for the virtual mfa device. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
tagsAll {[key: string]: string}
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

userName string
The associated IAM User name if the virtual MFA device is enabled.
virtualMfaDeviceName Changes to this property will trigger replacement. string
The name of the virtual MFA device. Use with path to uniquely identify a virtual MFA device.
arn str
The Amazon Resource Name (ARN) specifying the virtual mfa device.
base32_string_seed str
The base32 seed defined as specified in RFC3548. The base_32_string_seed is base64-encoded.
enable_date str
The date and time when the virtual MFA device was enabled.
path Changes to this property will trigger replacement. str
The path for the virtual MFA device.
qr_code_png str
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.
tags Mapping[str, str]
Map of resource tags for the virtual mfa device. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
tags_all Mapping[str, str]
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

user_name str
The associated IAM User name if the virtual MFA device is enabled.
virtual_mfa_device_name Changes to this property will trigger replacement. str
The name of the virtual MFA device. Use with path to uniquely identify a virtual MFA device.
arn String
The Amazon Resource Name (ARN) specifying the virtual mfa device.
base32StringSeed String
The base32 seed defined as specified in RFC3548. The base_32_string_seed is base64-encoded.
enableDate String
The date and time when the virtual MFA device was enabled.
path Changes to this property will trigger replacement. String
The path for the virtual MFA device.
qrCodePng String
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.
tags Map<String>
Map of resource tags for the virtual mfa device. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
tagsAll Map<String>
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

userName String
The associated IAM User name if the virtual MFA device is enabled.
virtualMfaDeviceName Changes to this property will trigger replacement. String
The name of the virtual MFA device. Use with path to uniquely identify a virtual MFA device.

Import

Using pulumi import, import IAM Virtual MFA Devices using the arn. For example:

$ pulumi import aws:iam/virtualMfaDevice:VirtualMfaDevice example arn:aws:iam::123456789012:mfa/example
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
AWS Classic pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.