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

vercel.EdgeConfig

Explore with Pulumi AI

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

    Provides an Edge Config resource.

    An Edge Config is a global data store that enables experimentation with feature flags, A/B testing, critical redirects, and more.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as vercel from "@pulumiverse/vercel";
    
    const exampleEdgeConfig = new vercel.EdgeConfig("exampleEdgeConfig", {});
    const exampleProject = new vercel.Project("exampleProject", {});
    const exampleEdgeConfigToken = new vercel.EdgeConfigToken("exampleEdgeConfigToken", {
        edgeConfigId: exampleEdgeConfig.id,
        label: "example token",
    });
    const exampleProjectEnvironmentVariable = new vercel.ProjectEnvironmentVariable("exampleProjectEnvironmentVariable", {
        projectId: exampleProject.id,
        targets: [
            "production",
            "preview",
            "development",
        ],
        key: "EDGE_CONFIG",
        value: exampleEdgeConfigToken.connectionString,
    });
    
    import pulumi
    import pulumiverse_vercel as vercel
    
    example_edge_config = vercel.EdgeConfig("exampleEdgeConfig")
    example_project = vercel.Project("exampleProject")
    example_edge_config_token = vercel.EdgeConfigToken("exampleEdgeConfigToken",
        edge_config_id=example_edge_config.id,
        label="example token")
    example_project_environment_variable = vercel.ProjectEnvironmentVariable("exampleProjectEnvironmentVariable",
        project_id=example_project.id,
        targets=[
            "production",
            "preview",
            "development",
        ],
        key="EDGE_CONFIG",
        value=example_edge_config_token.connection_string)
    
    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 {
    		exampleEdgeConfig, err := vercel.NewEdgeConfig(ctx, "exampleEdgeConfig", nil)
    		if err != nil {
    			return err
    		}
    		exampleProject, err := vercel.NewProject(ctx, "exampleProject", nil)
    		if err != nil {
    			return err
    		}
    		exampleEdgeConfigToken, err := vercel.NewEdgeConfigToken(ctx, "exampleEdgeConfigToken", &vercel.EdgeConfigTokenArgs{
    			EdgeConfigId: exampleEdgeConfig.ID(),
    			Label:        pulumi.String("example token"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = vercel.NewProjectEnvironmentVariable(ctx, "exampleProjectEnvironmentVariable", &vercel.ProjectEnvironmentVariableArgs{
    			ProjectId: exampleProject.ID(),
    			Targets: pulumi.StringArray{
    				pulumi.String("production"),
    				pulumi.String("preview"),
    				pulumi.String("development"),
    			},
    			Key:   pulumi.String("EDGE_CONFIG"),
    			Value: exampleEdgeConfigToken.ConnectionString,
    		})
    		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 exampleEdgeConfig = new Vercel.EdgeConfig("exampleEdgeConfig");
    
        var exampleProject = new Vercel.Project("exampleProject");
    
        var exampleEdgeConfigToken = new Vercel.EdgeConfigToken("exampleEdgeConfigToken", new()
        {
            EdgeConfigId = exampleEdgeConfig.Id,
            Label = "example token",
        });
    
        var exampleProjectEnvironmentVariable = new Vercel.ProjectEnvironmentVariable("exampleProjectEnvironmentVariable", new()
        {
            ProjectId = exampleProject.Id,
            Targets = new[]
            {
                "production",
                "preview",
                "development",
            },
            Key = "EDGE_CONFIG",
            Value = exampleEdgeConfigToken.ConnectionString,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.vercel.EdgeConfig;
    import com.pulumi.vercel.Project;
    import com.pulumi.vercel.EdgeConfigToken;
    import com.pulumi.vercel.EdgeConfigTokenArgs;
    import com.pulumi.vercel.ProjectEnvironmentVariable;
    import com.pulumi.vercel.ProjectEnvironmentVariableArgs;
    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 exampleEdgeConfig = new EdgeConfig("exampleEdgeConfig");
    
            var exampleProject = new Project("exampleProject");
    
            var exampleEdgeConfigToken = new EdgeConfigToken("exampleEdgeConfigToken", EdgeConfigTokenArgs.builder()
                .edgeConfigId(exampleEdgeConfig.id())
                .label("example token")
                .build());
    
            var exampleProjectEnvironmentVariable = new ProjectEnvironmentVariable("exampleProjectEnvironmentVariable", ProjectEnvironmentVariableArgs.builder()
                .projectId(exampleProject.id())
                .targets(            
                    "production",
                    "preview",
                    "development")
                .key("EDGE_CONFIG")
                .value(exampleEdgeConfigToken.connectionString())
                .build());
    
        }
    }
    
    resources:
      exampleEdgeConfig:
        type: vercel:EdgeConfig
      exampleProject:
        type: vercel:Project
      exampleEdgeConfigToken:
        type: vercel:EdgeConfigToken
        properties:
          edgeConfigId: ${exampleEdgeConfig.id}
          label: example token
      exampleProjectEnvironmentVariable:
        type: vercel:ProjectEnvironmentVariable
        properties:
          projectId: ${exampleProject.id}
          targets:
            - production
            - preview
            - development
          key: EDGE_CONFIG
          value: ${exampleEdgeConfigToken.connectionString}
    

    Create EdgeConfig Resource

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

    Constructor syntax

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

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

    Name string
    The name/slug of the Edge Config.
    TeamId string
    The ID of the team the Edge Config should exist under. Required when configuring a team resource if a default team has not been set in the provider.
    Name string
    The name/slug of the Edge Config.
    TeamId string
    The ID of the team the Edge Config should exist under. Required when configuring a team resource if a default team has not been set in the provider.
    name String
    The name/slug of the Edge Config.
    teamId String
    The ID of the team the Edge Config should exist under. Required when configuring a team resource if a default team has not been set in the provider.
    name string
    The name/slug of the Edge Config.
    teamId string
    The ID of the team the Edge Config should exist under. Required when configuring a team resource if a default team has not been set in the provider.
    name str
    The name/slug of the Edge Config.
    team_id str
    The ID of the team the Edge Config should exist under. Required when configuring a team resource if a default team has not been set in the provider.
    name String
    The name/slug of the Edge Config.
    teamId String
    The ID of the team the Edge Config should exist under. 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 EdgeConfig 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 EdgeConfig Resource

    Get an existing EdgeConfig 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?: EdgeConfigState, opts?: CustomResourceOptions): EdgeConfig
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            name: Optional[str] = None,
            team_id: Optional[str] = None) -> EdgeConfig
    func GetEdgeConfig(ctx *Context, name string, id IDInput, state *EdgeConfigState, opts ...ResourceOption) (*EdgeConfig, error)
    public static EdgeConfig Get(string name, Input<string> id, EdgeConfigState? state, CustomResourceOptions? opts = null)
    public static EdgeConfig get(String name, Output<String> id, EdgeConfigState 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:
    Name string
    The name/slug of the Edge Config.
    TeamId string
    The ID of the team the Edge Config should exist under. Required when configuring a team resource if a default team has not been set in the provider.
    Name string
    The name/slug of the Edge Config.
    TeamId string
    The ID of the team the Edge Config should exist under. Required when configuring a team resource if a default team has not been set in the provider.
    name String
    The name/slug of the Edge Config.
    teamId String
    The ID of the team the Edge Config should exist under. Required when configuring a team resource if a default team has not been set in the provider.
    name string
    The name/slug of the Edge Config.
    teamId string
    The ID of the team the Edge Config should exist under. Required when configuring a team resource if a default team has not been set in the provider.
    name str
    The name/slug of the Edge Config.
    team_id str
    The ID of the team the Edge Config should exist under. Required when configuring a team resource if a default team has not been set in the provider.
    name String
    The name/slug of the Edge Config.
    teamId String
    The ID of the team the Edge Config should exist under. Required when configuring a team resource if a default team has not been set in the provider.

    Import

    If importing into a personal account, or with a team configured on

    the provider, simply use the edge config id.

    • edge_config_id can be found by navigating to the Edge Config in the Vercel UI. It should begin with ecfg_.
    $ pulumi import vercel:index/edgeConfig:EdgeConfig example ecfg_xxxxxxxxxxxxxxxxxxxxxxxxxxxx
    

    Alternatively, you can import via the team_id and edge_config_id.

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

    • edge_config_id can be found by navigating to the Edge Config in the Vercel UI. It should begin with ecfg_.

    $ pulumi import vercel:index/edgeConfig:EdgeConfig example team_xxxxxxxxxxxxxxxxxxxxxxxx/ecfg_xxxxxxxxxxxxxxxxxxxxxxxxxxxx
    

    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