Class Token
Provides a Linode Token resource. This can be used to create, modify, and delete Linode API Personal Access Tokens. Personal Access Tokens proxy user credentials for Linode API access. This is necessary for tools, to interact with Linode services on a user's behalf.
It is common for the provider itself to be configured with broadly scoped Personal Access Tokens. Provisioning scripts or tools configured within a Linode Instance should follow the principle of least privilege to afford only the required roles for tools to perform their necessary tasks. The linode..Token resource allows for the management of Personal Access Tokens with scopes mirroring or narrowing the scope of the parent token.
For more information, see the Linode APIv4 docs.
Example Usage
using Pulumi;
using Linode = Pulumi.Linode;
class MyStack : Stack
{
public MyStack()
{
var fooToken = new Linode.Token("fooToken", new Linode.TokenArgs
{
Expiry = "2100-01-02T03:04:05Z",
Label = "token",
Scopes = "linodes:read_only",
});
var fooInstance = new Linode.Instance("fooInstance", new Linode.InstanceArgs
{
});
}
}
Attributes
This resource exports the following attributes:
token- The token used to access the API.created- The date this Token was created.
Inherited Members
Namespace: Pulumi.Linode
Assembly: Pulumi.Linode.dll
Syntax
public class Token : CustomResource
Constructors
View SourceToken(String, TokenArgs, CustomResourceOptions)
Create a Token resource with the given unique name, arguments, and options.
Declaration
public Token(string name, TokenArgs args, CustomResourceOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The unique name of the resource |
| TokenArgs | args | The arguments used to populate this resource's properties |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Properties
View SourceCreated
The date and time this token was created.
Declaration
public Output<string> Created { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Expiry
When this token will expire. Personal Access Tokens cannot be renewed, so after this time the token will be completely unusable and a new token will need to be generated. Tokens may be created with 'null' as their expiry and will never expire unless revoked.
Declaration
public Output<string> Expiry { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Label
A label for the Token.
Declaration
public Output<string> Label { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Scopes
The scopes this token was created with. These define what parts of the Account the token can be used to access. Many command-line tools, such as the Linode CLI, require tokens with access to *. Tokens with more restrictive scopes are generally more secure.
Declaration
public Output<string> Scopes { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
TokenName
The token used to access the API.
Declaration
public Output<string> TokenName { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Methods
View SourceGet(String, Input<String>, TokenState, CustomResourceOptions)
Get an existing Token resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
Declaration
public static Token Get(string name, Input<string> id, TokenState state = null, CustomResourceOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The unique name of the resulting resource. |
| Input<System.String> | id | The unique provider ID of the resource to lookup. |
| TokenState | state | Any extra arguments used during the lookup. |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Returns
| Type | Description |
|---|---|
| Token |