1. Packages
  2. dbt Cloud
  3. API Docs
  4. ExtendedAttributes
dbt Cloud v0.1.8 published on Tuesday, Jun 11, 2024 by Pulumi

dbtcloud.ExtendedAttributes

Explore with Pulumi AI

dbtcloud logo
dbt Cloud v0.1.8 published on Tuesday, Jun 11, 2024 by Pulumi

    This resource allows setting extended attributes which can be assigned to a given environment (see docs).

    In dbt Cloud those values are provided as YML but in the provider they need to be provided as JSON (see example below).

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as dbtcloud from "@pulumi/dbtcloud";
    
    // extended_attributes can be set as a raw JSON string or encoded with Terraform's `jsonencode()` function
    // we recommend using `jsonencode()` to avoid Terraform reporting changes due to whitespaces or keys ordering
    const myAttributes = new dbtcloud.ExtendedAttributes("my_attributes", {
        extendedAttributes: JSON.stringify({
            type: "databricks",
            catalog: "dbt_catalog",
            http_path: "/sql/your/http/path",
            my_nested_field: {
                subfield: "my_value",
            },
        }),
        projectId: dbtProject.id,
    });
    const issueDepl = new dbtcloud.Environment("issue_depl", {
        dbtVersion: "versionless",
        name: "My environment",
        projectId: dbtProject.id,
        type: "deployment",
        useCustomBranch: false,
        credentialId: dbtCredentialId,
        deploymentType: "production",
        extendedAttributesId: myAttributes.extendedAttributesId,
    });
    
    import pulumi
    import json
    import pulumi_dbtcloud as dbtcloud
    
    # extended_attributes can be set as a raw JSON string or encoded with Terraform's `jsonencode()` function
    # we recommend using `jsonencode()` to avoid Terraform reporting changes due to whitespaces or keys ordering
    my_attributes = dbtcloud.ExtendedAttributes("my_attributes",
        extended_attributes=json.dumps({
            "type": "databricks",
            "catalog": "dbt_catalog",
            "http_path": "/sql/your/http/path",
            "my_nested_field": {
                "subfield": "my_value",
            },
        }),
        project_id=dbt_project["id"])
    issue_depl = dbtcloud.Environment("issue_depl",
        dbt_version="versionless",
        name="My environment",
        project_id=dbt_project["id"],
        type="deployment",
        use_custom_branch=False,
        credential_id=dbt_credential_id,
        deployment_type="production",
        extended_attributes_id=my_attributes.extended_attributes_id)
    
    package main
    
    import (
    	"encoding/json"
    
    	"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 {
    		tmpJSON0, err := json.Marshal(map[string]interface{}{
    			"type":      "databricks",
    			"catalog":   "dbt_catalog",
    			"http_path": "/sql/your/http/path",
    			"my_nested_field": map[string]interface{}{
    				"subfield": "my_value",
    			},
    		})
    		if err != nil {
    			return err
    		}
    		json0 := string(tmpJSON0)
    		// extended_attributes can be set as a raw JSON string or encoded with Terraform's `jsonencode()` function
    		// we recommend using `jsonencode()` to avoid Terraform reporting changes due to whitespaces or keys ordering
    		myAttributes, err := dbtcloud.NewExtendedAttributes(ctx, "my_attributes", &dbtcloud.ExtendedAttributesArgs{
    			ExtendedAttributes: pulumi.String(json0),
    			ProjectId:          pulumi.Any(dbtProject.Id),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = dbtcloud.NewEnvironment(ctx, "issue_depl", &dbtcloud.EnvironmentArgs{
    			DbtVersion:           pulumi.String("versionless"),
    			Name:                 pulumi.String("My environment"),
    			ProjectId:            pulumi.Any(dbtProject.Id),
    			Type:                 pulumi.String("deployment"),
    			UseCustomBranch:      pulumi.Bool(false),
    			CredentialId:         pulumi.Any(dbtCredentialId),
    			DeploymentType:       pulumi.String("production"),
    			ExtendedAttributesId: myAttributes.ExtendedAttributesId,
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using System.Text.Json;
    using Pulumi;
    using DbtCloud = Pulumi.DbtCloud;
    
    return await Deployment.RunAsync(() => 
    {
        // extended_attributes can be set as a raw JSON string or encoded with Terraform's `jsonencode()` function
        // we recommend using `jsonencode()` to avoid Terraform reporting changes due to whitespaces or keys ordering
        var myAttributes = new DbtCloud.ExtendedAttributesDetails("my_attributes", new()
        {
            ExtendedAttributes = JsonSerializer.Serialize(new Dictionary<string, object?>
            {
                ["type"] = "databricks",
                ["catalog"] = "dbt_catalog",
                ["http_path"] = "/sql/your/http/path",
                ["my_nested_field"] = new Dictionary<string, object?>
                {
                    ["subfield"] = "my_value",
                },
            }),
            ProjectId = dbtProject.Id,
        });
    
        var issueDepl = new DbtCloud.Environment("issue_depl", new()
        {
            DbtVersion = "versionless",
            Name = "My environment",
            ProjectId = dbtProject.Id,
            Type = "deployment",
            UseCustomBranch = false,
            CredentialId = dbtCredentialId,
            DeploymentType = "production",
            ExtendedAttributesId = myAttributes.ExtendedAttributesId,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.dbtcloud.ExtendedAttributes;
    import com.pulumi.dbtcloud.ExtendedAttributesArgs;
    import com.pulumi.dbtcloud.Environment;
    import com.pulumi.dbtcloud.EnvironmentArgs;
    import static com.pulumi.codegen.internal.Serialization.*;
    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) {
            // extended_attributes can be set as a raw JSON string or encoded with Terraform's `jsonencode()` function
            // we recommend using `jsonencode()` to avoid Terraform reporting changes due to whitespaces or keys ordering
            var myAttributes = new ExtendedAttributes("myAttributes", ExtendedAttributesArgs.builder()
                .extendedAttributes(serializeJson(
                    jsonObject(
                        jsonProperty("type", "databricks"),
                        jsonProperty("catalog", "dbt_catalog"),
                        jsonProperty("http_path", "/sql/your/http/path"),
                        jsonProperty("my_nested_field", jsonObject(
                            jsonProperty("subfield", "my_value")
                        ))
                    )))
                .projectId(dbtProject.id())
                .build());
    
            var issueDepl = new Environment("issueDepl", EnvironmentArgs.builder()
                .dbtVersion("versionless")
                .name("My environment")
                .projectId(dbtProject.id())
                .type("deployment")
                .useCustomBranch(false)
                .credentialId(dbtCredentialId)
                .deploymentType("production")
                .extendedAttributesId(myAttributes.extendedAttributesId())
                .build());
    
        }
    }
    
    resources:
      # extended_attributes can be set as a raw JSON string or encoded with Terraform's `jsonencode()` function
      # we recommend using `jsonencode()` to avoid Terraform reporting changes due to whitespaces or keys ordering
      myAttributes:
        type: dbtcloud:ExtendedAttributes
        name: my_attributes
        properties:
          extendedAttributes:
            fn::toJSON:
              type: databricks
              catalog: dbt_catalog
              http_path: /sql/your/http/path
              my_nested_field:
                subfield: my_value
          projectId: ${dbtProject.id}
      issueDepl:
        type: dbtcloud:Environment
        name: issue_depl
        properties:
          dbtVersion: versionless
          name: My environment
          projectId: ${dbtProject.id}
          type: deployment
          useCustomBranch: false
          credentialId: ${dbtCredentialId}
          deploymentType: production
          extendedAttributesId: ${myAttributes.extendedAttributesId}
    

    Create ExtendedAttributes Resource

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

    Constructor syntax

    new ExtendedAttributes(name: string, args: ExtendedAttributesArgs, opts?: CustomResourceOptions);
    @overload
    def ExtendedAttributes(resource_name: str,
                           args: ExtendedAttributesArgs,
                           opts: Optional[ResourceOptions] = None)
    
    @overload
    def ExtendedAttributes(resource_name: str,
                           opts: Optional[ResourceOptions] = None,
                           extended_attributes: Optional[str] = None,
                           project_id: Optional[int] = None,
                           state: Optional[int] = None)
    func NewExtendedAttributes(ctx *Context, name string, args ExtendedAttributesArgs, opts ...ResourceOption) (*ExtendedAttributes, error)
    public ExtendedAttributes(string name, ExtendedAttributesArgs args, CustomResourceOptions? opts = null)
    public ExtendedAttributes(String name, ExtendedAttributesArgs args)
    public ExtendedAttributes(String name, ExtendedAttributesArgs args, CustomResourceOptions options)
    
    type: dbtcloud:ExtendedAttributes
    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 ExtendedAttributesArgs
    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 ExtendedAttributesArgs
    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 ExtendedAttributesArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ExtendedAttributesArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ExtendedAttributesArgs
    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 extendedAttributesResource = new DbtCloud.ExtendedAttributesDetails("extendedAttributesResource", new()
    {
        ExtendedAttributes = "string",
        ProjectId = 0,
        State = 0,
    });
    
    example, err := dbtcloud.NewExtendedAttributes(ctx, "extendedAttributesResource", &dbtcloud.ExtendedAttributesArgs{
    	ExtendedAttributes: pulumi.String("string"),
    	ProjectId:          pulumi.Int(0),
    	State:              pulumi.Int(0),
    })
    
    var extendedAttributesResource = new ExtendedAttributes("extendedAttributesResource", ExtendedAttributesArgs.builder()
        .extendedAttributes("string")
        .projectId(0)
        .state(0)
        .build());
    
    extended_attributes_resource = dbtcloud.ExtendedAttributes("extendedAttributesResource",
        extended_attributes="string",
        project_id=0,
        state=0)
    
    const extendedAttributesResource = new dbtcloud.ExtendedAttributes("extendedAttributesResource", {
        extendedAttributes: "string",
        projectId: 0,
        state: 0,
    });
    
    type: dbtcloud:ExtendedAttributes
    properties:
        extendedAttributes: string
        projectId: 0
        state: 0
    

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

    ExtendedAttributes string
    ProjectId int
    Project ID to create the extended attributes in
    State int
    Extended Attributes state (1 is active, 2 is inactive)
    ExtendedAttributes string
    ProjectId int
    Project ID to create the extended attributes in
    State int
    Extended Attributes state (1 is active, 2 is inactive)
    extendedAttributes String
    projectId Integer
    Project ID to create the extended attributes in
    state Integer
    Extended Attributes state (1 is active, 2 is inactive)
    extendedAttributes string
    projectId number
    Project ID to create the extended attributes in
    state number
    Extended Attributes state (1 is active, 2 is inactive)
    extended_attributes str
    project_id int
    Project ID to create the extended attributes in
    state int
    Extended Attributes state (1 is active, 2 is inactive)
    extendedAttributes String
    projectId Number
    Project ID to create the extended attributes in
    state Number
    Extended Attributes state (1 is active, 2 is inactive)

    Outputs

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

    ExtendedAttributesId int
    Extended Attributes ID
    Id string
    The provider-assigned unique ID for this managed resource.
    ExtendedAttributesId int
    Extended Attributes ID
    Id string
    The provider-assigned unique ID for this managed resource.
    extendedAttributesId Integer
    Extended Attributes ID
    id String
    The provider-assigned unique ID for this managed resource.
    extendedAttributesId number
    Extended Attributes ID
    id string
    The provider-assigned unique ID for this managed resource.
    extended_attributes_id int
    Extended Attributes ID
    id str
    The provider-assigned unique ID for this managed resource.
    extendedAttributesId Number
    Extended Attributes ID
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing ExtendedAttributes Resource

    Get an existing ExtendedAttributes 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?: ExtendedAttributesState, opts?: CustomResourceOptions): ExtendedAttributes
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            extended_attributes: Optional[str] = None,
            extended_attributes_id: Optional[int] = None,
            project_id: Optional[int] = None,
            state: Optional[int] = None) -> ExtendedAttributes
    func GetExtendedAttributes(ctx *Context, name string, id IDInput, state *ExtendedAttributesState, opts ...ResourceOption) (*ExtendedAttributes, error)
    public static ExtendedAttributes Get(string name, Input<string> id, ExtendedAttributesState? state, CustomResourceOptions? opts = null)
    public static ExtendedAttributes get(String name, Output<String> id, ExtendedAttributesState 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:
    ExtendedAttributes string
    ExtendedAttributesId int
    Extended Attributes ID
    ProjectId int
    Project ID to create the extended attributes in
    State int
    Extended Attributes state (1 is active, 2 is inactive)
    ExtendedAttributes string
    ExtendedAttributesId int
    Extended Attributes ID
    ProjectId int
    Project ID to create the extended attributes in
    State int
    Extended Attributes state (1 is active, 2 is inactive)
    extendedAttributes String
    extendedAttributesId Integer
    Extended Attributes ID
    projectId Integer
    Project ID to create the extended attributes in
    state Integer
    Extended Attributes state (1 is active, 2 is inactive)
    extendedAttributes string
    extendedAttributesId number
    Extended Attributes ID
    projectId number
    Project ID to create the extended attributes in
    state number
    Extended Attributes state (1 is active, 2 is inactive)
    extended_attributes str
    extended_attributes_id int
    Extended Attributes ID
    project_id int
    Project ID to create the extended attributes in
    state int
    Extended Attributes state (1 is active, 2 is inactive)
    extendedAttributes String
    extendedAttributesId Number
    Extended Attributes ID
    projectId Number
    Project ID to create the extended attributes in
    state Number
    Extended Attributes state (1 is active, 2 is inactive)

    Import

    using import blocks (requires Terraform >= 1.5)

    import {

    to = dbtcloud_extended_attributes.test_extended_attributes

    id = “project_id_id:extended_attributes_id”

    }

    import {

    to = dbtcloud_extended_attributes.test_extended_attributes

    id = “12345:6789”

    }

    using the older import command

    $ pulumi import dbtcloud:index/extendedAttributes:ExtendedAttributes test_extended_attributes "project_id_id:extended_attributes_id"
    
    $ pulumi import dbtcloud:index/extendedAttributes:ExtendedAttributes test_extended_attributes 12345:6789
    

    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.8 published on Tuesday, Jun 11, 2024 by Pulumi