1. Packages
  2. Vercel Provider
  3. API Docs
  4. getSharedEnvironmentVariable
Vercel v3.1.2 published on Tuesday, May 13, 2025 by Pulumiverse

vercel.getSharedEnvironmentVariable

Explore with Pulumi AI

vercel logo
Vercel v3.1.2 published on Tuesday, May 13, 2025 by Pulumiverse

    Provides information about an existing Shared Environment Variable within Vercel.

    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 "@pulumi/vercel";
    
    // Environment variables can be identified by their ID, or by their key and target.
    // The ID can be taken from the network tab inside developer tools, while you are on the project page.
    const example = vercel.getSharedEnvironmentVariable({
        id: "xxxxxxxxxxxxxxx",
    });
    // Alternatively, you can use the key and target to identify the environment variable.
    // Note that all `target`s must be specified for a match to be found.
    const exampleByKeyAndTarget = vercel.getSharedEnvironmentVariable({
        key: "MY_ENV_VAR",
        targets: [
            "production",
            "preview",
        ],
    });
    
    import pulumi
    import pulumi_vercel as vercel
    
    # Environment variables can be identified by their ID, or by their key and target.
    # The ID can be taken from the network tab inside developer tools, while you are on the project page.
    example = vercel.get_shared_environment_variable(id="xxxxxxxxxxxxxxx")
    # Alternatively, you can use the key and target to identify the environment variable.
    # Note that all `target`s must be specified for a match to be found.
    example_by_key_and_target = vercel.get_shared_environment_variable(key="MY_ENV_VAR",
        targets=[
            "production",
            "preview",
        ])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumiverse/pulumi-vercel/sdk/v3/go/vercel"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		// Environment variables can be identified by their ID, or by their key and target.
    		// The ID can be taken from the network tab inside developer tools, while you are on the project page.
    		_, err := vercel.LookupSharedEnvironmentVariable(ctx, &vercel.LookupSharedEnvironmentVariableArgs{
    			Id: pulumi.StringRef("xxxxxxxxxxxxxxx"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		// Alternatively, you can use the key and target to identify the environment variable.
    		// Note that all `target`s must be specified for a match to be found.
    		_, err = vercel.LookupSharedEnvironmentVariable(ctx, &vercel.LookupSharedEnvironmentVariableArgs{
    			Key: pulumi.StringRef("MY_ENV_VAR"),
    			Targets: []string{
    				"production",
    				"preview",
    			},
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Vercel = Pulumi.Vercel;
    
    return await Deployment.RunAsync(() => 
    {
        // Environment variables can be identified by their ID, or by their key and target.
        // The ID can be taken from the network tab inside developer tools, while you are on the project page.
        var example = Vercel.GetSharedEnvironmentVariable.Invoke(new()
        {
            Id = "xxxxxxxxxxxxxxx",
        });
    
        // Alternatively, you can use the key and target to identify the environment variable.
        // Note that all `target`s must be specified for a match to be found.
        var exampleByKeyAndTarget = Vercel.GetSharedEnvironmentVariable.Invoke(new()
        {
            Key = "MY_ENV_VAR",
            Targets = new[]
            {
                "production",
                "preview",
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.vercel.VercelFunctions;
    import com.pulumi.vercel.inputs.GetSharedEnvironmentVariableArgs;
    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) {
            // Environment variables can be identified by their ID, or by their key and target.
            // The ID can be taken from the network tab inside developer tools, while you are on the project page.
            final var example = VercelFunctions.getSharedEnvironmentVariable(GetSharedEnvironmentVariableArgs.builder()
                .id("xxxxxxxxxxxxxxx")
                .build());
    
            // Alternatively, you can use the key and target to identify the environment variable.
            // Note that all `target`s must be specified for a match to be found.
            final var exampleByKeyAndTarget = VercelFunctions.getSharedEnvironmentVariable(GetSharedEnvironmentVariableArgs.builder()
                .key("MY_ENV_VAR")
                .targets(            
                    "production",
                    "preview")
                .build());
    
        }
    }
    
    variables:
      # Environment variables can be identified by their ID, or by their key and target.
      # The ID can be taken from the network tab inside developer tools, while you are on the project page.
      example:
        fn::invoke:
          Function: vercel:getSharedEnvironmentVariable
          Arguments:
            id: xxxxxxxxxxxxxxx
      # Alternatively, you can use the key and target to identify the environment variable.
      # Note that all `target`s must be specified for a match to be found.
      exampleByKeyAndTarget:
        fn::invoke:
          Function: vercel:getSharedEnvironmentVariable
          Arguments:
            key: MY_ENV_VAR
            targets:
              - production
              - preview
    

    Using getSharedEnvironmentVariable

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getSharedEnvironmentVariable(args: GetSharedEnvironmentVariableArgs, opts?: InvokeOptions): Promise<GetSharedEnvironmentVariableResult>
    function getSharedEnvironmentVariableOutput(args: GetSharedEnvironmentVariableOutputArgs, opts?: InvokeOptions): Output<GetSharedEnvironmentVariableResult>
    def get_shared_environment_variable(id: Optional[str] = None,
                                        key: Optional[str] = None,
                                        targets: Optional[Sequence[str]] = None,
                                        team_id: Optional[str] = None,
                                        opts: Optional[InvokeOptions] = None) -> GetSharedEnvironmentVariableResult
    def get_shared_environment_variable_output(id: Optional[pulumi.Input[str]] = None,
                                        key: Optional[pulumi.Input[str]] = None,
                                        targets: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                                        team_id: Optional[pulumi.Input[str]] = None,
                                        opts: Optional[InvokeOptions] = None) -> Output[GetSharedEnvironmentVariableResult]
    func LookupSharedEnvironmentVariable(ctx *Context, args *LookupSharedEnvironmentVariableArgs, opts ...InvokeOption) (*LookupSharedEnvironmentVariableResult, error)
    func LookupSharedEnvironmentVariableOutput(ctx *Context, args *LookupSharedEnvironmentVariableOutputArgs, opts ...InvokeOption) LookupSharedEnvironmentVariableResultOutput

    > Note: This function is named LookupSharedEnvironmentVariable in the Go SDK.

    public static class GetSharedEnvironmentVariable 
    {
        public static Task<GetSharedEnvironmentVariableResult> InvokeAsync(GetSharedEnvironmentVariableArgs args, InvokeOptions? opts = null)
        public static Output<GetSharedEnvironmentVariableResult> Invoke(GetSharedEnvironmentVariableInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetSharedEnvironmentVariableResult> getSharedEnvironmentVariable(GetSharedEnvironmentVariableArgs args, InvokeOptions options)
    public static Output<GetSharedEnvironmentVariableResult> getSharedEnvironmentVariable(GetSharedEnvironmentVariableArgs args, InvokeOptions options)
    
    fn::invoke:
      function: vercel:index/getSharedEnvironmentVariable:getSharedEnvironmentVariable
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Id string
    The ID of the Environment Variable.
    Key string
    The name of the Environment Variable.
    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.
    Id string
    The ID of the Environment Variable.
    Key string
    The name of the Environment Variable.
    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.
    id String
    The ID of the Environment Variable.
    key String
    The name of the Environment Variable.
    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.
    id string
    The ID of the Environment Variable.
    key string
    The name of the Environment Variable.
    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.
    id str
    The ID of the Environment Variable.
    key str
    The name of the Environment Variable.
    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.
    id String
    The ID of the Environment Variable.
    key String
    The name of the Environment Variable.
    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.

    getSharedEnvironmentVariable Result

    The following output properties are available:

    Comment string
    A comment explaining what the environment variable is for.
    Id string
    The ID of the Environment Variable.
    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.
    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.
    Comment string
    A comment explaining what the environment variable is for.
    Id string
    The ID 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.
    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.
    comment String
    A comment explaining what the environment variable is for.
    id String
    The ID 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.
    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.
    comment string
    A comment explaining what the environment variable is for.
    id string
    The ID 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.
    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.
    comment str
    A comment explaining what the environment variable is for.
    id str
    The ID 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.
    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.
    comment String
    A comment explaining what the environment variable is for.
    id String
    The ID 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.
    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.

    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 v3.1.2 published on Tuesday, May 13, 2025 by Pulumiverse