User
# keycloak..User
Allows for creating and managing Users within Keycloak.
This resource was created primarily to enable the acceptance tests for the keycloak..Group resource.
Creating users within Keycloak is not recommended. Instead, users should be federated from external sources
by configuring user federation providers or identity providers.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as keycloak from "@pulumi/keycloak";
const realm = new keycloak.Realm("realm", {
enabled: true,
realm: "my-realm",
});
const user = new keycloak.User("user", {
email: "bob@domain.com",
enabled: true,
firstName: "Bob",
lastName: "Bobson",
realmId: realm.id,
username: "bob",
});
const userWithInitialPassword = new keycloak.User("user_with_initial_password", {
email: "alice@domain.com",
enabled: true,
firstName: "Alice",
initialPassword: {
temporary: true,
value: "some password",
},
lastName: "Aliceberg",
realmId: realm.id,
username: "alice",
});import pulumi
import pulumi_keycloak as keycloak
realm = keycloak.Realm("realm",
enabled=True,
realm="my-realm")
user = keycloak.User("user",
email="bob@domain.com",
enabled=True,
first_name="Bob",
last_name="Bobson",
realm_id=realm.id,
username="bob")
user_with_initial_password = keycloak.User("userWithInitialPassword",
email="alice@domain.com",
enabled=True,
first_name="Alice",
initial_password={
"temporary": True,
"value": "some password",
},
last_name="Aliceberg",
realm_id=realm.id,
username="alice")using Pulumi;
using Keycloak = Pulumi.Keycloak;
class MyStack : Stack
{
public MyStack()
{
var realm = new Keycloak.Realm("realm", new Keycloak.RealmArgs
{
Enabled = true,
Realm = "my-realm",
});
var user = new Keycloak.User("user", new Keycloak.UserArgs
{
Email = "bob@domain.com",
Enabled = true,
FirstName = "Bob",
LastName = "Bobson",
RealmId = realm.Id,
Username = "bob",
});
var userWithInitialPassword = new Keycloak.User("userWithInitialPassword", new Keycloak.UserArgs
{
Email = "alice@domain.com",
Enabled = true,
FirstName = "Alice",
InitialPassword = new Keycloak.Inputs.UserInitialPasswordArgs
{
Temporary = true,
Value = "some password",
},
LastName = "Aliceberg",
RealmId = realm.Id,
Username = "alice",
});
}
}
Argument Reference
The following arguments are supported:
realm_id- (Required) The realm this user belongs to.username- (Required) The unique username of this user.initial_password(Optional) When given, the user’s initial password will be set. This attribute is only respected during initial user creation.value(Required) The initial password.temporary(Optional) If set totrue, the initial password is set up for renewal on first use. Default tofalse.
enabled- (Optional) When false, this user cannot log in. Defaults totrue.email- (Optional) The user’s email.first_name- (Optional) The user’s first name.last_name- (Optional) The user’s last name.
Create a User Resource
new User(name: string, args: UserArgs, opts?: CustomResourceOptions);def User(resource_name, opts=None, attributes=None, email=None, email_verified=None, enabled=None, federated_identities=None, first_name=None, initial_password=None, last_name=None, realm_id=None, username=None, __props__=None);public User(string name, UserArgs args, CustomResourceOptions? opts = null)- name string
- The unique name of the resource.
- args UserArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- opts ResourceOptions
- A bag of options that control this resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args UserArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args UserArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
User Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.
Inputs
The User resource accepts the following input properties:
Outputs
All input properties are implicitly available as output properties. Additionally, the User resource produces the following output properties:
Look up an Existing User Resource
Get an existing User 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?: UserState, opts?: CustomResourceOptions): Userstatic get(resource_name, id, opts=None, attributes=None, email=None, email_verified=None, enabled=None, federated_identities=None, first_name=None, initial_password=None, last_name=None, realm_id=None, username=None, __props__=None);public static User Get(string name, Input<string> id, UserState? state, CustomResourceOptions? opts = null)- name
- The unique name of the resulting resource.
- id
- 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
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- 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
- The unique name of the resulting resource.
- id
- 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:
Supporting Types
UserFederatedIdentity
UserInitialPassword
Package Details
- Repository
- https://github.com/pulumi/pulumi-keycloak
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
keycloakTerraform Provider.