Ready to level-up your engineering skills? Join a Pulumi Workshop. Register Now

Token

Provides a Rancher v2 Token resource. This can be used to create Tokens for Rancher v2 provider user and retrieve their information.

There are 2 kind of tokens: - no scoped: valid for global system. - scoped: valid for just a specific cluster (cluster_id should be provided).

Tokens can’t be updated once created. Any diff in token data will recreate the token. If any token expire, Rancher2 provider will generate a diff to regenerate it.

Example Usage

using Pulumi;
using Rancher2 = Pulumi.Rancher2;

class MyStack : Stack
{
    public MyStack()
    {
        // Create a new rancher2 Token scoped
        var foo = new Rancher2.Token("foo", new Rancher2.TokenArgs
        {
            ClusterId = "<cluster-id>",
            Description = "foo token",
            Ttl = 1200,
        });
    }

}
package main

import (
    "github.com/pulumi/pulumi-rancher2/sdk/v2/go/rancher2"
    "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)

func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
        _, err := rancher2.NewToken(ctx, "foo", &rancher2.TokenArgs{
            ClusterId:   pulumi.String("<cluster-id>"),
            Description: pulumi.String("foo token"),
            Ttl:         pulumi.Int(1200),
        })
        if err != nil {
            return err
        }
        return nil
    })
}
import pulumi
import pulumi_rancher2 as rancher2

# Create a new rancher2 Token scoped
foo = rancher2.Token("foo",
    cluster_id="<cluster-id>",
    description="foo token",
    ttl=1200)
import * as pulumi from "@pulumi/pulumi";
import * as rancher2 from "@pulumi/rancher2";

// Create a new rancher2 Token scoped
const foo = new rancher2.Token("foo", {
    clusterId: "<cluster-id>",
    description: "foo token",
    ttl: 1200,
});

Create a Token Resource

new Token(name: string, args?: TokenArgs, opts?: CustomResourceOptions);
def Token(resource_name: str, opts: Optional[ResourceOptions] = None, annotations: Optional[Mapping[str, Any]] = None, cluster_id: Optional[str] = None, description: Optional[str] = None, labels: Optional[Mapping[str, Any]] = None, renew: Optional[bool] = None, ttl: Optional[int] = None)
func NewToken(ctx *Context, name string, args *TokenArgs, opts ...ResourceOption) (*Token, error)
public Token(string name, TokenArgs? args = null, CustomResourceOptions? opts = null)
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.
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 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.

Token Resource Properties

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

Inputs

The Token resource accepts the following input properties:

Annotations Dictionary<string, object>

(Computed) Annotations of the token (map)

ClusterId string

Cluster ID for scoped token (string)

Description string

Token description (string)

Labels Dictionary<string, object>

(Computed) Labels of the token (map)

Renew bool

Renew expired or disabled token

Ttl int

Token time to live in seconds. Default 0 (int)

Annotations map[string]interface{}

(Computed) Annotations of the token (map)

ClusterId string

Cluster ID for scoped token (string)

Description string

Token description (string)

Labels map[string]interface{}

(Computed) Labels of the token (map)

Renew bool

Renew expired or disabled token

Ttl int

Token time to live in seconds. Default 0 (int)

annotations {[key: string]: any}

(Computed) Annotations of the token (map)

clusterId string

Cluster ID for scoped token (string)

description string

Token description (string)

labels {[key: string]: any}

(Computed) Labels of the token (map)

renew boolean

Renew expired or disabled token

ttl number

Token time to live in seconds. Default 0 (int)

annotations Mapping[str, Any]

(Computed) Annotations of the token (map)

cluster_id str

Cluster ID for scoped token (string)

description str

Token description (string)

labels Mapping[str, Any]

(Computed) Labels of the token (map)

renew bool

Renew expired or disabled token

ttl int

Token time to live in seconds. Default 0 (int)

Outputs

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

AccessKey string

(Computed) Token access key part (string)

Enabled bool

(Computed) Token is enabled (bool)

Expired bool

(Computed) Token is expired (bool)

Id string
The provider-assigned unique ID for this managed resource.
Name string

(Computed) Token name (string)

SecretKey string

(Computed/Sensitive) Token secret key part (string)

TokenName string

(Computed/Sensitive) Token value (string)

UserId string

(Computed) Token user ID (string)

AccessKey string

(Computed) Token access key part (string)

Enabled bool

(Computed) Token is enabled (bool)

Expired bool

(Computed) Token is expired (bool)

Id string
The provider-assigned unique ID for this managed resource.
Name string

