1. Packages
  2. Vercel
  3. API Docs
  4. getSharedEnvironmentVariable
Vercel v1.14.3 published on Monday, Oct 7, 2024 by Pulumiverse

vercel.getSharedEnvironmentVariable

Explore with Pulumi AI

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";

const example = vercel.getSharedEnvironmentVariable({
    id: "xxxxxxxxxxxxxxx",
});
const exampleByKeyAndTarget = vercel.getSharedEnvironmentVariable({
    key: "MY_ENV_VAR",
    targets: [
        "production",
        "preview",
    ],
});
Copy
import pulumi
import pulumi_vercel as vercel

example = vercel.get_shared_environment_variable(id="xxxxxxxxxxxxxxx")
example_by_key_and_target = vercel.get_shared_environment_variable(key="MY_ENV_VAR",
    targets=[
        "production",
        "preview",
    ])
Copy
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 {
		_, err := vercel.LookupSharedEnvironmentVariable(ctx, &vercel.LookupSharedEnvironmentVariableArgs{
			Id: pulumi.StringRef("xxxxxxxxxxxxxxx"),
		}, nil)
		if err != nil {
			return err
		}
		_, err = vercel.LookupSharedEnvironmentVariable(ctx, &vercel.LookupSharedEnvironmentVariableArgs{
			Key: pulumi.StringRef("MY_ENV_VAR"),
			Targets: []string{
				"production",
				"preview",
			},
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Vercel = Pulumi.Vercel;

return await Deployment.RunAsync(() => 
{
    var example = Vercel.GetSharedEnvironmentVariable.Invoke(new()
    {
        Id = "xxxxxxxxxxxxxxx",
    });

    var exampleByKeyAndTarget = Vercel.GetSharedEnvironmentVariable.Invoke(new()
    {
        Key = "MY_ENV_VAR",
        Targets = new[]
        {
            "production",
            "preview",
        },
    });

});
Copy
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) {
        final var example = VercelFunctions.getSharedEnvironmentVariable(GetSharedEnvironmentVariableArgs.builder()
            .id("xxxxxxxxxxxxxxx")
            .build());

        final var exampleByKeyAndTarget = VercelFunctions.getSharedEnvironmentVariable(GetSharedEnvironmentVariableArgs.builder()
            .key("MY_ENV_VAR")
            .targets(            
                "production",
                "preview")
            .build());

    }
}
Copy
variables:
  example:
    fn::invoke:
      Function: vercel:getSharedEnvironmentVariable
      Arguments:
        id: xxxxxxxxxxxxxxx
  exampleByKeyAndTarget:
    fn::invoke:
      Function: vercel:getSharedEnvironmentVariable
      Arguments:
        key: MY_ENV_VAR
        targets:
          - production
          - preview
Copy

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>
Copy
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]
Copy
func LookupSharedEnvironmentVariable(ctx *Context, args *LookupSharedEnvironmentVariableArgs, opts ...InvokeOption) (*LookupSharedEnvironmentVariableResult, error)
func LookupSharedEnvironmentVariableOutput(ctx *Context, args *LookupSharedEnvironmentVariableOutputArgs, opts ...InvokeOption) LookupSharedEnvironmentVariableResultOutput
Copy

> 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)
}
Copy
public static CompletableFuture<GetSharedEnvironmentVariableResult> getSharedEnvironmentVariable(GetSharedEnvironmentVariableArgs args, InvokeOptions options)
public static Output<GetSharedEnvironmentVariableResult> getSharedEnvironmentVariable(GetSharedEnvironmentVariableArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: vercel:index/getSharedEnvironmentVariable:getSharedEnvironmentVariable
  arguments:
    # arguments dictionary
Copy

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:

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.
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.
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.
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.
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.
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.