dbtcloud.EnvironmentVariable
Explore with Pulumi AI
Note: Some upstream resources can be slow to create, so if creating a project or environment at
the same time as the environment variables, it’s recommended to use the depends_on
meta argument.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as dbtcloud from "@pulumi/dbtcloud";
const dbtMyEnvVar = new dbtcloud.EnvironmentVariable("dbt_my_env_var", {
name: "DBT_MY_ENV_VAR",
projectId: dbtProject.id,
environmentValues: {
project: "my_project_level_value",
Dev: "my_env_level_value",
CI: "my_ci_override_value",
Prod: "my_prod_override_value",
},
}, {
dependsOn: [
dbtProject,
devEnv,
ciEnv,
prodEnv,
],
});
import pulumi
import pulumi_dbtcloud as dbtcloud
dbt_my_env_var = dbtcloud.EnvironmentVariable("dbt_my_env_var",
name="DBT_MY_ENV_VAR",
project_id=dbt_project["id"],
environment_values={
"project": "my_project_level_value",
"Dev": "my_env_level_value",
"CI": "my_ci_override_value",
"Prod": "my_prod_override_value",
},
opts = pulumi.ResourceOptions(depends_on=[
dbt_project,
dev_env,
ci_env,
prod_env,
]))
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.NewEnvironmentVariable(ctx, "dbt_my_env_var", &dbtcloud.EnvironmentVariableArgs{
Name: pulumi.String("DBT_MY_ENV_VAR"),
ProjectId: pulumi.Any(dbtProject.Id),
EnvironmentValues: pulumi.StringMap{
"project": pulumi.String("my_project_level_value"),
"Dev": pulumi.String("my_env_level_value"),
"CI": pulumi.String("my_ci_override_value"),
"Prod": pulumi.String("my_prod_override_value"),
},
}, pulumi.DependsOn([]pulumi.Resource{
dbtProject,
devEnv,
ciEnv,
prodEnv,
}))
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 dbtMyEnvVar = new DbtCloud.EnvironmentVariable("dbt_my_env_var", new()
{
Name = "DBT_MY_ENV_VAR",
ProjectId = dbtProject.Id,
EnvironmentValues =
{
{ "project", "my_project_level_value" },
{ "Dev", "my_env_level_value" },
{ "CI", "my_ci_override_value" },
{ "Prod", "my_prod_override_value" },
},
}, new CustomResourceOptions
{
DependsOn =
{
dbtProject,
devEnv,
ciEnv,
prodEnv,
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.dbtcloud.EnvironmentVariable;
import com.pulumi.dbtcloud.EnvironmentVariableArgs;
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 dbtMyEnvVar = new EnvironmentVariable("dbtMyEnvVar", EnvironmentVariableArgs.builder()
.name("DBT_MY_ENV_VAR")
.projectId(dbtProject.id())
.environmentValues(Map.ofEntries(
Map.entry("project", "my_project_level_value"),
Map.entry("Dev", "my_env_level_value"),
Map.entry("CI", "my_ci_override_value"),
Map.entry("Prod", "my_prod_override_value")
))
.build(), CustomResourceOptions.builder()
.dependsOn(
dbtProject,
devEnv,
ciEnv,
prodEnv)
.build());
}
}
resources:
dbtMyEnvVar:
type: dbtcloud:EnvironmentVariable
name: dbt_my_env_var
properties:
name: DBT_MY_ENV_VAR
projectId: ${dbtProject.id}
environmentValues:
project: my_project_level_value
Dev: my_env_level_value
CI: my_ci_override_value
Prod: my_prod_override_value
options:
dependson:
- ${dbtProject}
- ${devEnv}
- ${ciEnv}
- ${prodEnv}
Create EnvironmentVariable Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new EnvironmentVariable(name: string, args: EnvironmentVariableArgs, opts?: CustomResourceOptions);
@overload
def EnvironmentVariable(resource_name: str,
args: EnvironmentVariableArgs,
opts: Optional[ResourceOptions] = None)
@overload
def EnvironmentVariable(resource_name: str,
opts: Optional[ResourceOptions] = None,
environment_values: Optional[Mapping[str, str]] = None,
project_id: Optional[int] = None,
name: Optional[str] = None)
func NewEnvironmentVariable(ctx *Context, name string, args EnvironmentVariableArgs, opts ...ResourceOption) (*EnvironmentVariable, error)
public EnvironmentVariable(string name, EnvironmentVariableArgs args, CustomResourceOptions? opts = null)
public EnvironmentVariable(String name, EnvironmentVariableArgs args)
public EnvironmentVariable(String name, EnvironmentVariableArgs args, CustomResourceOptions options)
type: dbtcloud:EnvironmentVariable
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 EnvironmentVariableArgs
- 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 EnvironmentVariableArgs
- 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 EnvironmentVariableArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args EnvironmentVariableArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args EnvironmentVariableArgs
- 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 environmentVariableResource = new DbtCloud.EnvironmentVariable("environmentVariableResource", new()
{
EnvironmentValues =
{
{ "string", "string" },
},
ProjectId = 0,
Name = "string",
});
example, err := dbtcloud.NewEnvironmentVariable(ctx, "environmentVariableResource", &dbtcloud.EnvironmentVariableArgs{
EnvironmentValues: pulumi.StringMap{
"string": pulumi.String("string"),
},
ProjectId: pulumi.Int(0),
Name: pulumi.String("string"),
})
var environmentVariableResource = new EnvironmentVariable("environmentVariableResource", EnvironmentVariableArgs.builder()
.environmentValues(Map.of("string", "string"))
.projectId(0)
.name("string")
.build());
environment_variable_resource = dbtcloud.EnvironmentVariable("environmentVariableResource",
environment_values={
"string": "string",
},
project_id=0,
name="string")
const environmentVariableResource = new dbtcloud.EnvironmentVariable("environmentVariableResource", {
environmentValues: {
string: "string",
},
projectId: 0,
name: "string",
});
type: dbtcloud:EnvironmentVariable
properties:
environmentValues:
string: string
name: string
projectId: 0
EnvironmentVariable 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 EnvironmentVariable resource accepts the following input properties:
- Environment
Values Dictionary<string, string> - Map from environment names to respective variable value, a special key
project
should be set for the project default variable value. This field is not set as sensitive so take precautions when using secret environment variables. - Project
Id int - Project for the variable to be created in
- Name string
- Name for the variable, must be unique within a project, must be prefixed with 'DBT_'
- Environment
Values map[string]string - Map from environment names to respective variable value, a special key
project
should be set for the project default variable value. This field is not set as sensitive so take precautions when using secret environment variables. - Project
Id int - Project for the variable to be created in
- Name string
- Name for the variable, must be unique within a project, must be prefixed with 'DBT_'
- environment
Values Map<String,String> - Map from environment names to respective variable value, a special key
project
should be set for the project default variable value. This field is not set as sensitive so take precautions when using secret environment variables. - project
Id Integer - Project for the variable to be created in
- name String
- Name for the variable, must be unique within a project, must be prefixed with 'DBT_'
- environment
Values {[key: string]: string} - Map from environment names to respective variable value, a special key
project
should be set for the project default variable value. This field is not set as sensitive so take precautions when using secret environment variables. - project
Id number - Project for the variable to be created in
- name string
- Name for the variable, must be unique within a project, must be prefixed with 'DBT_'
- environment_
values Mapping[str, str] - Map from environment names to respective variable value, a special key
project
should be set for the project default variable value. This field is not set as sensitive so take precautions when using secret environment variables. - project_
id int - Project for the variable to be created in
- name str
- Name for the variable, must be unique within a project, must be prefixed with 'DBT_'
- environment
Values Map<String> - Map from environment names to respective variable value, a special key
project
should be set for the project default variable value. This field is not set as sensitive so take precautions when using secret environment variables. - project
Id Number - Project for the variable to be created in
- name String
- Name for the variable, must be unique within a project, must be prefixed with 'DBT_'
Outputs
All input properties are implicitly available as output properties. Additionally, the EnvironmentVariable resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
- id string
- The provider-assigned unique ID for this managed resource.
- id str
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing EnvironmentVariable Resource
Get an existing EnvironmentVariable 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?: EnvironmentVariableState, opts?: CustomResourceOptions): EnvironmentVariable
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
environment_values: Optional[Mapping[str, str]] = None,
name: Optional[str] = None,
project_id: Optional[int] = None) -> EnvironmentVariable
func GetEnvironmentVariable(ctx *Context, name string, id IDInput, state *EnvironmentVariableState, opts ...ResourceOption) (*EnvironmentVariable, error)
public static EnvironmentVariable Get(string name, Input<string> id, EnvironmentVariableState? state, CustomResourceOptions? opts = null)
public static EnvironmentVariable get(String name, Output<String> id, EnvironmentVariableState 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.
- Environment
Values Dictionary<string, string> - Map from environment names to respective variable value, a special key
project
should be set for the project default variable value. This field is not set as sensitive so take precautions when using secret environment variables. - Name string
- Name for the variable, must be unique within a project, must be prefixed with 'DBT_'
- Project
Id int - Project for the variable to be created in
- Environment
Values map[string]string - Map from environment names to respective variable value, a special key
project
should be set for the project default variable value. This field is not set as sensitive so take precautions when using secret environment variables. - Name string
- Name for the variable, must be unique within a project, must be prefixed with 'DBT_'
- Project
Id int - Project for the variable to be created in
- environment
Values Map<String,String> - Map from environment names to respective variable value, a special key
project
should be set for the project default variable value. This field is not set as sensitive so take precautions when using secret environment variables. - name String
- Name for the variable, must be unique within a project, must be prefixed with 'DBT_'
- project
Id Integer - Project for the variable to be created in
- environment
Values {[key: string]: string} - Map from environment names to respective variable value, a special key
project
should be set for the project default variable value. This field is not set as sensitive so take precautions when using secret environment variables. - name string
- Name for the variable, must be unique within a project, must be prefixed with 'DBT_'
- project
Id number - Project for the variable to be created in
- environment_
values Mapping[str, str] - Map from environment names to respective variable value, a special key
project
should be set for the project default variable value. This field is not set as sensitive so take precautions when using secret environment variables. - name str
- Name for the variable, must be unique within a project, must be prefixed with 'DBT_'
- project_
id int - Project for the variable to be created in
- environment
Values Map<String> - Map from environment names to respective variable value, a special key
project
should be set for the project default variable value. This field is not set as sensitive so take precautions when using secret environment variables. - name String
- Name for the variable, must be unique within a project, must be prefixed with 'DBT_'
- project
Id Number - Project for the variable to be created in
Import
using import blocks (requires Terraform >= 1.5)
import {
to = dbtcloud_environment_variable.test_environment_variable
id = “project_id:environment_variable_name”
}
import {
to = dbtcloud_environment_variable.test_environment_variable
id = “12345:DBT_ENV_VAR”
}
using the older import command
$ pulumi import dbtcloud:index/environmentVariable:EnvironmentVariable test_environment_variable "project_id:environment_variable_name"
$ pulumi import dbtcloud:index/environmentVariable:EnvironmentVariable test_environment_variable 12345:DBT_ENV_VAR
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.