UserLoginProfile class

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.

> To reset an IAM User login password via this provider, you can use delete and recreate this resource or change any of the arguments.

Example Usage

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

const example = new aws.iam.User("example", {
    name: "example",
    path: "/",
    forceDestroy: true,
});
const exampleUserLoginProfile = new aws.iam.UserLoginProfile("example", {
    user: example.name,
    pgpKey: "keybase:some_person_that_exists",
});
export const password = exampleUserLoginProfile.encryptedPassword;
import pulumi
import pulumi_aws as aws

example = aws.iam.User("example",
    name="example",
    path="/",
    force_destroy=True)
example_user_login_profile = aws.iam.UserLoginProfile("example",
    user=example.name,
    pgp_key="keybase:some_person_that_exists")
pulumi.export("password", example_user_login_profile.encrypted_password)
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() =>
{
    var example = new Aws.Iam.User("example", new()
    {
        Name = "example",
        Path = "/",
        ForceDestroy = true,
    });

    var exampleUserLoginProfile = new Aws.Iam.UserLoginProfile("example", new()
    {
        User = example.Name,
        PgpKey = "keybase:some_person_that_exists",
    });

    return new Dictionary<string, object?>
    {
        ["password"] = exampleUserLoginProfile.EncryptedPassword,
    };
});
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		example, err := iam.NewUser(ctx, "example", &iam.UserArgs{
			Name:         pulumi.String("example"),
			Path:         pulumi.String("/"),
			ForceDestroy: pulumi.Bool(true),
		})
		if err != nil {
			return err
		}
		exampleUserLoginProfile, err := iam.NewUserLoginProfile(ctx, "example", &iam.UserLoginProfileArgs{
			User:   example.Name,
			PgpKey: pulumi.String("keybase:some_person_that_exists"),
		})
		if err != nil {
			return err
		}
		ctx.Export("password", exampleUserLoginProfile.EncryptedPassword)
		return nil
	})
}
pulumi {
  required_providers {
    aws = {
      source = "pulumi/aws"
    }
  }
}

resource "aws_iam_user" "example" {
  name          = "example"
  path          = "/"
  force_destroy = true
}
resource "aws_iam_userloginprofile" "example" {
  user    = aws_iam_user.example.name
  pgp_key = "keybase:some_person_that_exists"
}
output "password" {
  value = aws_iam_userloginprofile.example.encrypted_password
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.iam.User;
import com.pulumi.aws.iam.UserArgs;
import com.pulumi.aws.iam.UserLoginProfile;
import com.pulumi.aws.iam.UserLoginProfileArgs;
import java.util.ArrayList;
import java.util.Arrays;
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 User("example", UserArgs.builder()
            .name("example")
            .path("/")
            .forceDestroy(true)
            .build());

        var exampleUserLoginProfile = new UserLoginProfile("exampleUserLoginProfile", UserLoginProfileArgs.builder()
            .user(example.name())
            .pgpKey("keybase:some_person_that_exists")
            .build());

        ctx.export("password", exampleUserLoginProfile.encryptedPassword());
    }
}
resources:
  example:
    type: aws:iam:User
    properties:
      name: example
      path: /
      forceDestroy: true
  exampleUserLoginProfile:
    type: aws:iam:UserLoginProfile
    name: example
    properties:
      user: ${example.name}
      pgpKey: keybase:some_person_that_exists
outputs:
  password: ${exampleUserLoginProfile.encryptedPassword}

Import

Using pulumi import, import IAM User Login Profiles without password information via the IAM User name. For example:

$ pulumi import aws:iam/userLoginProfile:UserLoginProfile example myusername

Since Pulumi has no method to read the PGP or password information during import, use the resource options ignoreChanges argument to ignore them (unless you want to recreate a password). For example:

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

const example = new aws.iam.UserLoginProfile("example", {}, {
    ignoreChanges: [
        "passwordLength",
        "passwordResetRequired",
        "pgpKey",
    ],
});
import pulumi
import pulumi_aws as aws

