vercel.CustomEnvironment
Explore with Pulumi AI
Environments help manage the deployment lifecycle on the Vercel platform.
By default, all teams use three environments when developing their project: Production, Preview, and Development. However, teams can also create custom environments to suit their needs. To learn more about the limits for each plan, see limits.
Custom environments allow you to configure customized, pre-production environments for your project, such as staging or QA, with branch rules that will automatically deploy your branch when the branch name matches the rule. With custom environments you can also attach a domain to your environment, set environment variables, or import environment variables from another environment.
Custom environments are designed as pre-production environments intended for long-running use. This contrasts with regular preview environments, which are designed for creating ephemeral, short-lived deployments.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as vercel from "@pulumiverse/vercel";
const example = new vercel.Project("example", {name: "example-project-with-custom-env"});
const exampleCustomEnvironment = new vercel.CustomEnvironment("example", {
projectId: example.id,
name: "example-custom-env",
description: "A description of the custom environment",
branchTracking: {
pattern: "staging-",
type: "startsWith",
},
});
import pulumi
import pulumiverse_vercel as vercel
example = vercel.Project("example", name="example-project-with-custom-env")
example_custom_environment = vercel.CustomEnvironment("example",
project_id=example.id,
name="example-custom-env",
description="A description of the custom environment",
branch_tracking={
"pattern": "staging-",
"type": "startsWith",
})
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.NewProject(ctx, "example", &vercel.ProjectArgs{
Name: pulumi.String("example-project-with-custom-env"),
})
if err != nil {
return err
}
_, err = vercel.NewCustomEnvironment(ctx, "example", &vercel.CustomEnvironmentArgs{
ProjectId: example.ID(),
Name: pulumi.String("example-custom-env"),
Description: pulumi.String("A description of the custom environment"),
BranchTracking: &vercel.CustomEnvironmentBranchTrackingArgs{
Pattern: pulumi.String("staging-"),
Type: pulumi.String("startsWith"),
},
})
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 example = new Vercel.Project("example", new()
{
Name = "example-project-with-custom-env",
});
var exampleCustomEnvironment = new Vercel.CustomEnvironment("example", new()
{
ProjectId = example.Id,
Name = "example-custom-env",
Description = "A description of the custom environment",
BranchTracking = new Vercel.Inputs.CustomEnvironmentBranchTrackingArgs
{
Pattern = "staging-",
Type = "startsWith",
},
});
});
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.CustomEnvironment;
import com.pulumi.vercel.CustomEnvironmentArgs;
import com.pulumi.vercel.inputs.CustomEnvironmentBranchTrackingArgs;
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 example = new Project("example", ProjectArgs.builder()
.name("example-project-with-custom-env")
.build());
var exampleCustomEnvironment = new CustomEnvironment("exampleCustomEnvironment", CustomEnvironmentArgs.builder()
.projectId(example.id())
.name("example-custom-env")
.description("A description of the custom environment")
.branchTracking(CustomEnvironmentBranchTrackingArgs.builder()
.pattern("staging-")
.type("startsWith")
.build())
.build());
}
}
resources:
example:
type: vercel:Project
properties:
name: example-project-with-custom-env
exampleCustomEnvironment:
type: vercel:CustomEnvironment
name: example
properties:
projectId: ${example.id}
name: example-custom-env
description: A description of the custom environment
branchTracking:
pattern: staging-
type: startsWith
Create CustomEnvironment Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new CustomEnvironment(name: string, args: CustomEnvironmentArgs, opts?: CustomResourceOptions);
@overload
def CustomEnvironment(resource_name: str,
args: CustomEnvironmentArgs,
opts: Optional[ResourceOptions] = None)
@overload
def CustomEnvironment(resource_name: str,
opts: Optional[ResourceOptions] = None,
project_id: Optional[str] = None,
branch_tracking: Optional[CustomEnvironmentBranchTrackingArgs] = None,
description: Optional[str] = None,
name: Optional[str] = None,
team_id: Optional[str] = None)
func NewCustomEnvironment(ctx *Context, name string, args CustomEnvironmentArgs, opts ...ResourceOption) (*CustomEnvironment, error)
public CustomEnvironment(string name, CustomEnvironmentArgs args, CustomResourceOptions? opts = null)
public CustomEnvironment(String name, CustomEnvironmentArgs args)
public CustomEnvironment(String name, CustomEnvironmentArgs args, CustomResourceOptions options)
type: vercel:CustomEnvironment
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 CustomEnvironmentArgs
- 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 CustomEnvironmentArgs
- 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 CustomEnvironmentArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args CustomEnvironmentArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args CustomEnvironmentArgs
- 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 customEnvironmentResource = new Vercel.CustomEnvironment("customEnvironmentResource", new()
{
ProjectId = "string",
BranchTracking = new Vercel.Inputs.CustomEnvironmentBranchTrackingArgs
{
Pattern = "string",
Type = "string",
},
Description = "string",
Name = "string",
TeamId = "string",
});
example, err := vercel.NewCustomEnvironment(ctx, "customEnvironmentResource", &vercel.CustomEnvironmentArgs{
ProjectId: pulumi.String("string"),
BranchTracking: &vercel.CustomEnvironmentBranchTrackingArgs{
Pattern: pulumi.String("string"),
Type: pulumi.String("string"),
},
Description: pulumi.String("string"),
Name: pulumi.String("string"),
TeamId: pulumi.String("string"),
})
var customEnvironmentResource = new CustomEnvironment("customEnvironmentResource", CustomEnvironmentArgs.builder()
.projectId("string")
.branchTracking(CustomEnvironmentBranchTrackingArgs.builder()
.pattern("string")
.type("string")
.build())
.description("string")
.name("string")
.teamId("string")
.build());
custom_environment_resource = vercel.CustomEnvironment("customEnvironmentResource",
project_id="string",
branch_tracking={
"pattern": "string",
"type": "string",
},
description="string",
name="string",
team_id="string")
const customEnvironmentResource = new vercel.CustomEnvironment("customEnvironmentResource", {
projectId: "string",
branchTracking: {
pattern: "string",
type: "string",
},
description: "string",
name: "string",
teamId: "string",
});
type: vercel:CustomEnvironment
properties:
branchTracking:
pattern: string
type: string
description: string
name: string
projectId: string
teamId: string
CustomEnvironment 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 CustomEnvironment resource accepts the following input properties:
- Project
Id string - The ID of the existing Vercel Project.
- Branch
Tracking Pulumiverse.Vercel. Inputs. Custom Environment Branch Tracking - The branch tracking configuration for the environment. When enabled, each qualifying merge will generate a deployment.
- Description string
- A description of what the environment is.
- Name string
- The name of the environment.
- Team
Id string - The team ID to add the project to. Required when configuring a team resource if a default team has not been set in the provider.
- Project
Id string - The ID of the existing Vercel Project.
- Branch
Tracking CustomEnvironment Branch Tracking Args - The branch tracking configuration for the environment. When enabled, each qualifying merge will generate a deployment.
- Description string
- A description of what the environment is.
- Name string
- The name of the environment.
- Team
Id string - The team ID to add the project to. Required when configuring a team resource if a default team has not been set in the provider.
- project
Id String - The ID of the existing Vercel Project.
- branch
Tracking CustomEnvironment Branch Tracking - The branch tracking configuration for the environment. When enabled, each qualifying merge will generate a deployment.
- description String
- A description of what the environment is.
- name String
- The name of the environment.
- team
Id String - The team ID to add the project to. Required when configuring a team resource if a default team has not been set in the provider.
- project
Id string - The ID of the existing Vercel Project.
- branch
Tracking CustomEnvironment Branch Tracking - The branch tracking configuration for the environment. When enabled, each qualifying merge will generate a deployment.
- description string
- A description of what the environment is.
- name string
- The name of the environment.
- team
Id string - The team ID to add the project to. Required when configuring a team resource if a default team has not been set in the provider.
- project_
id str - The ID of the existing Vercel Project.
- branch_
tracking CustomEnvironment Branch Tracking Args - The branch tracking configuration for the environment. When enabled, each qualifying merge will generate a deployment.
- description str
- A description of what the environment is.
- name str
- The name of the environment.
- team_
id str - The team ID to add the project to. Required when configuring a team resource if a default team has not been set in the provider.
- project
Id String - The ID of the existing Vercel Project.
- branch
Tracking Property Map - The branch tracking configuration for the environment. When enabled, each qualifying merge will generate a deployment.
- description String
- A description of what the environment is.
- name String
- The name of the environment.
- team
Id String - The team ID to add the project to. 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 CustomEnvironment 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 CustomEnvironment Resource
Get an existing CustomEnvironment 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?: CustomEnvironmentState, opts?: CustomResourceOptions): CustomEnvironment
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
branch_tracking: Optional[CustomEnvironmentBranchTrackingArgs] = None,
description: Optional[str] = None,
name: Optional[str] = None,
project_id: Optional[str] = None,
team_id: Optional[str] = None) -> CustomEnvironment
func GetCustomEnvironment(ctx *Context, name string, id IDInput, state *CustomEnvironmentState, opts ...ResourceOption) (*CustomEnvironment, error)
public static CustomEnvironment Get(string name, Input<string> id, CustomEnvironmentState? state, CustomResourceOptions? opts = null)
public static CustomEnvironment get(String name, Output<String> id, CustomEnvironmentState state, CustomResourceOptions options)
resources: _: type: vercel:CustomEnvironment 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.
- Branch
Tracking Pulumiverse.Vercel. Inputs. Custom Environment Branch Tracking - The branch tracking configuration for the environment. When enabled, each qualifying merge will generate a deployment.
- Description string
- A description of what the environment is.
- Name string
- The name of the environment.
- Project
Id string - The ID of the existing Vercel Project.
- Team
Id string - The team ID to add the project to. Required when configuring a team resource if a default team has not been set in the provider.
- Branch
Tracking CustomEnvironment Branch Tracking Args - The branch tracking configuration for the environment. When enabled, each qualifying merge will generate a deployment.
- Description string
- A description of what the environment is.
- Name string
- The name of the environment.
- Project
Id string - The ID of the existing Vercel Project.
- Team
Id string - The team ID to add the project to. Required when configuring a team resource if a default team has not been set in the provider.
- branch
Tracking CustomEnvironment Branch Tracking - The branch tracking configuration for the environment. When enabled, each qualifying merge will generate a deployment.
- description String
- A description of what the environment is.
- name String
- The name of the environment.
- project
Id String - The ID of the existing Vercel Project.
- team
Id String - The team ID to add the project to. Required when configuring a team resource if a default team has not been set in the provider.
- branch
Tracking CustomEnvironment Branch Tracking - The branch tracking configuration for the environment. When enabled, each qualifying merge will generate a deployment.
- description string
- A description of what the environment is.
- name string
- The name of the environment.
- project
Id string - The ID of the existing Vercel Project.
- team
Id string - The team ID to add the project to. Required when configuring a team resource if a default team has not been set in the provider.
- branch_
tracking CustomEnvironment Branch Tracking Args - The branch tracking configuration for the environment. When enabled, each qualifying merge will generate a deployment.
- description str
- A description of what the environment is.
- name str
- The name of the environment.
- project_
id str - The ID of the existing Vercel Project.
- team_
id str - The team ID to add the project to. Required when configuring a team resource if a default team has not been set in the provider.
- branch
Tracking Property Map - The branch tracking configuration for the environment. When enabled, each qualifying merge will generate a deployment.
- description String
- A description of what the environment is.
- name String
- The name of the environment.
- project
Id String - The ID of the existing Vercel Project.
- team
Id String - The team ID to add the project to. Required when configuring a team resource if a default team has not been set in the provider.
Supporting Types
CustomEnvironmentBranchTracking, CustomEnvironmentBranchTrackingArgs
Import
If importing into a personal account, or with a team configured on
the provider, simply use the project_id and custom environment name.
- project_id can be found in the project
settings
tab in the Vercel UI.
$ pulumi import vercel:index/customEnvironment:CustomEnvironment example prj_xxxxxxxxxxxxxxxxxxxxxxxxxxxx/example-custom-env
Alternatively, you can import via the team_id, project_id and environment variable id.
team_id can be found in the team
settings
tab in the Vercel UI.project_id can be found in the project
settings
tab in the Vercel UI.
Note also, that the value field for sensitive environment variables will be imported as null
.
$ pulumi import vercel:index/customEnvironment:CustomEnvironment example team_xxxxxxxxxxxxxxxxxxxxxxxx/prj_xxxxxxxxxxxxxxxxxxxxxxxxxxxx/example-custom-env
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.