1. Packages
  2. Vercel Provider
  3. API Docs
  4. SharedEnvironmentVariableProjectLink
Vercel v3.2.1 published on Wednesday, May 14, 2025 by Pulumiverse

vercel.SharedEnvironmentVariableProjectLink

Explore with Pulumi AI

vercel logo
Vercel v3.2.1 published on Wednesday, May 14, 2025 by Pulumiverse

    Links a project to a Shared Environment Variable.

    This resource is intended to be used alongside a vercel.SharedEnvironmentVariable Data Source, not the Resource. The Resource also defines which projects to link to the shared environment variable, and using both vercel.SharedEnvironmentVariable and vercel.SharedEnvironmentVariableProjectLink together results in undefined behavior.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as vercel from "@pulumi/vercel";
    import * as vercel from "@pulumiverse/vercel";
    
    const example = vercel.getSharedEnvironmentVariable({
        key: "EXAMPLE_ENV_VAR",
        targets: [
            "production",
            "preview",
        ],
    });
    const exampleProject = new vercel.Project("example", {name: "example"});
    const exampleSharedEnvironmentVariableProjectLink = new vercel.SharedEnvironmentVariableProjectLink("example", {
        sharedEnvironmentVariableId: example.then(example => example.id),
        projectId: exampleProject.id,
    });
    
    import pulumi
    import pulumi_vercel as vercel
    import pulumiverse_vercel as vercel
    
    example = vercel.get_shared_environment_variable(key="EXAMPLE_ENV_VAR",
        targets=[
            "production",
            "preview",
        ])
    example_project = vercel.Project("example", name="example")
    example_shared_environment_variable_project_link = vercel.SharedEnvironmentVariableProjectLink("example",
        shared_environment_variable_id=example.id,
        project_id=example_project.id)
    
    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 {
    		example, err := vercel.LookupSharedEnvironmentVariable(ctx, &vercel.LookupSharedEnvironmentVariableArgs{
    			Key: pulumi.StringRef("EXAMPLE_ENV_VAR"),
    			Targets: []string{
    				"production",
    				"preview",
    			},
    		}, nil)
    		if err != nil {
    			return err
    		}
    		exampleProject, err := vercel.NewProject(ctx, "example", &vercel.ProjectArgs{
    			Name: pulumi.String("example"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = vercel.NewSharedEnvironmentVariableProjectLink(ctx, "example", &vercel.SharedEnvironmentVariableProjectLinkArgs{
    			SharedEnvironmentVariableId: pulumi.String(example.Id),
    			ProjectId:                   exampleProject.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Vercel = Pulumi.Vercel;
    using Vercel = Pulumiverse.Vercel;
    
    return await Deployment.RunAsync(() => 
    {
        var example = Vercel.GetSharedEnvironmentVariable.Invoke(new()
        {
            Key = "EXAMPLE_ENV_VAR",
            Targets = new[]
            {
                "production",
                "preview",
            },
        });
    
        var exampleProject = new Vercel.Project("example", new()
        {
            Name = "example",
        });
    
        var exampleSharedEnvironmentVariableProjectLink = new Vercel.SharedEnvironmentVariableProjectLink("example", new()
        {
            SharedEnvironmentVariableId = example.Apply(getSharedEnvironmentVariableResult => getSharedEnvironmentVariableResult.Id),
            ProjectId = exampleProject.Id,
        });
    
    });
    
    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 com.pulumi.vercel.Project;
    import com.pulumi.vercel.ProjectArgs;
    import com.pulumi.vercel.SharedEnvironmentVariableProjectLink;
    import com.pulumi.vercel.SharedEnvironmentVariableProjectLinkArgs;
    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()
                .key("EXAMPLE_ENV_VAR")
                .targets(            
                    "production",
                    "preview")
                .build());
    
            var exampleProject = new Project("exampleProject", ProjectArgs.builder()
                .name("example")
                .build());
    
            var exampleSharedEnvironmentVariableProjectLink = new SharedEnvironmentVariableProjectLink("exampleSharedEnvironmentVariableProjectLink", SharedEnvironmentVariableProjectLinkArgs.builder()
                .sharedEnvironmentVariableId(example.applyValue(getSharedEnvironmentVariableResult -> getSharedEnvironmentVariableResult.id()))
                .projectId(exampleProject.id())
                .build());
    
        }
    }
    
    resources:
      exampleProject:
        type: vercel:Project
        name: example
        properties:
          name: example
      exampleSharedEnvironmentVariableProjectLink:
        type: vercel:SharedEnvironmentVariableProjectLink
        name: example
        properties:
          sharedEnvironmentVariableId: ${example.id}
          projectId: ${exampleProject.id}
    variables:
      example:
        fn::invoke:
          Function: vercel:getSharedEnvironmentVariable
          Arguments:
            key: EXAMPLE_ENV_VAR
            targets:
              - production
              - preview
    

    Create SharedEnvironmentVariableProjectLink Resource

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

    Constructor syntax

    new SharedEnvironmentVariableProjectLink(name: string, args: SharedEnvironmentVariableProjectLinkArgs, opts?: CustomResourceOptions);
    @overload
    def SharedEnvironmentVariableProjectLink(resource_name: str,
                                             args: SharedEnvironmentVariableProjectLinkArgs,
                                             opts: Optional[ResourceOptions] = None)
    
    @overload
    def SharedEnvironmentVariableProjectLink(resource_name: str,
                                             opts: Optional[ResourceOptions] = None,
                                             project_id: Optional[str] = None,
                                             shared_environment_variable_id: Optional[str] = None,
                                             team_id: Optional[str] = None)
    func NewSharedEnvironmentVariableProjectLink(ctx *Context, name string, args SharedEnvironmentVariableProjectLinkArgs, opts ...ResourceOption) (*SharedEnvironmentVariableProjectLink, error)
    public SharedEnvironmentVariableProjectLink(string name, SharedEnvironmentVariableProjectLinkArgs args, CustomResourceOptions? opts = null)
    public SharedEnvironmentVariableProjectLink(String name, SharedEnvironmentVariableProjectLinkArgs args)
    public SharedEnvironmentVariableProjectLink(String name, SharedEnvironmentVariableProjectLinkArgs args, CustomResourceOptions options)
    
    type: vercel:SharedEnvironmentVariableProjectLink
    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 SharedEnvironmentVariableProjectLinkArgs
    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 SharedEnvironmentVariableProjectLinkArgs
    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 SharedEnvironmentVariableProjectLinkArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args SharedEnvironmentVariableProjectLinkArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args SharedEnvironmentVariableProjectLinkArgs
    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 sharedEnvironmentVariableProjectLinkResource = new Vercel.SharedEnvironmentVariableProjectLink("sharedEnvironmentVariableProjectLinkResource", new()
    {
        ProjectId = "string",
        SharedEnvironmentVariableId = "string",
        TeamId = "string",
    });
    
    example, err := vercel.NewSharedEnvironmentVariableProjectLink(ctx, "sharedEnvironmentVariableProjectLinkResource", &vercel.SharedEnvironmentVariableProjectLinkArgs{
    	ProjectId:                   pulumi.String("string"),
    	SharedEnvironmentVariableId: pulumi.String("string"),
    	TeamId:                      pulumi.String("string"),
    })
    
    var sharedEnvironmentVariableProjectLinkResource = new SharedEnvironmentVariableProjectLink("sharedEnvironmentVariableProjectLinkResource", SharedEnvironmentVariableProjectLinkArgs.builder()
        .projectId("string")
        .sharedEnvironmentVariableId("string")
        .teamId("string")
        .build());
    
    shared_environment_variable_project_link_resource = vercel.SharedEnvironmentVariableProjectLink("sharedEnvironmentVariableProjectLinkResource",
        project_id="string",
        shared_environment_variable_id="string",
        team_id="string")
    
    const sharedEnvironmentVariableProjectLinkResource = new vercel.SharedEnvironmentVariableProjectLink("sharedEnvironmentVariableProjectLinkResource", {
        projectId: "string",
        sharedEnvironmentVariableId: "string",
        teamId: "string",
    });
    
    type: vercel:SharedEnvironmentVariableProjectLink
    properties:
        projectId: string
        sharedEnvironmentVariableId: string
        teamId: string
    

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

    ProjectId string
    The ID of the Vercel project.
    SharedEnvironmentVariableId string
    The ID of the shared environment variable.
    TeamId string
    The ID of the Vercel team. Required when configuring a team resource if a default team has not been set in the provider.
    ProjectId string
    The ID of the Vercel project.
    SharedEnvironmentVariableId string
    The ID of the shared environment variable.
    TeamId string
    The ID of the Vercel team. Required when configuring a team resource if a default team has not been set in the provider.
    projectId String
    The ID of the Vercel project.
    sharedEnvironmentVariableId String
    The ID of the shared environment variable.
    teamId String
    The ID of the Vercel team. Required when configuring a team resource if a default team has not been set in the provider.
    projectId string
    The ID of the Vercel project.
    sharedEnvironmentVariableId string
    The ID of the shared environment variable.
    teamId string
    The ID of the Vercel team. Required when configuring a team resource if a default team has not been set in the provider.
    project_id str
    The ID of the Vercel project.
    shared_environment_variable_id str
    The ID of the shared environment variable.
    team_id str
    The ID of the Vercel team. Required when configuring a team resource if a default team has not been set in the provider.
    projectId String
    The ID of the Vercel project.
    sharedEnvironmentVariableId String
    The ID of the shared environment variable.
    teamId String
    The ID of the Vercel team. Required when configuring a team resource if a default team has not been set in the provider.

    Outputs

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

    Get an existing SharedEnvironmentVariableProjectLink 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?: SharedEnvironmentVariableProjectLinkState, opts?: CustomResourceOptions): SharedEnvironmentVariableProjectLink
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            project_id: Optional[str] = None,
            shared_environment_variable_id: Optional[str] = None,
            team_id: Optional[str] = None) -> SharedEnvironmentVariableProjectLink
    func GetSharedEnvironmentVariableProjectLink(ctx *Context, name string, id IDInput, state *SharedEnvironmentVariableProjectLinkState, opts ...ResourceOption) (*SharedEnvironmentVariableProjectLink, error)
    public static SharedEnvironmentVariableProjectLink Get(string name, Input<string> id, SharedEnvironmentVariableProjectLinkState? state, CustomResourceOptions? opts = null)
    public static SharedEnvironmentVariableProjectLink get(String name, Output<String> id, SharedEnvironmentVariableProjectLinkState state, CustomResourceOptions options)
    resources:  _:    type: vercel:SharedEnvironmentVariableProjectLink    get:      id: ${id}
    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:
    ProjectId string
    The ID of the Vercel project.
    SharedEnvironmentVariableId string
    The ID of the shared environment variable.
    TeamId string
    The ID of the Vercel team. Required when configuring a team resource if a default team has not been set in the provider.
    ProjectId string
    The ID of the Vercel project.
    SharedEnvironmentVariableId string
    The ID of the shared environment variable.
    TeamId string
    The ID of the Vercel team. Required when configuring a team resource if a default team has not been set in the provider.
    projectId String
    The ID of the Vercel project.
    sharedEnvironmentVariableId String
    The ID of the shared environment variable.
    teamId String
    The ID of the Vercel team. Required when configuring a team resource if a default team has not been set in the provider.
    projectId string
    The ID of the Vercel project.
    sharedEnvironmentVariableId string
    The ID of the shared environment variable.
    teamId string
    The ID of the Vercel team. Required when configuring a team resource if a default team has not been set in the provider.
    project_id str
    The ID of the Vercel project.
    shared_environment_variable_id str
    The ID of the shared environment variable.
    team_id str
    The ID of the Vercel team. Required when configuring a team resource if a default team has not been set in the provider.
    projectId String
    The ID of the Vercel project.
    sharedEnvironmentVariableId String
    The ID of the shared environment variable.
    teamId String
    The ID of the Vercel team. Required when configuring a team resource if a default team has not been set in the provider.

    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.2.1 published on Wednesday, May 14, 2025 by Pulumiverse