(Computed) Token name (string)

SecretKey string

(Computed/Sensitive) Token secret key part (string)

Token string

(Computed/Sensitive) Token value (string)

UserId string

(Computed) Token user ID (string)

accessKey string

(Computed) Token access key part (string)

enabled boolean

(Computed) Token is enabled (bool)

expired boolean

(Computed) Token is expired (bool)

id string
The provider-assigned unique ID for this managed resource.
name string

(Computed) Token name (string)

secretKey string

(Computed/Sensitive) Token secret key part (string)

token string

(Computed/Sensitive) Token value (string)

userId string

(Computed) Token user ID (string)

access_key str

(Computed) Token access key part (string)

enabled bool

(Computed) Token is enabled (bool)

expired bool

(Computed) Token is expired (bool)

id str
The provider-assigned unique ID for this managed resource.
name str

(Computed) Token name (string)

secret_key str

(Computed/Sensitive) Token secret key part (string)

token str

(Computed/Sensitive) Token value (string)

user_id str

(Computed) Token user ID (string)

Look up an 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, access_key: Optional[str] = None, annotations: Optional[Mapping[str, Any]] = None, cluster_id: Optional[str] = None, description: Optional[str] = None, enabled: Optional[bool] = None, expired: Optional[bool] = None, labels: Optional[Mapping[str, Any]] = None, name: Optional[str] = None, renew: Optional[bool] = None, secret_key: Optional[str] = None, token: Optional[str] = None, ttl: Optional[int] = None, user_id: 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)
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:

AccessKey string

(Computed) Token access key part (string)

Annotations Dictionary<string, object>

(Computed) Annotations of the token (map)

ClusterId string

Cluster ID for scoped token (string)

Description string

Token description (string)

Enabled bool

(Computed) Token is enabled (bool)

Expired bool

(Computed) Token is expired (bool)

Labels Dictionary<string, object>

(Computed) Labels of the token (map)

Name string

(Computed) Token name (string)

Renew bool

Renew expired or disabled token

SecretKey string

(Computed/Sensitive) Token secret key part (string)

TokenName string

(Computed/Sensitive) Token value (string)

Ttl int

Token time to live in seconds. Default 0 (int)

UserId string

(Computed) Token user ID (string)

AccessKey string

(Computed) Token access key part (string)

Annotations map[string]interface{}

(Computed) Annotations of the token (map)

ClusterId string

Cluster ID for scoped token (string)

Description string

Token description (string)

Enabled bool

(Computed) Token is enabled (bool)

Expired bool

(Computed) Token is expired (bool)

Labels map[string]interface{}

(Computed) Labels of the token (map)

Name string

(Computed) Token name (string)

Renew bool

Renew expired or disabled token

SecretKey string

(Computed/Sensitive) Token secret key part (string)

Token string

(Computed/Sensitive) Token value (string)

Ttl int

Token time to live in seconds. Default 0 (int)

UserId string

(Computed) Token user ID (string)

accessKey string

(Computed) Token access key part (string)

annotations {[key: string]: any}

(Computed) Annotations of the token (map)

clusterId string

Cluster ID for scoped token (string)

description string

Token description (string)

enabled boolean

(Computed) Token is enabled (bool)

expired boolean

(Computed) Token is expired (bool)

labels {[key: string]: any}

(Computed) Labels of the token (map)

name string

(Computed) Token name (string)

renew boolean

Renew expired or disabled token

secretKey string

(Computed/Sensitive) Token secret key part (string)

token string

(Computed/Sensitive) Token value (string)

ttl number

Token time to live in seconds. Default 0 (int)

userId string

(Computed) Token user ID (string)

access_key str

(Computed) Token access key part (string)

annotations Mapping[str, Any]

(Computed) Annotations of the token (map)

cluster_id str

Cluster ID for scoped token (string)

description str

Token description (string)

enabled bool

(Computed) Token is enabled (bool)

expired bool

(Computed) Token is expired (bool)

labels Mapping[str, Any]

(Computed) Labels of the token (map)

name str

(Computed) Token name (string)

renew bool

Renew expired or disabled token

secret_key str

(Computed/Sensitive) Token secret key part (string)

token str

(Computed/Sensitive) Token value (string)

ttl int

Token time to live in seconds. Default 0 (int)

user_id str

(Computed) Token user ID (string)

Package Details

Repository
https://github.com/pulumi/pulumi-rancher2
License
Apache-2.0
Notes
This Pulumi package is based on the rancher2 Terraform Provider.