1. Packages
  2. Rancher2
  3. API Docs
  4. Token
Rancher 2 v6.1.0 published on Tuesday, Mar 12, 2024 by Pulumi

rancher2.Token

Explore with Pulumi AI

rancher2 logo
Rancher 2 v6.1.0 published on Tuesday, Mar 12, 2024 by Pulumi

    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

    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,
    });
    
    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)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-rancher2/sdk/v6/go/rancher2"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		// Create a new rancher2 Token scoped
    		_, 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
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Rancher2 = Pulumi.Rancher2;
    
    return await Deployment.RunAsync(() => 
    {
        // Create a new rancher2 Token scoped
        var foo = new Rancher2.Token("foo", new()
        {
            ClusterId = "<cluster-id>",
            Description = "foo token",
            Ttl = 1200,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.rancher2.Token;
    import com.pulumi.rancher2.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) {
            var foo = new Token("foo", TokenArgs.builder()        
                .clusterId("<cluster-id>")
                .description("foo token")
                .ttl(1200)
                .build());
    
        }
    }
    
    resources:
      # Create a new rancher2 Token scoped
      foo:
        type: rancher2:Token
        properties:
          clusterId: <cluster-id>
          description: foo token
          ttl: 1200
    

    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: Optional[TokenArgs] = None,
              opts: Optional[ResourceOptions] = None)
    
    @overload
    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)
    public Token(String name, TokenArgs args)
    public Token(String name, TokenArgs args, CustomResourceOptions options)
    
    type: rancher2: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.

    Example

    The following reference example uses placeholder values for all input properties.

    var tokenResource = new Rancher2.Token("tokenResource", new()
    {
        Annotations = 
        {
            { "string", "any" },
        },
        ClusterId = "string",
        Description = "string",
        Labels = 
        {
            { "string", "any" },
        },
        Renew = false,
        Ttl = 0,
    });
    
    example, err := rancher2.NewToken(ctx, "tokenResource", &rancher2.TokenArgs{
    	Annotations: pulumi.Map{
    		"string": pulumi.Any("any"),
    	},
    	ClusterId:   pulumi.String("string"),
    	Description: pulumi.String("string"),
    	Labels: pulumi.Map{
    		"string": pulumi.Any("any"),
    	},
    	Renew: pulumi.Bool(false),
    	Ttl:   pulumi.Int(0),
    })
    
    var tokenResource = new Token("tokenResource", TokenArgs.builder()        
        .annotations(Map.of("string", "any"))
        .clusterId("string")
        .description("string")
        .labels(Map.of("string", "any"))
        .renew(false)
        .ttl(0)
        .build());
    
    token_resource = rancher2.Token("tokenResource",
        annotations={
            "string": "any",
        },
        cluster_id="string",
        description="string",
        labels={
            "string": "any",
        },
        renew=False,
        ttl=0)
    
    const tokenResource = new rancher2.Token("tokenResource", {
        annotations: {
            string: "any",
        },
        clusterId: "string",
        description: "string",
        labels: {
            string: "any",
        },
        renew: false,
        ttl: 0,
    });
    
    type: rancher2:Token
    properties:
        annotations:
            string: any
        clusterId: string
        description: string
        labels:
            string: any
        renew: false
        ttl: 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

    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)

    From Rancher v2.4.6 ttl is readed in minutes at Rancher API. To avoid breaking change on the provider, we still read in seconds but rounding up division if required.

    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)

    From Rancher v2.4.6 ttl is readed in minutes at Rancher API. To avoid breaking change on the provider, we still read in seconds but rounding up division if required.

    annotations Map<String,Object>
    (Computed) Annotations of the token (map)
    clusterId String
    Cluster ID for scoped token (string)
    description String
    Token description (string)
    labels Map<String,Object>
    (Computed) Labels of the token (map)
    renew Boolean
    Renew expired or disabled token
    ttl Integer

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

    From Rancher v2.4.6 ttl is readed in minutes at Rancher API. To avoid breaking change on the provider, we still read in seconds but rounding up division if required.

    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)

    From Rancher v2.4.6 ttl is readed in minutes at Rancher API. To avoid breaking change on the provider, we still read in seconds but rounding up division if required.

    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)

    From Rancher v2.4.6 ttl is readed in minutes at Rancher API. To avoid breaking change on the provider, we still read in seconds but rounding up division if required.

    annotations Map<Any>
    (Computed) Annotations of the token (map)
    clusterId String
    Cluster ID for scoped token (string)
    description String
    Token description (string)
    labels Map<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)

    From Rancher v2.4.6 ttl is readed in minutes at Rancher API. To avoid breaking change on the provider, we still read in seconds but rounding up division if required.

    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)
    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)
    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)

    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,
            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)
    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.
    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)

    From Rancher v2.4.6 ttl is readed in minutes at Rancher API. To avoid breaking change on the provider, we still read in seconds but rounding up division if required.

    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)

    From Rancher v2.4.6 ttl is readed in minutes at Rancher API. To avoid breaking change on the provider, we still read in seconds but rounding up division if required.

    UserId string
    (Computed) Token user ID (string)
    accessKey String
    (Computed) Token access key part (string)
    annotations Map<String,Object>
    (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 Map<String,Object>
    (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 Integer

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

    From Rancher v2.4.6 ttl is readed in minutes at Rancher API. To avoid breaking change on the provider, we still read in seconds but rounding up division if required.

    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)

    From Rancher v2.4.6 ttl is readed in minutes at Rancher API. To avoid breaking change on the provider, we still read in seconds but rounding up division if required.

    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)

    From Rancher v2.4.6 ttl is readed in minutes at Rancher API. To avoid breaking change on the provider, we still read in seconds but rounding up division if required.

    user_id str
    (Computed) Token user ID (string)
    accessKey String
    (Computed) Token access key part (string)
    annotations Map<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 Map<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)

    From Rancher v2.4.6 ttl is readed in minutes at Rancher API. To avoid breaking change on the provider, we still read in seconds but rounding up division if required.

    userId String
    (Computed) Token user ID (string)

    Package Details

    Repository
    Rancher2 pulumi/pulumi-rancher2
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the rancher2 Terraform Provider.
    rancher2 logo
    Rancher 2 v6.1.0 published on Tuesday, Mar 12, 2024 by Pulumi