1. Packages
  2. Dbtcloud Provider
  3. API Docs
  4. ServiceToken
dbt Cloud v0.1.25 published on Friday, Nov 8, 2024 by Pulumi

dbtcloud.ServiceToken

Explore with Pulumi AI

dbtcloud logo
dbt Cloud v0.1.25 published on Friday, Nov 8, 2024 by Pulumi

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as dbtcloud from "@pulumi/dbtcloud";
    
    const testServiceToken = new dbtcloud.ServiceToken("test_service_token", {
        name: "Test Service Token",
        serviceTokenPermissions: [
            {
                permissionSet: "git_admin",
                allProjects: true,
            },
            {
                permissionSet: "job_admin",
                allProjects: false,
                projectId: dbtProject.id,
            },
            {
                permissionSet: "developer",
                allProjects: true,
                writableEnvironmentCategories: [
                    "development",
                    "staging",
                ],
            },
        ],
    });
    
    import pulumi
    import pulumi_dbtcloud as dbtcloud
    
    test_service_token = dbtcloud.ServiceToken("test_service_token",
        name="Test Service Token",
        service_token_permissions=[
            {
                "permission_set": "git_admin",
                "all_projects": True,
            },
            {
                "permission_set": "job_admin",
                "all_projects": False,
                "project_id": dbt_project["id"],
            },
            {
                "permission_set": "developer",
                "all_projects": True,
                "writable_environment_categories": [
                    "development",
                    "staging",
                ],
            },
        ])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-dbtcloud/sdk/go/dbtcloud"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := dbtcloud.NewServiceToken(ctx, "test_service_token", &dbtcloud.ServiceTokenArgs{
    			Name: pulumi.String("Test Service Token"),
    			ServiceTokenPermissions: dbtcloud.ServiceTokenServiceTokenPermissionArray{
    				&dbtcloud.ServiceTokenServiceTokenPermissionArgs{
    					PermissionSet: pulumi.String("git_admin"),
    					AllProjects:   pulumi.Bool(true),
    				},
    				&dbtcloud.ServiceTokenServiceTokenPermissionArgs{
    					PermissionSet: pulumi.String("job_admin"),
    					AllProjects:   pulumi.Bool(false),
    					ProjectId:     pulumi.Any(dbtProject.Id),
    				},
    				&dbtcloud.ServiceTokenServiceTokenPermissionArgs{
    					PermissionSet: pulumi.String("developer"),
    					AllProjects:   pulumi.Bool(true),
    					WritableEnvironmentCategories: pulumi.StringArray{
    						pulumi.String("development"),
    						pulumi.String("staging"),
    					},
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using DbtCloud = Pulumi.DbtCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var testServiceToken = new DbtCloud.ServiceToken("test_service_token", new()
        {
            Name = "Test Service Token",
            ServiceTokenPermissions = new[]
            {
                new DbtCloud.Inputs.ServiceTokenServiceTokenPermissionArgs
                {
                    PermissionSet = "git_admin",
                    AllProjects = true,
                },
                new DbtCloud.Inputs.ServiceTokenServiceTokenPermissionArgs
                {
                    PermissionSet = "job_admin",
                    AllProjects = false,
                    ProjectId = dbtProject.Id,
                },
                new DbtCloud.Inputs.ServiceTokenServiceTokenPermissionArgs
                {
                    PermissionSet = "developer",
                    AllProjects = true,
                    WritableEnvironmentCategories = new[]
                    {
                        "development",
                        "staging",
                    },
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.dbtcloud.ServiceToken;
    import com.pulumi.dbtcloud.ServiceTokenArgs;
    import com.pulumi.dbtcloud.inputs.ServiceTokenServiceTokenPermissionArgs;
    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 testServiceToken = new ServiceToken("testServiceToken", ServiceTokenArgs.builder()
                .name("Test Service Token")
                .serviceTokenPermissions(            
                    ServiceTokenServiceTokenPermissionArgs.builder()
                        .permissionSet("git_admin")
                        .allProjects(true)
                        .build(),
                    ServiceTokenServiceTokenPermissionArgs.builder()
                        .permissionSet("job_admin")
                        .allProjects(false)
                        .projectId(dbtProject.id())
                        .build(),
                    ServiceTokenServiceTokenPermissionArgs.builder()
                        .permissionSet("developer")
                        .allProjects(true)
                        .writableEnvironmentCategories(                    
                            "development",
                            "staging")
                        .build())
                .build());
    
        }
    }
    
    resources:
      testServiceToken:
        type: dbtcloud:ServiceToken
        name: test_service_token
        properties:
          name: Test Service Token
          serviceTokenPermissions:
            - permissionSet: git_admin
              allProjects: true
            - permissionSet: job_admin
              allProjects: false
              projectId: ${dbtProject.id}
            - permissionSet: developer
              allProjects: true
              writableEnvironmentCategories:
                - development
                - staging
    

    Create ServiceToken Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new ServiceToken(name: string, args?: ServiceTokenArgs, opts?: CustomResourceOptions);
    @overload
    def ServiceToken(resource_name: str,
                     args: Optional[ServiceTokenArgs] = None,
                     opts: Optional[ResourceOptions] = None)
    
    @overload
    def ServiceToken(resource_name: str,
                     opts: Optional[ResourceOptions] = None,
                     name: Optional[str] = None,
                     service_token_permissions: Optional[Sequence[ServiceTokenServiceTokenPermissionArgs]] = None,
                     state: Optional[int] = None)
    func NewServiceToken(ctx *Context, name string, args *ServiceTokenArgs, opts ...ResourceOption) (*ServiceToken, error)
    public ServiceToken(string name, ServiceTokenArgs? args = null, CustomResourceOptions? opts = null)
    public ServiceToken(String name, ServiceTokenArgs args)
    public ServiceToken(String name, ServiceTokenArgs args, CustomResourceOptions options)
    
    type: dbtcloud:ServiceToken
    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 ServiceTokenArgs
    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 ServiceTokenArgs
    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 ServiceTokenArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ServiceTokenArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ServiceTokenArgs
    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 serviceTokenResource = new DbtCloud.ServiceToken("serviceTokenResource", new()
    {
        Name = "string",
        ServiceTokenPermissions = new[]
        {
            new DbtCloud.Inputs.ServiceTokenServiceTokenPermissionArgs
            {
                AllProjects = false,
                PermissionSet = "string",
                ProjectId = 0,
                WritableEnvironmentCategories = new[]
                {
                    "string",
                },
            },
        },
        State = 0,
    });
    
    example, err := dbtcloud.NewServiceToken(ctx, "serviceTokenResource", &dbtcloud.ServiceTokenArgs{
    	Name: pulumi.String("string"),
    	ServiceTokenPermissions: dbtcloud.ServiceTokenServiceTokenPermissionArray{
    		&dbtcloud.ServiceTokenServiceTokenPermissionArgs{
    			AllProjects:   pulumi.Bool(false),
    			PermissionSet: pulumi.String("string"),
    			ProjectId:     pulumi.Int(0),
    			WritableEnvironmentCategories: pulumi.StringArray{
    				pulumi.String("string"),
    			},
    		},
    	},
    	State: pulumi.Int(0),
    })
    
    var serviceTokenResource = new ServiceToken("serviceTokenResource", ServiceTokenArgs.builder()
        .name("string")
        .serviceTokenPermissions(ServiceTokenServiceTokenPermissionArgs.builder()
            .allProjects(false)
            .permissionSet("string")
            .projectId(0)
            .writableEnvironmentCategories("string")
            .build())
        .state(0)
        .build());
    
    service_token_resource = dbtcloud.ServiceToken("serviceTokenResource",
        name="string",
        service_token_permissions=[{
            "all_projects": False,
            "permission_set": "string",
            "project_id": 0,
            "writable_environment_categories": ["string"],
        }],
        state=0)
    
    const serviceTokenResource = new dbtcloud.ServiceToken("serviceTokenResource", {
        name: "string",
        serviceTokenPermissions: [{
            allProjects: false,
            permissionSet: "string",
            projectId: 0,
            writableEnvironmentCategories: ["string"],
        }],
        state: 0,
    });
    
    type: dbtcloud:ServiceToken
    properties:
        name: string
        serviceTokenPermissions:
            - allProjects: false
              permissionSet: string
              projectId: 0
              writableEnvironmentCategories:
                - string
        state: 0
    

    ServiceToken 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 ServiceToken resource accepts the following input properties:

    Name string
    Service token name
    ServiceTokenPermissions List<Pulumi.DbtCloud.Inputs.ServiceTokenServiceTokenPermission>
    Permissions set for the service token
    State int
    Service token state (1 is active, 2 is inactive)
    Name string
    Service token name
    ServiceTokenPermissions []ServiceTokenServiceTokenPermissionArgs
    Permissions set for the service token
    State int
    Service token state (1 is active, 2 is inactive)
    name String
    Service token name
    serviceTokenPermissions List<ServiceTokenServiceTokenPermission>
    Permissions set for the service token
    state Integer
    Service token state (1 is active, 2 is inactive)
    name string
    Service token name
    serviceTokenPermissions ServiceTokenServiceTokenPermission[]
    Permissions set for the service token
    state number
    Service token state (1 is active, 2 is inactive)
    name str
    Service token name
    service_token_permissions Sequence[ServiceTokenServiceTokenPermissionArgs]
    Permissions set for the service token
    state int
    Service token state (1 is active, 2 is inactive)
    name String
    Service token name
    serviceTokenPermissions List<Property Map>
    Permissions set for the service token
    state Number
    Service token state (1 is active, 2 is inactive)

    Outputs

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

    Id string
    The provider-assigned unique ID for this managed resource.
    TokenString string
    Service token secret value (only accessible on creation))
    Uid string
    Service token UID (part of the token)
    Id string
    The provider-assigned unique ID for this managed resource.
    TokenString string
    Service token secret value (only accessible on creation))
    Uid string
    Service token UID (part of the token)
    id String
    The provider-assigned unique ID for this managed resource.
    tokenString String
    Service token secret value (only accessible on creation))
    uid String
    Service token UID (part of the token)
    id string
    The provider-assigned unique ID for this managed resource.
    tokenString string
    Service token secret value (only accessible on creation))
    uid string
    Service token UID (part of the token)
    id str
    The provider-assigned unique ID for this managed resource.
    token_string str
    Service token secret value (only accessible on creation))
    uid str
    Service token UID (part of the token)
    id String
    The provider-assigned unique ID for this managed resource.
    tokenString String
    Service token secret value (only accessible on creation))
    uid String
    Service token UID (part of the token)

    Look up Existing ServiceToken Resource

    Get an existing ServiceToken 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?: ServiceTokenState, opts?: CustomResourceOptions): ServiceToken
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            name: Optional[str] = None,
            service_token_permissions: Optional[Sequence[ServiceTokenServiceTokenPermissionArgs]] = None,
            state: Optional[int] = None,
            token_string: Optional[str] = None,
            uid: Optional[str] = None) -> ServiceToken
    func GetServiceToken(ctx *Context, name string, id IDInput, state *ServiceTokenState, opts ...ResourceOption) (*ServiceToken, error)
    public static ServiceToken Get(string name, Input<string> id, ServiceTokenState? state, CustomResourceOptions? opts = null)
    public static ServiceToken get(String name, Output<String> id, ServiceTokenState 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:
    Name string
    Service token name
    ServiceTokenPermissions List<Pulumi.DbtCloud.Inputs.ServiceTokenServiceTokenPermission>
    Permissions set for the service token
    State int
    Service token state (1 is active, 2 is inactive)
    TokenString string
    Service token secret value (only accessible on creation))
    Uid string
    Service token UID (part of the token)
    Name string
    Service token name
    ServiceTokenPermissions []ServiceTokenServiceTokenPermissionArgs
    Permissions set for the service token
    State int
    Service token state (1 is active, 2 is inactive)
    TokenString string
    Service token secret value (only accessible on creation))
    Uid string
    Service token UID (part of the token)
    name String
    Service token name
    serviceTokenPermissions List<ServiceTokenServiceTokenPermission>
    Permissions set for the service token
    state Integer
    Service token state (1 is active, 2 is inactive)
    tokenString String
    Service token secret value (only accessible on creation))
    uid String
    Service token UID (part of the token)
    name string
    Service token name
    serviceTokenPermissions ServiceTokenServiceTokenPermission[]
    Permissions set for the service token
    state number
    Service token state (1 is active, 2 is inactive)
    tokenString string
    Service token secret value (only accessible on creation))
    uid string
    Service token UID (part of the token)
    name str
    Service token name
    service_token_permissions Sequence[ServiceTokenServiceTokenPermissionArgs]
    Permissions set for the service token
    state int
    Service token state (1 is active, 2 is inactive)
    token_string str
    Service token secret value (only accessible on creation))
    uid str
    Service token UID (part of the token)
    name String
    Service token name
    serviceTokenPermissions List<Property Map>
    Permissions set for the service token
    state Number
    Service token state (1 is active, 2 is inactive)
    tokenString String
    Service token secret value (only accessible on creation))
    uid String
    Service token UID (part of the token)

    Supporting Types

    ServiceTokenServiceTokenPermission, ServiceTokenServiceTokenPermissionArgs

    AllProjects bool
    Whether or not to apply this permission to all projects for this service token
    PermissionSet string
    Set of permissions to apply
    ProjectId int
    Project ID to apply this permission to for this service token
    WritableEnvironmentCategories List<string>
    What types of environments to apply Write permissions to. Even if Write access is restricted to some environment types, the permission set will have Read access to all environments. The values allowed are all, development, staging, production and other. Not setting a value is the same as selecting all. Not all permission sets support environment level write settings, only analyst, database_admin, developer, git_admin and team_admin.
    AllProjects bool
    Whether or not to apply this permission to all projects for this service token
    PermissionSet string
    Set of permissions to apply
    ProjectId int
    Project ID to apply this permission to for this service token
    WritableEnvironmentCategories []string
    What types of environments to apply Write permissions to. Even if Write access is restricted to some environment types, the permission set will have Read access to all environments. The values allowed are all, development, staging, production and other. Not setting a value is the same as selecting all. Not all permission sets support environment level write settings, only analyst, database_admin, developer, git_admin and team_admin.
    allProjects Boolean
    Whether or not to apply this permission to all projects for this service token
    permissionSet String
    Set of permissions to apply
    projectId Integer
    Project ID to apply this permission to for this service token
    writableEnvironmentCategories List<String>
    What types of environments to apply Write permissions to. Even if Write access is restricted to some environment types, the permission set will have Read access to all environments. The values allowed are all, development, staging, production and other. Not setting a value is the same as selecting all. Not all permission sets support environment level write settings, only analyst, database_admin, developer, git_admin and team_admin.
    allProjects boolean
    Whether or not to apply this permission to all projects for this service token
    permissionSet string
    Set of permissions to apply
    projectId number
    Project ID to apply this permission to for this service token
    writableEnvironmentCategories string[]
    What types of environments to apply Write permissions to. Even if Write access is restricted to some environment types, the permission set will have Read access to all environments. The values allowed are all, development, staging, production and other. Not setting a value is the same as selecting all. Not all permission sets support environment level write settings, only analyst, database_admin, developer, git_admin and team_admin.
    all_projects bool
    Whether or not to apply this permission to all projects for this service token
    permission_set str
    Set of permissions to apply
    project_id int
    Project ID to apply this permission to for this service token
    writable_environment_categories Sequence[str]
    What types of environments to apply Write permissions to. Even if Write access is restricted to some environment types, the permission set will have Read access to all environments. The values allowed are all, development, staging, production and other. Not setting a value is the same as selecting all. Not all permission sets support environment level write settings, only analyst, database_admin, developer, git_admin and team_admin.
    allProjects Boolean
    Whether or not to apply this permission to all projects for this service token
    permissionSet String
    Set of permissions to apply
    projectId Number
    Project ID to apply this permission to for this service token
    writableEnvironmentCategories List<String>
    What types of environments to apply Write permissions to. Even if Write access is restricted to some environment types, the permission set will have Read access to all environments. The values allowed are all, development, staging, production and other. Not setting a value is the same as selecting all. Not all permission sets support environment level write settings, only analyst, database_admin, developer, git_admin and team_admin.

    Import

    using import blocks (requires Terraform >= 1.5)

    import {

    to = dbtcloud_service_token.my_service_token

    id = “service_token_id”

    }

    import {

    to = dbtcloud_service_token.my_service_token

    id = “12345”

    }

    using the older import command

    $ pulumi import dbtcloud:index/serviceToken:ServiceToken my_service_token "service_token_id"
    
    $ pulumi import dbtcloud:index/serviceToken:ServiceToken my_service_token 12345
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    dbtcloud pulumi/pulumi-dbtcloud
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the dbtcloud Terraform Provider.
    dbtcloud logo
    dbt Cloud v0.1.25 published on Friday, Nov 8, 2024 by Pulumi