databricks.Token
Explore with Pulumi AI
This resource creates Personal Access Tokens for the same user that is authenticated with the provider. Most likely you should use databricks.OboToken to create On-Behalf-Of tokens for a databricks.ServicePrincipal in Databricks workspaces on AWS. Databricks workspaces on other clouds use their own native OAuth token flows.
Example Usage
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Databricks = Pulumi.Databricks;
return await Deployment.RunAsync(() =>
{
// initialize provider in normal mode
var createdWorkspace = new Databricks.Provider("createdWorkspace", new()
{
Host = databricks_mws_workspaces.This.Workspace_url,
});
// create PAT token to provision entities within workspace
var pat = new Databricks.Token("pat", new()
{
Comment = "Terraform Provisioning",
LifetimeSeconds = 8640000,
}, new CustomResourceOptions
{
Provider = databricks.Created_workspace,
});
return new Dictionary<string, object?>
{
["databricksToken"] = pat.TokenValue,
};
});
package main
import (
"github.com/pulumi/pulumi-databricks/sdk/go/databricks"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
// initialize provider in normal mode
_, err := databricks.NewProvider(ctx, "createdWorkspace", &databricks.ProviderArgs{
Host: pulumi.Any(databricks_mws_workspaces.This.Workspace_url),
})
if err != nil {
return err
}
// create PAT token to provision entities within workspace
pat, err := databricks.NewToken(ctx, "pat", &databricks.TokenArgs{
Comment: pulumi.String("Terraform Provisioning"),
LifetimeSeconds: pulumi.Int(8640000),
}, pulumi.Provider(databricks.Created_workspace))
if err != nil {
return err
}
ctx.Export("databricksToken", pat.TokenValue)
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.databricks.Provider;
import com.pulumi.databricks.ProviderArgs;
import com.pulumi.databricks.Token;
import com.pulumi.databricks.TokenArgs;
import com.pulumi.resources.CustomResourceOptions;
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 createdWorkspace = new Provider("createdWorkspace", ProviderArgs.builder()
.host(databricks_mws_workspaces.this().workspace_url())
.build());
var pat = new Token("pat", TokenArgs.builder()
.comment("Terraform Provisioning")
.lifetimeSeconds(8640000)
.build(), CustomResourceOptions.builder()
.provider(databricks.created_workspace())
.build());
ctx.export("databricksToken", pat.tokenValue());
}
}
import pulumi
import pulumi_databricks as databricks
# initialize provider in normal mode
created_workspace = databricks.Provider("createdWorkspace", host=databricks_mws_workspaces["this"]["workspace_url"])
# create PAT token to provision entities within workspace
pat = databricks.Token("pat",
comment="Terraform Provisioning",
lifetime_seconds=8640000,
opts=pulumi.ResourceOptions(provider=databricks["created_workspace"]))
pulumi.export("databricksToken", pat.token_value)
import * as pulumi from "@pulumi/pulumi";
import * as databricks from "@pulumi/databricks";
// initialize provider in normal mode
const createdWorkspace = new databricks.Provider("createdWorkspace", {host: databricks_mws_workspaces["this"].workspace_url});
// create PAT token to provision entities within workspace
const pat = new databricks.Token("pat", {
comment: "Terraform Provisioning",
lifetimeSeconds: 8640000,
}, {
provider: databricks.created_workspace,
});
export const databricksToken = pat.tokenValue;
resources:
# initialize provider in normal mode
createdWorkspace:
type: pulumi:providers:databricks
properties:
host: ${databricks_mws_workspaces.this.workspace_url}
# create PAT token to provision entities within workspace
pat:
type: databricks:Token
properties:
comment: Terraform Provisioning
# 100 day token
lifetimeSeconds: 8.64e+06
options:
provider: ${databricks.created_workspace}
outputs:
# output token for other modules
databricksToken: ${pat.tokenValue}
resource
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Databricks = Pulumi.Databricks;
using Time = Pulumiverse.Time;
return await Deployment.RunAsync(() =>
{
var @this = new Time.Rotating("this", new()
{
RotationDays = 30,
});
var pat = new Databricks.Token("pat", new()
{
Comment = @this.Rfc3339.Apply(rfc3339 => $"Terraform (created: {rfc3339})"),
LifetimeSeconds = 60 * 24 * 60 * 60,
});
});
package main
import (
"fmt"
"github.com/pulumi/pulumi-databricks/sdk/go/databricks"
"github.com/pulumi/pulumi-time/sdk/go/time"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
this, err := time.NewRotating(ctx, "this", &time.RotatingArgs{
RotationDays: pulumi.Int(30),
})
if err != nil {
return err
}
_, err = databricks.NewToken(ctx, "pat", &databricks.TokenArgs{
Comment: this.Rfc3339.ApplyT(func(rfc3339 string) (string, error) {
return fmt.Sprintf("Terraform (created: %v)", rfc3339), nil
}).(pulumi.StringOutput),
LifetimeSeconds: 60 * 24 * 60 * 60,
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.time.Rotating;
import com.pulumi.time.RotatingArgs;
import com.pulumi.databricks.Token;
import com.pulumi.databricks.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 this_ = new Rotating("this", RotatingArgs.builder()
.rotationDays(30)
.build());
var pat = new Token("pat", TokenArgs.builder()
.comment(this_.rfc3339().applyValue(rfc3339 -> String.format("Terraform (created: %s)", rfc3339)))
.lifetimeSeconds(60 * 24 * 60 * 60)
.build());
}
}
import pulumi
import pulumi_databricks as databricks
import pulumiverse_time as time
this = time.Rotating("this", rotation_days=30)
pat = databricks.Token("pat",
comment=this.rfc3339.apply(lambda rfc3339: f"Terraform (created: {rfc3339})"),
lifetime_seconds=60 * 24 * 60 * 60)
import * as pulumi from "@pulumi/pulumi";
import * as databricks from "@pulumi/databricks";
import * as time from "@pulumiverse/time";
const _this = new time.Rotating("this", {rotationDays: 30});
const pat = new databricks.Token("pat", {
comment: pulumi.interpolate`Terraform (created: ${_this.rfc3339})`,
lifetimeSeconds: 60 * 24 * 60 * 60,
});
Coming soon!
Create Token Resource
new Token(name: string, args?: TokenArgs, opts?: CustomResourceOptions);
@overload
def Token(resource_name: str,
opts: Optional[ResourceOptions] = None,
comment: Optional[str] = None,
creation_time: Optional[int] = None,
expiry_time: Optional[int] = None,
lifetime_seconds: Optional[int] = None,
token_id: Optional[str] = None)
@overload
def Token(resource_name: str,
args: Optional[TokenArgs] = None,
opts: Optional[ResourceOptions] = None)
func NewToken(ctx *Context, name string, args *TokenArgs, opts ...ResourceOption) (*Token, error)
public Token(string name, TokenArgs? args = null, CustomResourceOptions? opts = null)
type: databricks:Token
properties: # The arguments to resource properties.
options: # 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.
- 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.
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:
- Comment string
- (String) Comment that will appear on the user’s settings page for this token.
- Creation
Time int - Expiry
Time int - Lifetime
Seconds int - (Integer) The lifetime of the token, in seconds. If no lifetime is specified, the token remains valid indefinitely.
- Token
Id string
- Comment string
- (String) Comment that will appear on the user’s settings page for this token.
- Creation
Time int - Expiry
Time int - Lifetime
Seconds int - (Integer) The lifetime of the token, in seconds. If no lifetime is specified, the token remains valid indefinitely.
- Token
Id string
- comment String
- (String) Comment that will appear on the user’s settings page for this token.
- creation
Time Integer - expiry
Time Integer - lifetime
Seconds Integer - (Integer) The lifetime of the token, in seconds. If no lifetime is specified, the token remains valid indefinitely.
- token
Id String
- comment string
- (String) Comment that will appear on the user’s settings page for this token.
- creation
Time number - expiry
Time number - lifetime
Seconds number - (Integer) The lifetime of the token, in seconds. If no lifetime is specified, the token remains valid indefinitely.
- token
Id string
- comment str
- (String) Comment that will appear on the user’s settings page for this token.
- creation_
time int - expiry_
time int - lifetime_
seconds int - (Integer) The lifetime of the token, in seconds. If no lifetime is specified, the token remains valid indefinitely.
- token_
id str
- comment String
- (String) Comment that will appear on the user’s settings page for this token.
- creation
Time Number - expiry
Time Number - lifetime
Seconds Number - (Integer) The lifetime of the token, in seconds. If no lifetime is specified, the token remains valid indefinitely.
- token
Id String
Outputs
All input properties are implicitly available as output properties. Additionally, the Token resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Token
Value string - Sensitive value of the newly-created token.
- Id string
- The provider-assigned unique ID for this managed resource.
- Token
Value string - Sensitive value of the newly-created token.
- id String
- The provider-assigned unique ID for this managed resource.
- token
Value String - Sensitive value of the newly-created token.
- id string
- The provider-assigned unique ID for this managed resource.
- token
Value string - Sensitive value of the newly-created token.
- id str
- The provider-assigned unique ID for this managed resource.
- token_
value str - Sensitive value of the newly-created token.
- id String
- The provider-assigned unique ID for this managed resource.
- token
Value String - Sensitive value of the newly-created token.
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,
comment: Optional[str] = None,
creation_time: Optional[int] = None,
expiry_time: Optional[int] = None,
lifetime_seconds: Optional[int] = None,
token_id: Optional[str] = None,
token_value: 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.
- Comment string
- (String) Comment that will appear on the user’s settings page for this token.
- Creation
Time int - Expiry
Time int - Lifetime
Seconds int - (Integer) The lifetime of the token, in seconds. If no lifetime is specified, the token remains valid indefinitely.
- Token
Id string - Token
Value string - Sensitive value of the newly-created token.
- Comment string
- (String) Comment that will appear on the user’s settings page for this token.
- Creation
Time int - Expiry
Time int - Lifetime
Seconds int - (Integer) The lifetime of the token, in seconds. If no lifetime is specified, the token remains valid indefinitely.
- Token
Id string - Token
Value string - Sensitive value of the newly-created token.
- comment String
- (String) Comment that will appear on the user’s settings page for this token.
- creation
Time Integer - expiry
Time Integer - lifetime
Seconds Integer - (Integer) The lifetime of the token, in seconds. If no lifetime is specified, the token remains valid indefinitely.
- token
Id String - token
Value String - Sensitive value of the newly-created token.
- comment string
- (String) Comment that will appear on the user’s settings page for this token.
- creation
Time number - expiry
Time number - lifetime
Seconds number - (Integer) The lifetime of the token, in seconds. If no lifetime is specified, the token remains valid indefinitely.
- token
Id string - token
Value string - Sensitive value of the newly-created token.
- comment str
- (String) Comment that will appear on the user’s settings page for this token.
- creation_
time int - expiry_
time int - lifetime_
seconds int - (Integer) The lifetime of the token, in seconds. If no lifetime is specified, the token remains valid indefinitely.
- token_
id str - token_
value str - Sensitive value of the newly-created token.
- comment String
- (String) Comment that will appear on the user’s settings page for this token.
- creation
Time Number - expiry
Time Number - lifetime
Seconds Number - (Integer) The lifetime of the token, in seconds. If no lifetime is specified, the token remains valid indefinitely.
- token
Id String - token
Value String - Sensitive value of the newly-created token.
Import
-> Note Importing this resource is not currently supported.
Package Details
- Repository
- databricks pulumi/pulumi-databricks
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
databricks
Terraform Provider.