example = aws.iam.UserLoginProfile("example", opts = pulumi.ResourceOptions(ignore_changes=[
        "passwordLength",
        "passwordResetRequired",
        "pgpKey",
    ]))
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() =>
{
    var example = new Aws.Iam.UserLoginProfile("example", new()
    {
    }, new CustomResourceOptions
    {
        IgnoreChanges =
        {
            "passwordLength",
            "passwordResetRequired",
            "pgpKey",
        },
    });

});
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := iam.NewUserLoginProfile(ctx, "example", nil, pulumi.IgnoreChanges([]string{
			"passwordLength",
			"passwordResetRequired",
			"pgpKey",
		}))
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    aws = {
      source = "pulumi/aws"
    }
  }
}

resource "aws_iam_userloginprofile" "example" {
  lifecycle {
    ignore_changes = [passwordLength, passwordResetRequired, pgpKey]
  }
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.iam.UserLoginProfile;
import com.pulumi.aws.iam.UserLoginProfileArgs;
import com.pulumi.resources.CustomResourceOptions;
import java.util.ArrayList;
import java.util.Arrays;
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 UserLoginProfile("example", UserLoginProfileArgs.Empty, CustomResourceOptions.builder()
            .ignoreChanges("passwordLength", "passwordResetRequired", "pgpKey")
            .build());

    }
}
resources:
  example:
    type: aws:iam:UserLoginProfile
    options:
      ignoreChanges:
        - passwordLength
        - passwordResetRequired
        - pgpKey

Constructors

UserLoginProfile(String name, {UserLoginProfileArgs? args, CustomResourceOptions? options})
Creates a new UserLoginProfile. name The Pulumi resource name. args Arguments used to configure this UserLoginProfile. The set of arguments for UserLoginProfile. options Resource options controlling this resource's behavior.
UserLoginProfile.reference(String urn)
Creates a typed reference to an existing UserLoginProfile resource.

Properties

childResources → Set<Resource>
finalinherited
completionSources ↔ Map<String, IOutputCompletionSource>
latefinalinherited
encryptedPassword ↔ Output<String>
The encrypted password, base64 encoded. Only available if password was handled on resource creation, not import.
latefinal
hashCode → int
The hash code for this object.
no setterinherited
id ↔ Output<String>
getter/setter pairinherited
isCustom → bool
Returns whether this resource is provider-managed.
no setterinherited
isProtected → bool
Returns whether this resource is protected from deletion.
no setterinherited
isRemote → bool
Whether this resource is registered as remote.
no setterinherited
isResourceReference → bool
Whether this instance represents a resource value returned over RPC.
finalinherited
keyFingerprint ↔ Output<String>
The fingerprint of the PGP key used to encrypt the password. Only available if password was handled on this provider resource creation, not import.
latefinal
password ↔ Output<String>
The plain text password, only available when pgpKey is not provided.
latefinal
passwordLength ↔ Output<int?>
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.
latefinal
passwordResetRequired ↔ Output<bool>
Whether the user should be forced to reset the generated password on resource creation. Only applies on resource creation.
latefinal
pgpKey ↔ Output<String?>
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.
latefinal
resourceTransforms → List<ResourceTransform>
Inherited/explicit async transforms.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
transformations → List<ResourceTransformation>
Inherited/explicit legacy transformations.
no setterinherited
urn ↔ Output<String>
latefinalinherited
user ↔ Output<String>
The IAM user's name.
latefinal

Methods

failId(Object error) → void
Completes this resource ID with an error when registration fails.
inherited
failOutputs(Object error) → void
Completes all output properties with error.
inherited
failUrn(Object error) → void
Completes this resource URN with an error when registration fails.
inherited
getProvider(String moduleMember) → ProviderResource?
Returns provider for moduleMember's package, if configured.
inherited
getResourceName() → String
Returns this resource's logical name.
inherited
getResourceType() → String
Returns this resource's Pulumi type token.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
registerOutput<T>(String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output<T>
Registers a dynamic output property for this resource.
inherited
resolveId(String? value, {required bool isKnown}) → void
Resolves the provider-assigned ID for this resource.
inherited
resolveOutputs(Struct outputs) → void
Resolves all output properties from a monitor response payload.
inherited
resolveUrn(String value) → void
Resolves this resource's URN once assigned by the engine.
inherited
serializeProperties(Map<String, dynamic> properties) → Future<Struct>
Serializes resource properties for RPC transmission.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

get(String name, Input<String> id, {UserLoginProfileState? state, CustomResourceOptions? options}) → UserLoginProfile
Gets an existing UserLoginProfile resource's state with the given name and id.