authentik.Token
Explore with Pulumi AI
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as authentik from "@pulumi/authentik";
// Create a token for a user
const name = new authentik.User("name", {username: "user"});
const _default = new authentik.Token("default", {
    identifier: "my-token",
    user: name.userId,
    description: "My secret token",
    expires: "2025-01-01T15:04:05Z",
});
import pulumi
import pulumi_authentik as authentik
# Create a token for a user
name = authentik.User("name", username="user")
default = authentik.Token("default",
    identifier="my-token",
    user=name.user_id,
    description="My secret token",
    expires="2025-01-01T15:04:05Z")
package main
import (
	"github.com/pulumi/pulumi-terraform-provider/sdks/go/authentik/v2025/authentik"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		// Create a token for a user
		name, err := authentik.NewUser(ctx, "name", &authentik.UserArgs{
			Username: pulumi.String("user"),
		})
		if err != nil {
			return err
		}
		_, err = authentik.NewToken(ctx, "default", &authentik.TokenArgs{
			Identifier:  pulumi.String("my-token"),
			User:        name.UserId,
			Description: pulumi.String("My secret token"),
			Expires:     pulumi.String("2025-01-01T15:04:05Z"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Authentik = Pulumi.Authentik;
return await Deployment.RunAsync(() => 
{
    // Create a token for a user
    var name = new Authentik.User("name", new()
    {
        Username = "user",
    });
    var @default = new Authentik.Token("default", new()
    {
        Identifier = "my-token",
        User = name.UserId,
        Description = "My secret token",
        Expires = "2025-01-01T15:04:05Z",
    });
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.authentik.User;
import com.pulumi.authentik.UserArgs;
import com.pulumi.authentik.Token;
import com.pulumi.authentik.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) {
        // Create a token for a user
        var name = new User("name", UserArgs.builder()
            .username("user")
            .build());
        var default_ = new Token("default", TokenArgs.builder()
            .identifier("my-token")
            .user(name.userId())
            .description("My secret token")
            .expires("2025-01-01T15:04:05Z")
            .build());
    }
}
resources:
  # Create a token for a user
  name:
    type: authentik:User
    properties:
      username: user
  default:
    type: authentik:Token
    properties:
      identifier: my-token
      user: ${name.userId}
      description: My secret token
      expires: 2025-01-01T15:04:05Z
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,
          identifier: Optional[str] = None,
          user: Optional[float] = None,
          description: Optional[str] = None,
          expires: Optional[str] = None,
          expiring: Optional[bool] = None,
          intent: Optional[str] = None,
          retrieve_key: Optional[bool] = None,
          token_id: Optional[str] = None)func NewToken(ctx *Context, name string, args TokenArgs, opts ...ResourceOption) (*Token, error)public Token(string name, TokenArgs args, CustomResourceOptions? opts = null)type: authentik: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 Authentik.Token("tokenResource", new()
{
    Identifier = "string",
    User = 0,
    Description = "string",
    Expires = "string",
    Expiring = false,
    Intent = "string",
    RetrieveKey = false,
    TokenId = "string",
});
example, err := authentik.NewToken(ctx, "tokenResource", &authentik.TokenArgs{
	Identifier:  pulumi.String("string"),
	User:        pulumi.Float64(0),
	Description: pulumi.String("string"),
	Expires:     pulumi.String("string"),
	Expiring:    pulumi.Bool(false),
	Intent:      pulumi.String("string"),
	RetrieveKey: pulumi.Bool(false),
	TokenId:     pulumi.String("string"),
})
var tokenResource = new Token("tokenResource", TokenArgs.builder()
    .identifier("string")
    .user(0)
    .description("string")
    .expires("string")
    .expiring(false)
    .intent("string")
    .retrieveKey(false)
    .tokenId("string")
    .build());
token_resource = authentik.Token("tokenResource",
    identifier="string",
    user=0,
    description="string",
    expires="string",
    expiring=False,
    intent="string",
    retrieve_key=False,
    token_id="string")
const tokenResource = new authentik.Token("tokenResource", {
    identifier: "string",
    user: 0,
    description: "string",
    expires: "string",
    expiring: false,
    intent: "string",
    retrieveKey: false,
    tokenId: "string",
});
type: authentik:Token
properties:
    description: string
    expires: string
    expiring: false
    identifier: string
    intent: string
    retrieveKey: false
    tokenId: string
    user: 0
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:
- Identifier string
- User double
- Description string
- Expires string
- Expiring bool
- Defaults to true.
- Intent string
- Allowed values: - verification-api-recovery-app_passwordDefaults toapi.
- RetrieveKey bool
- Defaults to false.
- TokenId string
- Identifier string
- User float64
- Description string
- Expires string
- Expiring bool
- Defaults to true.
- Intent string
- Allowed values: - verification-api-recovery-app_passwordDefaults toapi.
- RetrieveKey bool
- Defaults to false.
- TokenId string
- identifier String
- user Double
- description String
- expires String
- expiring Boolean
- Defaults to true.
- intent String
- Allowed values: - verification-api-recovery-app_passwordDefaults toapi.
- retrieveKey Boolean
- Defaults to false.
- tokenId String
- identifier string
- user number
- description string
- expires string
- expiring boolean
- Defaults to true.
- intent string
- Allowed values: - verification-api-recovery-app_passwordDefaults toapi.
- retrieveKey boolean
- Defaults to false.
- tokenId string
- identifier str
- user float
- description str
- expires str
- expiring bool
- Defaults to true.
- intent str
- Allowed values: - verification-api-recovery-app_passwordDefaults toapi.
- retrieve_key bool
- Defaults to false.
- token_id str
- identifier String
- user Number
- description String
- expires String
- expiring Boolean
- Defaults to true.
- intent String
- Allowed values: - verification-api-recovery-app_passwordDefaults toapi.
- retrieveKey Boolean
- Defaults to false.
- tokenId String
Outputs
All input properties are implicitly available as output properties. Additionally, the Token resource produces the following output properties:
- expires_in float
- Generated.
- id str
- The provider-assigned unique ID for this managed resource.
- key str
- Generated.
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,
        description: Optional[str] = None,
        expires: Optional[str] = None,
        expires_in: Optional[float] = None,
        expiring: Optional[bool] = None,
        identifier: Optional[str] = None,
        intent: Optional[str] = None,
        key: Optional[str] = None,
        retrieve_key: Optional[bool] = None,
        token_id: Optional[str] = None,
        user: Optional[float] = None) -> Tokenfunc 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)resources:  _:    type: authentik:Token    get:      id: ${id}- 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.
- Description string
- Expires string
- ExpiresIn double
- Generated.
- Expiring bool
- Defaults to true.
- Identifier string
- Intent string
- Allowed values: - verification-api-recovery-app_passwordDefaults toapi.
- Key string
- Generated.
- RetrieveKey bool
- Defaults to false.
- TokenId string
- User double
- Description string
- Expires string
- ExpiresIn float64
- Generated.
- Expiring bool
- Defaults to true.
- Identifier string
- Intent string
- Allowed values: - verification-api-recovery-app_passwordDefaults toapi.
- Key string
- Generated.
- RetrieveKey bool
- Defaults to false.
- TokenId string
- User float64
- description String
- expires String
- expiresIn Double
- Generated.
- expiring Boolean
- Defaults to true.
- identifier String
- intent String
- Allowed values: - verification-api-recovery-app_passwordDefaults toapi.
- key String
- Generated.
- retrieveKey Boolean
- Defaults to false.
- tokenId String
- user Double
- description string
- expires string
- expiresIn number
- Generated.
- expiring boolean
- Defaults to true.
- identifier string
- intent string
- Allowed values: - verification-api-recovery-app_passwordDefaults toapi.
- key string
- Generated.
- retrieveKey boolean
- Defaults to false.
- tokenId string
- user number
- description str
- expires str
- expires_in float
- Generated.
- expiring bool
- Defaults to true.
- identifier str
- intent str
- Allowed values: - verification-api-recovery-app_passwordDefaults toapi.
- key str
- Generated.
- retrieve_key bool
- Defaults to false.
- token_id str
- user float
- description String
- expires String
- expiresIn Number
- Generated.
- expiring Boolean
- Defaults to true.
- identifier String
- intent String
- Allowed values: - verification-api-recovery-app_passwordDefaults toapi.
- key String
- Generated.
- retrieveKey Boolean
- Defaults to false.
- tokenId String
- user Number
Package Details
- Repository
- authentik goauthentik/terraform-provider-authentik
- License
- Notes
- This Pulumi package is based on the authentikTerraform Provider.