1. Packages
  2. Vercel
  3. API Docs
  4. SharedEnvironmentVariable
Vercel v1.14.2 published on Sunday, Sep 22, 2024 by Pulumiverse

vercel.SharedEnvironmentVariable

Explore with Pulumi AI

vercel logo
Vercel v1.14.2 published on Sunday, Sep 22, 2024 by Pulumiverse

    Provides a Shared Environment Variable resource.

    A Shared Environment Variable resource defines an Environment Variable that can be shared between multiple Vercel Projects.

    For more detailed information, please see the Vercel documentation.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as vercel from "@pulumiverse/vercel";
    
    const exampleProject = new vercel.Project("exampleProject", {gitRepository: {
        type: "github",
        repo: "vercel/some-repo",
    }});
    // A shared environment variable that will be created
    // and associated with the "example" project.
    const exampleSharedEnvironmentVariable = new vercel.SharedEnvironmentVariable("exampleSharedEnvironmentVariable", {
        key: "EXAMPLE",
        value: "some_value",
        targets: ["production"],
        projectIds: [exampleProject.id],
    });
    
    import pulumi
    import pulumiverse_vercel as vercel
    
    example_project = vercel.Project("exampleProject", git_repository={
        "type": "github",
        "repo": "vercel/some-repo",
    })
    # A shared environment variable that will be created
    # and associated with the "example" project.
    example_shared_environment_variable = vercel.SharedEnvironmentVariable("exampleSharedEnvironmentVariable",
        key="EXAMPLE",
        value="some_value",
        targets=["production"],
        project_ids=[example_project.id])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumiverse/pulumi-vercel/sdk/go/vercel"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		exampleProject, err := vercel.NewProject(ctx, "exampleProject", &vercel.ProjectArgs{
    			GitRepository: &vercel.ProjectGitRepositoryArgs{
    				Type: pulumi.String("github"),
    				Repo: pulumi.String("vercel/some-repo"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		// A shared environment variable that will be created
    		// and associated with the "example" project.
    		_, err = vercel.NewSharedEnvironmentVariable(ctx, "exampleSharedEnvironmentVariable", &vercel.SharedEnvironmentVariableArgs{
    			Key:   pulumi.String("EXAMPLE"),
    			Value: pulumi.String("some_value"),
    			Targets: pulumi.StringArray{
    				pulumi.String("production"),
    			},
    			ProjectIds: pulumi.StringArray{
    				exampleProject.ID(),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Vercel = Pulumiverse.Vercel;
    
    return await Deployment.RunAsync(() => 
    {
        var exampleProject = new Vercel.Project("exampleProject", new()
        {
            GitRepository = new Vercel.Inputs.ProjectGitRepositoryArgs
            {
                Type = "github",
                Repo = "vercel/some-repo",
            },
        });
    
        // A shared environment variable that will be created
        // and associated with the "example" project.
        var exampleSharedEnvironmentVariable = new Vercel.SharedEnvironmentVariable("exampleSharedEnvironmentVariable", new()
        {
            Key = "EXAMPLE",
            Value = "some_value",
            Targets = new[]
            {
                "production",
            },
            ProjectIds = new[]
            {
                exampleProject.Id,
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.vercel.Project;
    import com.pulumi.vercel.ProjectArgs;
    import com.pulumi.vercel.inputs.ProjectGitRepositoryArgs;
    import com.pulumi.vercel.SharedEnvironmentVariable;
    import com.pulumi.vercel.SharedEnvironmentVariableArgs;
    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 exampleProject = new Project("exampleProject", ProjectArgs.builder()
                .gitRepository(ProjectGitRepositoryArgs.builder()
                    .type("github")
                    .repo("vercel/some-repo")
                    .build())
                .build());
    
            // A shared environment variable that will be created
            // and associated with the "example" project.
            var exampleSharedEnvironmentVariable = new SharedEnvironmentVariable("exampleSharedEnvironmentVariable", SharedEnvironmentVariableArgs.builder()
                .key("EXAMPLE")
                .value("some_value")
                .targets("production")
                .projectIds(exampleProject.id())
                .build());
    
        }
    }
    
    resources:
      exampleProject:
        type: vercel:Project
        properties:
          gitRepository:
            type: github
            repo: vercel/some-repo
      # A shared environment variable that will be created
      # and associated with the "example" project.
      exampleSharedEnvironmentVariable:
        type: vercel:SharedEnvironmentVariable
        properties:
          key: EXAMPLE
          value: some_value
          targets:
            - production
          projectIds:
            - ${exampleProject.id}
    

    Create SharedEnvironmentVariable Resource

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

    Constructor syntax

    new SharedEnvironmentVariable(name: string, args: SharedEnvironmentVariableArgs, opts?: CustomResourceOptions);
    @overload
    def SharedEnvironmentVariable(resource_name: str,
                                  args: SharedEnvironmentVariableArgs,
                                  opts: Optional[ResourceOptions] = None)
    
    @overload
    def SharedEnvironmentVariable(resource_name: str,
                                  opts: Optional[ResourceOptions] = None,
                                  key: Optional[str] = None,
                                  project_ids: Optional[Sequence[str]] = None,
                                  targets: Optional[Sequence[str]] = None,
                                  value: Optional[str] = None,
                                  sensitive: Optional[bool] = None,
                                  team_id: Optional[str] = None)
    func NewSharedEnvironmentVariable(ctx *Context, name string, args SharedEnvironmentVariableArgs, opts ...ResourceOption) (*SharedEnvironmentVariable, error)
    public SharedEnvironmentVariable(string name, SharedEnvironmentVariableArgs args, CustomResourceOptions? opts = null)
    public SharedEnvironmentVariable(String name, SharedEnvironmentVariableArgs args)
    public SharedEnvironmentVariable(String name, SharedEnvironmentVariableArgs args, CustomResourceOptions options)
    
    type: vercel:SharedEnvironmentVariable
    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 SharedEnvironmentVariableArgs
    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 SharedEnvironmentVariableArgs
    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 SharedEnvironmentVariableArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args SharedEnvironmentVariableArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args SharedEnvironmentVariableArgs
    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 sharedEnvironmentVariableResource = new Vercel.SharedEnvironmentVariable("sharedEnvironmentVariableResource", new()
    {
        Key = "string",
        ProjectIds = new[]
        {
            "string",
        },
        Targets = new[]
        {
            "string",
        },
        Value = "string",
        Sensitive = false,
        TeamId = "string",
    });
    
    example, err := vercel.NewSharedEnvironmentVariable(ctx, "sharedEnvironmentVariableResource", &vercel.SharedEnvironmentVariableArgs{
    	Key: pulumi.String("string"),
    	ProjectIds: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    	Targets: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    	Value:     pulumi.String("string"),
    	Sensitive: pulumi.Bool(false),
    	TeamId:    pulumi.String("string"),
    })
    
    var sharedEnvironmentVariableResource = new SharedEnvironmentVariable("sharedEnvironmentVariableResource", SharedEnvironmentVariableArgs.builder()
        .key("string")
        .projectIds("string")
        .targets("string")
        .value("string")
        .sensitive(false)
        .teamId("string")
        .build());
    
    shared_environment_variable_resource = vercel.SharedEnvironmentVariable("sharedEnvironmentVariableResource",
        key="string",
        project_ids=["string"],
        targets=["string"],
        value="string",
        sensitive=False,
        team_id="string")
    
    const sharedEnvironmentVariableResource = new vercel.SharedEnvironmentVariable("sharedEnvironmentVariableResource", {
        key: "string",
        projectIds: ["string"],
        targets: ["string"],
        value: "string",
        sensitive: false,
        teamId: "string",
    });
    
    type: vercel:SharedEnvironmentVariable
    properties:
        key: string
        projectIds:
            - string
        sensitive: false
        targets:
            - string
        teamId: string
        value: string
    

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

    Key string
    The name of the Environment Variable.
    ProjectIds List<string>
    The ID of the Vercel project.
    Targets List<string>
    The environments that the Environment Variable should be present on. Valid targets are either production, preview, or development.
    Value string
    The value of the Environment Variable.
    Sensitive bool
    Whether the Environment Variable is sensitive or not. (May be affected by a team-wide environment variable policy)
    TeamId string
    The ID of the Vercel team. Shared environment variables require a team.
    Key string
    The name of the Environment Variable.
    ProjectIds []string
    The ID of the Vercel project.
    Targets []string
    The environments that the Environment Variable should be present on. Valid targets are either production, preview, or development.
    Value string
    The value of the Environment Variable.
    Sensitive bool
    Whether the Environment Variable is sensitive or not. (May be affected by a team-wide environment variable policy)
    TeamId string
    The ID of the Vercel team. Shared environment variables require a team.
    key String
    The name of the Environment Variable.
    projectIds List<String>
    The ID of the Vercel project.
    targets List<String>
    The environments that the Environment Variable should be present on. Valid targets are either production, preview, or development.
    value String
    The value of the Environment Variable.
    sensitive Boolean
    Whether the Environment Variable is sensitive or not. (May be affected by a team-wide environment variable policy)
    teamId String
    The ID of the Vercel team. Shared environment variables require a team.
    key string
    The name of the Environment Variable.
    projectIds string[]
    The ID of the Vercel project.
    targets string[]
    The environments that the Environment Variable should be present on. Valid targets are either production, preview, or development.
    value string
    The value of the Environment Variable.
    sensitive boolean
    Whether the Environment Variable is sensitive or not. (May be affected by a team-wide environment variable policy)
    teamId string
    The ID of the Vercel team. Shared environment variables require a team.
    key str
    The name of the Environment Variable.
    project_ids Sequence[str]
    The ID of the Vercel project.
    targets Sequence[str]
    The environments that the Environment Variable should be present on. Valid targets are either production, preview, or development.
    value str
    The value of the Environment Variable.
    sensitive bool
    Whether the Environment Variable is sensitive or not. (May be affected by a team-wide environment variable policy)
    team_id str
    The ID of the Vercel team. Shared environment variables require a team.
    key String
    The name of the Environment Variable.
    projectIds List<String>
    The ID of the Vercel project.
    targets List<String>
    The environments that the Environment Variable should be present on. Valid targets are either production, preview, or development.
    value String
    The value of the Environment Variable.
    sensitive Boolean
    Whether the Environment Variable is sensitive or not. (May be affected by a team-wide environment variable policy)
    teamId String
    The ID of the Vercel team. Shared environment variables require a team.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the SharedEnvironmentVariable 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 SharedEnvironmentVariable Resource

    Get an existing SharedEnvironmentVariable 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?: SharedEnvironmentVariableState, opts?: CustomResourceOptions): SharedEnvironmentVariable
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            key: Optional[str] = None,
            project_ids: Optional[Sequence[str]] = None,
            sensitive: Optional[bool] = None,
            targets: Optional[Sequence[str]] = None,
            team_id: Optional[str] = None,
            value: Optional[str] = None) -> SharedEnvironmentVariable
    func GetSharedEnvironmentVariable(ctx *Context, name string, id IDInput, state *SharedEnvironmentVariableState, opts ...ResourceOption) (*SharedEnvironmentVariable, error)
    public static SharedEnvironmentVariable Get(string name, Input<string> id, SharedEnvironmentVariableState? state, CustomResourceOptions? opts = null)
    public static SharedEnvironmentVariable get(String name, Output<String> id, SharedEnvironmentVariableState 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:
    Key string
    The name of the Environment Variable.
    ProjectIds List<string>
    The ID of the Vercel project.
    Sensitive bool
    Whether the Environment Variable is sensitive or not. (May be affected by a team-wide environment variable policy)
    Targets List<string>
    The environments that the Environment Variable should be present on. Valid targets are either production, preview, or development.
    TeamId string
    The ID of the Vercel team. Shared environment variables require a team.
    Value string
    The value of the Environment Variable.
    Key string
    The name of the Environment Variable.
    ProjectIds []string
    The ID of the Vercel project.
    Sensitive bool
    Whether the Environment Variable is sensitive or not. (May be affected by a team-wide environment variable policy)
    Targets []string
    The environments that the Environment Variable should be present on. Valid targets are either production, preview, or development.
    TeamId string
    The ID of the Vercel team. Shared environment variables require a team.
    Value string
    The value of the Environment Variable.
    key String
    The name of the Environment Variable.
    projectIds List<String>
    The ID of the Vercel project.
    sensitive Boolean
    Whether the Environment Variable is sensitive or not. (May be affected by a team-wide environment variable policy)
    targets List<String>
    The environments that the Environment Variable should be present on. Valid targets are either production, preview, or development.
    teamId String
    The ID of the Vercel team. Shared environment variables require a team.
    value String
    The value of the Environment Variable.
    key string
    The name of the Environment Variable.
    projectIds string[]
    The ID of the Vercel project.
    sensitive boolean
    Whether the Environment Variable is sensitive or not. (May be affected by a team-wide environment variable policy)
    targets string[]
    The environments that the Environment Variable should be present on. Valid targets are either production, preview, or development.
    teamId string
    The ID of the Vercel team. Shared environment variables require a team.
    value string
    The value of the Environment Variable.
    key str
    The name of the Environment Variable.
    project_ids Sequence[str]
    The ID of the Vercel project.
    sensitive bool
    Whether the Environment Variable is sensitive or not. (May be affected by a team-wide environment variable policy)
    targets Sequence[str]
    The environments that the Environment Variable should be present on. Valid targets are either production, preview, or development.
    team_id str
    The ID of the Vercel team. Shared environment variables require a team.
    value str
    The value of the Environment Variable.
    key String
    The name of the Environment Variable.
    projectIds List<String>
    The ID of the Vercel project.
    sensitive Boolean
    Whether the Environment Variable is sensitive or not. (May be affected by a team-wide environment variable policy)
    targets List<String>
    The environments that the Environment Variable should be present on. Valid targets are either production, preview, or development.
    teamId String
    The ID of the Vercel team. Shared environment variables require a team.
    value String
    The value of the Environment Variable.

    Import

    You can import via the team_id and environment variable id.

    • team_id can be found in the team settings tab in the Vercel UI.

    • environment variable id can be taken from the network tab inside developer tools, while you are on the project page.

    Note also, that the value field for sensitive environment variables will be imported as null.

    $ pulumi import vercel:index/sharedEnvironmentVariable:SharedEnvironmentVariable example team_xxxxxxxxxxxxxxxxxxxxxxxx/env_yyyyyyyyyyyyy
    

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

    Package Details

    Repository
    vercel pulumiverse/pulumi-vercel
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the vercel Terraform Provider.
    vercel logo
    Vercel v1.14.2 published on Sunday, Sep 22, 2024 by Pulumiverse