rancher2.Token
Explore with Pulumi AI
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.
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, str]] = None,
cluster_id: Optional[str] = None,
description: Optional[str] = None,
labels: Optional[Mapping[str, str]] = 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)
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.
Constructor example
The following reference example uses placeholder values for all input properties.
var tokenResource = new Rancher2.Token("tokenResource", new()
{
Annotations =
{
{ "string", "string" },
},
ClusterId = "string",
Description = "string",
Labels =
{
{ "string", "string" },
},
Renew = false,
Ttl = 0,
});
example, err := rancher2.NewToken(ctx, "tokenResource", &rancher2.TokenArgs{
Annotations: pulumi.StringMap{
"string": pulumi.String("string"),
},
ClusterId: pulumi.String("string"),
Description: pulumi.String("string"),
Labels: pulumi.StringMap{
"string": pulumi.String("string"),
},
Renew: pulumi.Bool(false),
Ttl: pulumi.Int(0),
})
var tokenResource = new Token("tokenResource", TokenArgs.builder()
.annotations(Map.of("string", "string"))
.clusterId("string")
.description("string")
.labels(Map.of("string", "string"))
.renew(false)
.ttl(0)
.build());
token_resource = rancher2.Token("tokenResource",
annotations={
"string": "string",
},
cluster_id="string",
description="string",
labels={
"string": "string",
},
renew=False,
ttl=0)
const tokenResource = new rancher2.Token("tokenResource", {
annotations: {
string: "string",
},
clusterId: "string",
description: "string",
labels: {
string: "string",
},
renew: false,
ttl: 0,
});
type: rancher2:Token
properties:
annotations:
string: string
clusterId: string
description: string
labels:
string: string
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
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:
- Annotations Dictionary<string, string>
- (Computed) Annotations of the token (map)
- Cluster
Id string - Cluster ID for scoped token (string)
- Description string
- Token description (string)
- Labels Dictionary<string, string>
- (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]string
- (Computed) Annotations of the token (map)
- Cluster
Id string - Cluster ID for scoped token (string)
- Description string
- Token description (string)
- Labels map[string]string
- (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,String>
- (Computed) Annotations of the token (map)
- cluster
Id String - Cluster ID for scoped token (string)
- description String
- Token description (string)
- labels Map<String,String>
- (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]: string}
- (Computed) Annotations of the token (map)
- cluster
Id string - Cluster ID for scoped token (string)
- description string
- Token description (string)
- labels {[key: string]: string}
- (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, str]
- (Computed) Annotations of the token (map)
- cluster_
id str - Cluster ID for scoped token (string)
- description str
- Token description (string)
- labels Mapping[str, str]
- (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>
- (Computed) Annotations of the token (map)
- cluster
Id String - Cluster ID for scoped token (string)
- description String
- Token description (string)
- labels Map<String>
- (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:
- Access
Key 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)
- Secret
Key string - (Computed/Sensitive) Token secret key part (string)
- Token
Name string - (Computed/Sensitive) Token value (string)
- User
Id string - (Computed) Token user ID (string)
- Access
Key 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)
- Secret
Key string - (Computed/Sensitive) Token secret key part (string)
- Token string
- (Computed/Sensitive) Token value (string)
- User
Id string - (Computed) Token user ID (string)
- access
Key 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)
- secret
Key String - (Computed/Sensitive) Token secret key part (string)
- token String
- (Computed/Sensitive) Token value (string)
- user
Id String - (Computed) Token user ID (string)
- access
Key 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)
- secret
Key string - (Computed/Sensitive) Token secret key part (string)
- token string
- (Computed/Sensitive) Token value (string)
- user
Id 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)
- access
Key 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)
- secret
Key String - (Computed/Sensitive) Token secret key part (string)
- token String
- (Computed/Sensitive) Token value (string)
- user
Id 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, str]] = None,
cluster_id: Optional[str] = None,
description: Optional[str] = None,
enabled: Optional[bool] = None,
expired: Optional[bool] = None,
labels: Optional[Mapping[str, str]] = 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.
- Access
Key string - (Computed) Token access key part (string)
- Annotations Dictionary<string, string>
- (Computed) Annotations of the token (map)
- Cluster
Id 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, string>
- (Computed) Labels of the token (map)
- Name string
- (Computed) Token name (string)
- Renew bool
- Renew expired or disabled token
- Secret
Key string - (Computed/Sensitive) Token secret key part (string)
- Token
Name 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.- User
Id string - (Computed) Token user ID (string)
- Access
Key string - (Computed) Token access key part (string)
- Annotations map[string]string
- (Computed) Annotations of the token (map)
- Cluster
Id 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]string
- (Computed) Labels of the token (map)
- Name string
- (Computed) Token name (string)
- Renew bool
- Renew expired or disabled token
- Secret
Key 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.- User
Id string - (Computed) Token user ID (string)
- access
Key String - (Computed) Token access key part (string)
- annotations Map<String,String>
- (Computed) Annotations of the token (map)
- cluster
Id 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,String>
- (Computed) Labels of the token (map)
- name String
- (Computed) Token name (string)
- renew Boolean
- Renew expired or disabled token
- secret
Key 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.- user
Id String - (Computed) Token user ID (string)
- access
Key string - (Computed) Token access key part (string)
- annotations {[key: string]: string}
- (Computed) Annotations of the token (map)
- cluster
Id 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]: string}
- (Computed) Labels of the token (map)
- name string
- (Computed) Token name (string)
- renew boolean
- Renew expired or disabled token
- secret
Key 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.- user
Id string - (Computed) Token user ID (string)
- access_
key str - (Computed) Token access key part (string)
- annotations Mapping[str, str]
- (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, str]
- (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)
- access
Key String - (Computed) Token access key part (string)
- annotations Map<String>
- (Computed) Annotations of the token (map)
- cluster
Id 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>
- (Computed) Labels of the token (map)
- name String
- (Computed) Token name (string)
- renew Boolean
- Renew expired or disabled token
- secret
Key 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.- user
Id 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.