proxmoxve.User.Token
Explore with Pulumi AI
User API tokens.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as proxmoxve from "@muhlba91/pulumi-proxmoxve";
// if creating a user token, the user must be created first
const user = new proxmoxve.permission.User("user", {
comment: "Managed by Terraform",
email: "user@pve",
enabled: true,
expirationDate: "2034-01-01T22:00:00Z",
userId: "user@pve",
});
const userToken = new proxmoxve.user.Token("userToken", {
comment: "Managed by Terraform",
expirationDate: "2033-01-01T22:00:00Z",
tokenName: "tk1",
userId: user.userId,
});
import pulumi
import pulumi_proxmoxve as proxmoxve
# if creating a user token, the user must be created first
user = proxmoxve.permission.User("user",
comment="Managed by Terraform",
email="user@pve",
enabled=True,
expiration_date="2034-01-01T22:00:00Z",
user_id="user@pve")
user_token = proxmoxve.user.Token("userToken",
comment="Managed by Terraform",
expiration_date="2033-01-01T22:00:00Z",
token_name="tk1",
user_id=user.user_id)
package main
import (
"github.com/muhlba91/pulumi-proxmoxve/sdk/v6/go/proxmoxve/Permission"
"github.com/muhlba91/pulumi-proxmoxve/sdk/v6/go/proxmoxve/User"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
// if creating a user token, the user must be created first
user, err := Permission.NewUser(ctx, "user", &Permission.UserArgs{
Comment: pulumi.String("Managed by Terraform"),
Email: pulumi.String("user@pve"),
Enabled: pulumi.Bool(true),
ExpirationDate: pulumi.String("2034-01-01T22:00:00Z"),
UserId: pulumi.String("user@pve"),
})
if err != nil {
return err
}
_, err = User.NewToken(ctx, "userToken", &User.TokenArgs{
Comment: pulumi.String("Managed by Terraform"),
ExpirationDate: pulumi.String("2033-01-01T22:00:00Z"),
TokenName: pulumi.String("tk1"),
UserId: user.UserId,
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using ProxmoxVE = Pulumi.ProxmoxVE;
return await Deployment.RunAsync(() =>
{
// if creating a user token, the user must be created first
var user = new ProxmoxVE.Permission.User("user", new()
{
Comment = "Managed by Terraform",
Email = "user@pve",
Enabled = true,
ExpirationDate = "2034-01-01T22:00:00Z",
UserId = "user@pve",
});
var userToken = new ProxmoxVE.User.Token("userToken", new()
{
Comment = "Managed by Terraform",
ExpirationDate = "2033-01-01T22:00:00Z",
TokenName = "tk1",
UserId = user.UserId,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.proxmoxve.Permission.User;
import com.pulumi.proxmoxve.Permission.UserArgs;
import com.pulumi.proxmoxve.User.Token;
import com.pulumi.proxmoxve.User.TokenArgs;
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) {
// if creating a user token, the user must be created first
var user = new User("user", UserArgs.builder()
.comment("Managed by Terraform")
.email("user@pve")
.enabled(true)
.expirationDate("2034-01-01T22:00:00Z")
.userId("user@pve")
.build());
var userToken = new Token("userToken", TokenArgs.builder()
.comment("Managed by Terraform")
.expirationDate("2033-01-01T22:00:00Z")
.tokenName("tk1")
.userId(user.userId())
.build());
}
}
resources:
# if creating a user token, the user must be created first
user:
type: proxmoxve:Permission:User
properties:
comment: Managed by Terraform
email: user@pve
enabled: true
expirationDate: 2034-01-01T22:00:00Z
userId: user@pve
userToken:
type: proxmoxve:User:Token
properties:
comment: Managed by Terraform
expirationDate: 2033-01-01T22:00:00Z
tokenName: tk1
userId: ${user.userId}
Create Token Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Token(name: string, args: TokenArgs, opts?: CustomResourceOptions);
@overload
def Token(resource_name: str,
args: TokenArgs,
opts: Optional[ResourceOptions] = None)
@overload
def Token(resource_name: str,
opts: Optional[ResourceOptions] = None,
token_name: Optional[str] = None,
user_id: Optional[str] = None,
comment: Optional[str] = None,
expiration_date: Optional[str] = None,
privileges_separation: Optional[bool] = None)
func NewToken(ctx *Context, name string, args TokenArgs, opts ...ResourceOption) (*Token, error)
public Token(string name, TokenArgs args, CustomResourceOptions? opts = null)
type: proxmoxve:User:Token
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args TokenArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args TokenArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args TokenArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args TokenArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args TokenArgs
- 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 tokenResource = new ProxmoxVE.User.Token("tokenResource", new()
{
TokenName = "string",
UserId = "string",
Comment = "string",
ExpirationDate = "string",
PrivilegesSeparation = false,
});
example, err := User.NewToken(ctx, "tokenResource", &User.TokenArgs{
TokenName: pulumi.String("string"),
UserId: pulumi.String("string"),
Comment: pulumi.String("string"),
ExpirationDate: pulumi.String("string"),
PrivilegesSeparation: pulumi.Bool(false),
})
var tokenResource = new Token("tokenResource", TokenArgs.builder()
.tokenName("string")
.userId("string")
.comment("string")
.expirationDate("string")
.privilegesSeparation(false)
.build());
token_resource = proxmoxve.user.Token("tokenResource",
token_name="string",
user_id="string",
comment="string",
expiration_date="string",
privileges_separation=False)
const tokenResource = new proxmoxve.user.Token("tokenResource", {
tokenName: "string",
userId: "string",
comment: "string",
expirationDate: "string",
privilegesSeparation: false,
});
type: proxmoxve:User:Token
properties:
comment: string
expirationDate: string
privilegesSeparation: false
tokenName: string
userId: string
Token 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 Token resource accepts the following input properties:
- Token
Name string - User-specific token identifier.
- User
Id string - User identifier.
- Comment string
- Comment for the token.
- Expiration
Date string - Expiration date for the token.
- Privileges
Separation bool - Restrict API token privileges with separate ACLs (default), or give full privileges of corresponding user.
- Token
Name string - User-specific token identifier.
- User
Id string - User identifier.
- Comment string
- Comment for the token.
- Expiration
Date string - Expiration date for the token.
- Privileges
Separation bool - Restrict API token privileges with separate ACLs (default), or give full privileges of corresponding user.
- token
Name String - User-specific token identifier.
- user
Id String - User identifier.
- comment String
- Comment for the token.
- expiration
Date String - Expiration date for the token.
- privileges
Separation Boolean - Restrict API token privileges with separate ACLs (default), or give full privileges of corresponding user.
- token
Name string - User-specific token identifier.
- user
Id string - User identifier.
- comment string
- Comment for the token.
- expiration
Date string - Expiration date for the token.
- privileges
Separation boolean - Restrict API token privileges with separate ACLs (default), or give full privileges of corresponding user.
- token_
name str - User-specific token identifier.
- user_
id str - User identifier.
- comment str
- Comment for the token.
- expiration_
date str - Expiration date for the token.
- privileges_
separation bool - Restrict API token privileges with separate ACLs (default), or give full privileges of corresponding user.
- token
Name String - User-specific token identifier.
- user
Id String - User identifier.
- comment String
- Comment for the token.
- expiration
Date String - Expiration date for the token.
- privileges
Separation Boolean - Restrict API token privileges with separate ACLs (default), or give full privileges of corresponding user.
Outputs
All input properties are implicitly available as output properties. Additionally, the Token resource produces the following output properties:
Look up Existing Token Resource
Get an existing Token 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?: TokenState, opts?: CustomResourceOptions): Token
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
comment: Optional[str] = None,
expiration_date: Optional[str] = None,
privileges_separation: Optional[bool] = None,
token_name: Optional[str] = None,
user_id: Optional[str] = None,
value: Optional[str] = None) -> Token
func GetToken(ctx *Context, name string, id IDInput, state *TokenState, opts ...ResourceOption) (*Token, error)
public static Token Get(string name, Input<string> id, TokenState? state, CustomResourceOptions? opts = null)
public static Token get(String name, Output<String> id, TokenState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- 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.
- 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.
- Comment string
- Comment for the token.
- Expiration
Date string - Expiration date for the token.
- Privileges
Separation bool - Restrict API token privileges with separate ACLs (default), or give full privileges of corresponding user.
- Token
Name string - User-specific token identifier.
- User
Id string - User identifier.
- Value string
- API token value used for authentication. It is populated only when creating a new token, and can't be retrieved at import.
- Comment string
- Comment for the token.
- Expiration
Date string - Expiration date for the token.
- Privileges
Separation bool - Restrict API token privileges with separate ACLs (default), or give full privileges of corresponding user.
- Token
Name string - User-specific token identifier.
- User
Id string - User identifier.
- Value string
- API token value used for authentication. It is populated only when creating a new token, and can't be retrieved at import.
- comment String
- Comment for the token.
- expiration
Date String - Expiration date for the token.
- privileges
Separation Boolean - Restrict API token privileges with separate ACLs (default), or give full privileges of corresponding user.
- token
Name String - User-specific token identifier.
- user
Id String - User identifier.
- value String
- API token value used for authentication. It is populated only when creating a new token, and can't be retrieved at import.
- comment string
- Comment for the token.
- expiration
Date string - Expiration date for the token.
- privileges
Separation boolean - Restrict API token privileges with separate ACLs (default), or give full privileges of corresponding user.
- token
Name string - User-specific token identifier.
- user
Id string - User identifier.
- value string
- API token value used for authentication. It is populated only when creating a new token, and can't be retrieved at import.
- comment str
- Comment for the token.
- expiration_
date str - Expiration date for the token.
- privileges_
separation bool - Restrict API token privileges with separate ACLs (default), or give full privileges of corresponding user.
- token_
name str - User-specific token identifier.
- user_
id str - User identifier.
- value str
- API token value used for authentication. It is populated only when creating a new token, and can't be retrieved at import.
- comment String
- Comment for the token.
- expiration
Date String - Expiration date for the token.
- privileges
Separation Boolean - Restrict API token privileges with separate ACLs (default), or give full privileges of corresponding user.
- token
Name String - User-specific token identifier.
- user
Id String - User identifier.
- value String
- API token value used for authentication. It is populated only when creating a new token, and can't be retrieved at import.
Import
#!/usr/bin/env sh
#Tokens can be imported using they identifiers in format user_id!token_name
format, e.g.:
$ pulumi import proxmoxve:User/token:Token token1 user@pve!token1
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- proxmoxve muhlba91/pulumi-proxmoxve
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
proxmox
Terraform Provider.