1. Packages
  2. Netlify Provider
  3. API Docs
  4. EnvironmentVariable
netlify 0.2.2 published on Friday, Mar 7, 2025 by netlify

netlify.EnvironmentVariable

Explore with Pulumi AI

Environment variables for Netlify sites. Read more

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as netlify from "@pulumi/netlify";

// Site-level environment variable, note that both team_id and site_id are specified
const astroDatabaseFileEnvironmentVariable = new netlify.EnvironmentVariable("astroDatabaseFileEnvironmentVariable", {
    teamId: data.netlify_team.team.id,
    siteId: data.netlify_site.blog.id,
    key: "ASTRO_DATABASE_FILE",
    values: [{
        value: "/path/here",
        context: "all",
    }],
});
// Team-level environment variable, note that only team_id is specified
// Not supported on all Netlify plans
const astroDatabaseFileIndex_environmentVariableEnvironmentVariable = new netlify.EnvironmentVariable("astroDatabaseFileIndex/environmentVariableEnvironmentVariable", {
    teamId: data.netlify_team.team.id,
    key: "ASTRO_DATABASE_FILE",
    values: [{
        value: "/path/here",
        context: "all",
    }],
});
// Secret environment variable
// Not supported on all Netlify plans
const astroStudioAppTokenEnvironmentVariable = new netlify.EnvironmentVariable("astroStudioAppTokenEnvironmentVariable", {
    teamId: data.netlify_team.team.id,
    siteId: data.netlify_site.blog.id,
    key: "ASTRO_STUDIO_APP_TOKEN",
    secretValues: [{
        value: "token-here",
        context: "all",
    }],
});
// Values that differ by context
const astroStudioAppTokenIndex_environmentVariableEnvironmentVariable = new netlify.EnvironmentVariable("astroStudioAppTokenIndex/environmentVariableEnvironmentVariable", {
    teamId: data.netlify_team.team.id,
    siteId: data.netlify_site.blog.id,
    key: "ASTRO_STUDIO_APP_TOKEN",
    secretValues: [
        {
            value: "token-here",
            context: "production",
        },
        {
            value: "non-prod-token-here",
            context: "deploy-preview",
        },
    ],
});
// A variable that's only available in some scopes, e.g. in builds
const astroDatabaseFileNetlifyIndex_environmentVariableEnvironmentVariable = new netlify.EnvironmentVariable("astroDatabaseFileNetlifyIndex/environmentVariableEnvironmentVariable", {
    teamId: data.netlify_team.team.id,
    siteId: data.netlify_site.blog.id,
    key: "ASTRO_DATABASE_FILE",
    scopes: ["builds"],
    values: [{
        value: "/path/here",
        context: "all",
    }],
});
Copy
import pulumi
import pulumi_netlify as netlify

# Site-level environment variable, note that both team_id and site_id are specified
astro_database_file_environment_variable = netlify.EnvironmentVariable("astroDatabaseFileEnvironmentVariable",
    team_id=data["netlify_team"]["team"]["id"],
    site_id=data["netlify_site"]["blog"]["id"],
    key="ASTRO_DATABASE_FILE",
    values=[{
        "value": "/path/here",
        "context": "all",
    }])
# Team-level environment variable, note that only team_id is specified
# Not supported on all Netlify plans
astro_database_file_index_environment_variable_environment_variable = netlify.EnvironmentVariable("astroDatabaseFileIndex/environmentVariableEnvironmentVariable",
    team_id=data["netlify_team"]["team"]["id"],
    key="ASTRO_DATABASE_FILE",
    values=[{
        "value": "/path/here",
        "context": "all",
    }])
# Secret environment variable
# Not supported on all Netlify plans
astro_studio_app_token_environment_variable = netlify.EnvironmentVariable("astroStudioAppTokenEnvironmentVariable",
    team_id=data["netlify_team"]["team"]["id"],
    site_id=data["netlify_site"]["blog"]["id"],
    key="ASTRO_STUDIO_APP_TOKEN",
    secret_values=[{
        "value": "token-here",
        "context": "all",
    }])
# Values that differ by context
astro_studio_app_token_index_environment_variable_environment_variable = netlify.EnvironmentVariable("astroStudioAppTokenIndex/environmentVariableEnvironmentVariable",
    team_id=data["netlify_team"]["team"]["id"],
    site_id=data["netlify_site"]["blog"]["id"],
    key="ASTRO_STUDIO_APP_TOKEN",
    secret_values=[
        {
            "value": "token-here",
            "context": "production",
        },
        {
            "value": "non-prod-token-here",
            "context": "deploy-preview",
        },
    ])
# A variable that's only available in some scopes, e.g. in builds
astro_database_file_netlify_index_environment_variable_environment_variable = netlify.EnvironmentVariable("astroDatabaseFileNetlifyIndex/environmentVariableEnvironmentVariable",
    team_id=data["netlify_team"]["team"]["id"],
    site_id=data["netlify_site"]["blog"]["id"],
    key="ASTRO_DATABASE_FILE",
    scopes=["builds"],
    values=[{
        "value": "/path/here",
        "context": "all",
    }])
Copy
package main

import (
	"github.com/pulumi/pulumi-terraform-provider/sdks/go/netlify/netlify"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		// Site-level environment variable, note that both team_id and site_id are specified
		_, err := netlify.NewEnvironmentVariable(ctx, "astroDatabaseFileEnvironmentVariable", &netlify.EnvironmentVariableArgs{
			TeamId: pulumi.Any(data.Netlify_team.Team.Id),
			SiteId: pulumi.Any(data.Netlify_site.Blog.Id),
			Key:    pulumi.String("ASTRO_DATABASE_FILE"),
			Values: netlify.EnvironmentVariableValueArray{
				&netlify.EnvironmentVariableValueArgs{
					Value:   pulumi.String("/path/here"),
					Context: pulumi.String("all"),
				},
			},
		})
		if err != nil {
			return err
		}
		// Team-level environment variable, note that only team_id is specified
		// Not supported on all Netlify plans
		_, err = netlify.NewEnvironmentVariable(ctx, "astroDatabaseFileIndex/environmentVariableEnvironmentVariable", &netlify.EnvironmentVariableArgs{
			TeamId: pulumi.Any(data.Netlify_team.Team.Id),
			Key:    pulumi.String("ASTRO_DATABASE_FILE"),
			Values: netlify.EnvironmentVariableValueArray{
				&netlify.EnvironmentVariableValueArgs{
					Value:   pulumi.String("/path/here"),
					Context: pulumi.String("all"),
				},
			},
		})
		if err != nil {
			return err
		}
		// Secret environment variable
		// Not supported on all Netlify plans
		_, err = netlify.NewEnvironmentVariable(ctx, "astroStudioAppTokenEnvironmentVariable", &netlify.EnvironmentVariableArgs{
			TeamId: pulumi.Any(data.Netlify_team.Team.Id),
			SiteId: pulumi.Any(data.Netlify_site.Blog.Id),
			Key:    pulumi.String("ASTRO_STUDIO_APP_TOKEN"),
			SecretValues: netlify.EnvironmentVariableSecretValueArray{
				&netlify.EnvironmentVariableSecretValueArgs{
					Value:   pulumi.String("token-here"),
					Context: pulumi.String("all"),
				},
			},
		})
		if err != nil {
			return err
		}
		// Values that differ by context
		_, err = netlify.NewEnvironmentVariable(ctx, "astroStudioAppTokenIndex/environmentVariableEnvironmentVariable", &netlify.EnvironmentVariableArgs{
			TeamId: pulumi.Any(data.Netlify_team.Team.Id),
			SiteId: pulumi.Any(data.Netlify_site.Blog.Id),
			Key:    pulumi.String("ASTRO_STUDIO_APP_TOKEN"),
			SecretValues: netlify.EnvironmentVariableSecretValueArray{
				&netlify.EnvironmentVariableSecretValueArgs{
					Value:   pulumi.String("token-here"),
					Context: pulumi.String("production"),
				},
				&netlify.EnvironmentVariableSecretValueArgs{
					Value:   pulumi.String("non-prod-token-here"),
					Context: pulumi.String("deploy-preview"),
				},
			},
		})
		if err != nil {
			return err
		}
		// A variable that's only available in some scopes, e.g. in builds
		_, err = netlify.NewEnvironmentVariable(ctx, "astroDatabaseFileNetlifyIndex/environmentVariableEnvironmentVariable", &netlify.EnvironmentVariableArgs{
			TeamId: pulumi.Any(data.Netlify_team.Team.Id),
			SiteId: pulumi.Any(data.Netlify_site.Blog.Id),
			Key:    pulumi.String("ASTRO_DATABASE_FILE"),
			Scopes: pulumi.StringArray{
				pulumi.String("builds"),
			},
			Values: netlify.EnvironmentVariableValueArray{
				&netlify.EnvironmentVariableValueArgs{
					Value:   pulumi.String("/path/here"),
					Context: pulumi.String("all"),
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Netlify = Pulumi.Netlify;

return await Deployment.RunAsync(() => 
{
    // Site-level environment variable, note that both team_id and site_id are specified
    var astroDatabaseFileEnvironmentVariable = new Netlify.EnvironmentVariable("astroDatabaseFileEnvironmentVariable", new()
    {
        TeamId = data.Netlify_team.Team.Id,
        SiteId = data.Netlify_site.Blog.Id,
        Key = "ASTRO_DATABASE_FILE",
        Values = new[]
        {
            new Netlify.Inputs.EnvironmentVariableValueArgs
            {
                Value = "/path/here",
                Context = "all",
            },
        },
    });

    // Team-level environment variable, note that only team_id is specified
    // Not supported on all Netlify plans
    var astroDatabaseFileIndex_environmentVariableEnvironmentVariable = new Netlify.EnvironmentVariable("astroDatabaseFileIndex/environmentVariableEnvironmentVariable", new()
    {
        TeamId = data.Netlify_team.Team.Id,
        Key = "ASTRO_DATABASE_FILE",
        Values = new[]
        {
            new Netlify.Inputs.EnvironmentVariableValueArgs
            {
                Value = "/path/here",
                Context = "all",
            },
        },
    });

    // Secret environment variable
    // Not supported on all Netlify plans
    var astroStudioAppTokenEnvironmentVariable = new Netlify.EnvironmentVariable("astroStudioAppTokenEnvironmentVariable", new()
    {
        TeamId = data.Netlify_team.Team.Id,
        SiteId = data.Netlify_site.Blog.Id,
        Key = "ASTRO_STUDIO_APP_TOKEN",
        SecretValues = new[]
        {
            new Netlify.Inputs.EnvironmentVariableSecretValueArgs
            {
                Value = "token-here",
                Context = "all",
            },
        },
    });

    // Values that differ by context
    var astroStudioAppTokenIndex_environmentVariableEnvironmentVariable = new Netlify.EnvironmentVariable("astroStudioAppTokenIndex/environmentVariableEnvironmentVariable", new()
    {
        TeamId = data.Netlify_team.Team.Id,
        SiteId = data.Netlify_site.Blog.Id,
        Key = "ASTRO_STUDIO_APP_TOKEN",
        SecretValues = new[]
        {
            new Netlify.Inputs.EnvironmentVariableSecretValueArgs
            {
                Value = "token-here",
                Context = "production",
            },
            new Netlify.Inputs.EnvironmentVariableSecretValueArgs
            {
                Value = "non-prod-token-here",
                Context = "deploy-preview",
            },
        },
    });

    // A variable that's only available in some scopes, e.g. in builds
    var astroDatabaseFileNetlifyIndex_environmentVariableEnvironmentVariable = new Netlify.EnvironmentVariable("astroDatabaseFileNetlifyIndex/environmentVariableEnvironmentVariable", new()
    {
        TeamId = data.Netlify_team.Team.Id,
        SiteId = data.Netlify_site.Blog.Id,
        Key = "ASTRO_DATABASE_FILE",
        Scopes = new[]
        {
            "builds",
        },
        Values = new[]
        {
            new Netlify.Inputs.EnvironmentVariableValueArgs
            {
                Value = "/path/here",
                Context = "all",
            },
        },
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.netlify.EnvironmentVariable;
import com.pulumi.netlify.EnvironmentVariableArgs;
import com.pulumi.netlify.inputs.EnvironmentVariableValueArgs;
import com.pulumi.netlify.inputs.EnvironmentVariableSecretValueArgs;
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) {
        // Site-level environment variable, note that both team_id and site_id are specified
        var astroDatabaseFileEnvironmentVariable = new EnvironmentVariable("astroDatabaseFileEnvironmentVariable", EnvironmentVariableArgs.builder()
            .teamId(data.netlify_team().team().id())
            .siteId(data.netlify_site().blog().id())
            .key("ASTRO_DATABASE_FILE")
            .values(EnvironmentVariableValueArgs.builder()
                .value("/path/here")
                .context("all")
                .build())
            .build());

        // Team-level environment variable, note that only team_id is specified
        // Not supported on all Netlify plans
        var astroDatabaseFileIndex_environmentVariableEnvironmentVariable = new EnvironmentVariable("astroDatabaseFileIndex/environmentVariableEnvironmentVariable", EnvironmentVariableArgs.builder()
            .teamId(data.netlify_team().team().id())
            .key("ASTRO_DATABASE_FILE")
            .values(EnvironmentVariableValueArgs.builder()
                .value("/path/here")
                .context("all")
                .build())
            .build());

        // Secret environment variable
        // Not supported on all Netlify plans
        var astroStudioAppTokenEnvironmentVariable = new EnvironmentVariable("astroStudioAppTokenEnvironmentVariable", EnvironmentVariableArgs.builder()
            .teamId(data.netlify_team().team().id())
            .siteId(data.netlify_site().blog().id())
            .key("ASTRO_STUDIO_APP_TOKEN")
            .secretValues(EnvironmentVariableSecretValueArgs.builder()
                .value("token-here")
                .context("all")
                .build())
            .build());

        // Values that differ by context
        var astroStudioAppTokenIndex_environmentVariableEnvironmentVariable = new EnvironmentVariable("astroStudioAppTokenIndex/environmentVariableEnvironmentVariable", EnvironmentVariableArgs.builder()
            .teamId(data.netlify_team().team().id())
            .siteId(data.netlify_site().blog().id())
            .key("ASTRO_STUDIO_APP_TOKEN")
            .secretValues(            
                EnvironmentVariableSecretValueArgs.builder()
                    .value("token-here")
                    .context("production")
                    .build(),
                EnvironmentVariableSecretValueArgs.builder()
                    .value("non-prod-token-here")
                    .context("deploy-preview")
                    .build())
            .build());

        // A variable that's only available in some scopes, e.g. in builds
        var astroDatabaseFileNetlifyIndex_environmentVariableEnvironmentVariable = new EnvironmentVariable("astroDatabaseFileNetlifyIndex/environmentVariableEnvironmentVariable", EnvironmentVariableArgs.builder()
            .teamId(data.netlify_team().team().id())
            .siteId(data.netlify_site().blog().id())
            .key("ASTRO_DATABASE_FILE")
            .scopes("builds")
            .values(EnvironmentVariableValueArgs.builder()
                .value("/path/here")
                .context("all")
                .build())
            .build());

    }
}
Copy
resources:
  # Site-level environment variable, note that both team_id and site_id are specified
  astroDatabaseFileEnvironmentVariable:
    type: netlify:EnvironmentVariable
    properties:
      teamId: ${data.netlify_team.team.id}
      siteId: ${data.netlify_site.blog.id}
      key: ASTRO_DATABASE_FILE
      values:
        - value: /path/here
          context: all
  # Team-level environment variable, note that only team_id is specified
  # Not supported on all Netlify plans
  astroDatabaseFileIndex/environmentVariableEnvironmentVariable:
    type: netlify:EnvironmentVariable
    properties:
      teamId: ${data.netlify_team.team.id}
      key: ASTRO_DATABASE_FILE
      values:
        - value: /path/here
          context: all
  # Secret environment variable
  # Not supported on all Netlify plans
  astroStudioAppTokenEnvironmentVariable:
    type: netlify:EnvironmentVariable
    properties:
      teamId: ${data.netlify_team.team.id}
      siteId: ${data.netlify_site.blog.id}
      key: ASTRO_STUDIO_APP_TOKEN
      secretValues:
        - value: token-here
          context: all
  # Values that differ by context
  astroStudioAppTokenIndex/environmentVariableEnvironmentVariable:
    type: netlify:EnvironmentVariable
    properties:
      teamId: ${data.netlify_team.team.id}
      siteId: ${data.netlify_site.blog.id}
      key: ASTRO_STUDIO_APP_TOKEN
      secretValues:
        - value: token-here
          context: production
        - value: non-prod-token-here
          context: deploy-preview
  # A variable that's only available in some scopes, e.g. in builds
  astroDatabaseFileNetlifyIndex/environmentVariableEnvironmentVariable:
    type: netlify:EnvironmentVariable
    properties:
      teamId: ${data.netlify_team.team.id}
      siteId: ${data.netlify_site.blog.id}
      key: ASTRO_DATABASE_FILE
      scopes:
        - builds
      values:
        - value: /path/here
          context: all
Copy

Create EnvironmentVariable Resource

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

Constructor syntax

new EnvironmentVariable(name: string, args: EnvironmentVariableArgs, opts?: CustomResourceOptions);
@overload
def EnvironmentVariable(resource_name: str,
                        args: EnvironmentVariableArgs,
                        opts: Optional[ResourceOptions] = None)

@overload
def EnvironmentVariable(resource_name: str,
                        opts: Optional[ResourceOptions] = None,
                        key: Optional[str] = None,
                        scopes: Optional[Sequence[str]] = None,
                        secret_values: Optional[Sequence[EnvironmentVariableSecretValueArgs]] = None,
                        site_id: Optional[str] = None,
                        team_id: Optional[str] = None,
                        values: Optional[Sequence[EnvironmentVariableValueArgs]] = None)
func NewEnvironmentVariable(ctx *Context, name string, args EnvironmentVariableArgs, opts ...ResourceOption) (*EnvironmentVariable, error)
public EnvironmentVariable(string name, EnvironmentVariableArgs args, CustomResourceOptions? opts = null)
public EnvironmentVariable(String name, EnvironmentVariableArgs args)
public EnvironmentVariable(String name, EnvironmentVariableArgs args, CustomResourceOptions options)
type: netlify:EnvironmentVariable
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. EnvironmentVariableArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. EnvironmentVariableArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. EnvironmentVariableArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. EnvironmentVariableArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. EnvironmentVariableArgs
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 environmentVariableResource = new Netlify.EnvironmentVariable("environmentVariableResource", new()
{
    Key = "string",
    Scopes = new[]
    {
        "string",
    },
    SecretValues = new[]
    {
        new Netlify.Inputs.EnvironmentVariableSecretValueArgs
        {
            Context = "string",
            Value = "string",
            ContextParameter = "string",
        },
    },
    SiteId = "string",
    TeamId = "string",
    Values = new[]
    {
        new Netlify.Inputs.EnvironmentVariableValueArgs
        {
            Context = "string",
            Value = "string",
            ContextParameter = "string",
        },
    },
});
Copy
example, err := netlify.NewEnvironmentVariable(ctx, "environmentVariableResource", &netlify.EnvironmentVariableArgs{
Key: pulumi.String("string"),
Scopes: pulumi.StringArray{
pulumi.String("string"),
},
SecretValues: .EnvironmentVariableSecretValueArray{
&.EnvironmentVariableSecretValueArgs{
Context: pulumi.String("string"),
Value: pulumi.String("string"),
ContextParameter: pulumi.String("string"),
},
},
SiteId: pulumi.String("string"),
TeamId: pulumi.String("string"),
Values: .EnvironmentVariableValueArray{
&.EnvironmentVariableValueArgs{
Context: pulumi.String("string"),
Value: pulumi.String("string"),
ContextParameter: pulumi.String("string"),
},
},
})
Copy
var environmentVariableResource = new EnvironmentVariable("environmentVariableResource", EnvironmentVariableArgs.builder()
    .key("string")
    .scopes("string")
    .secretValues(EnvironmentVariableSecretValueArgs.builder()
        .context("string")
        .value("string")
        .contextParameter("string")
        .build())
    .siteId("string")
    .teamId("string")
    .values(EnvironmentVariableValueArgs.builder()
        .context("string")
        .value("string")
        .contextParameter("string")
        .build())
    .build());
Copy
environment_variable_resource = netlify.EnvironmentVariable("environmentVariableResource",
    key="string",
    scopes=["string"],
    secret_values=[{
        "context": "string",
        "value": "string",
        "context_parameter": "string",
    }],
    site_id="string",
    team_id="string",
    values=[{
        "context": "string",
        "value": "string",
        "context_parameter": "string",
    }])
Copy
const environmentVariableResource = new netlify.EnvironmentVariable("environmentVariableResource", {
    key: "string",
    scopes: ["string"],
    secretValues: [{
        context: "string",
        value: "string",
        contextParameter: "string",
    }],
    siteId: "string",
    teamId: "string",
    values: [{
        context: "string",
        value: "string",
        contextParameter: "string",
    }],
});
Copy
type: netlify:EnvironmentVariable
properties:
    key: string
    scopes:
        - string
    secretValues:
        - context: string
          contextParameter: string
          value: string
    siteId: string
    teamId: string
    values:
        - context: string
          contextParameter: string
          value: string
Copy

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

Key This property is required. string
Scopes List<string>
One or more of builds, functions, runtime, and post-processing
SecretValues List<EnvironmentVariableSecretValue>
SiteId string
TeamId string
Required if a default team was not configured in the provider configuration.
Values List<EnvironmentVariableValue>
Key This property is required. string
Scopes []string
One or more of builds, functions, runtime, and post-processing
SecretValues []EnvironmentVariableSecretValueArgs
SiteId string
TeamId string
Required if a default team was not configured in the provider configuration.
Values []EnvironmentVariableValueArgs
key This property is required. String
scopes List<String>
One or more of builds, functions, runtime, and post-processing
secretValues List<EnvironmentVariableSecretValue>
siteId String
teamId String
Required if a default team was not configured in the provider configuration.
values List<EnvironmentVariableValue>
key This property is required. string
scopes string[]
One or more of builds, functions, runtime, and post-processing
secretValues EnvironmentVariableSecretValue[]
siteId string
teamId string
Required if a default team was not configured in the provider configuration.
values EnvironmentVariableValue[]
key This property is required. str
scopes Sequence[str]
One or more of builds, functions, runtime, and post-processing
secret_values Sequence[EnvironmentVariableSecretValueArgs]
site_id str
team_id str
Required if a default team was not configured in the provider configuration.
values Sequence[EnvironmentVariableValueArgs]
key This property is required. String
scopes List<String>
One or more of builds, functions, runtime, and post-processing
secretValues List<Property Map>
siteId String
teamId String
Required if a default team was not configured in the provider configuration.
values List<Property Map>

Outputs

All input properties are implicitly available as output properties. Additionally, the EnvironmentVariable resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
LastUpdated string
Id string
The provider-assigned unique ID for this managed resource.
LastUpdated string
id String
The provider-assigned unique ID for this managed resource.
lastUpdated String
id string
The provider-assigned unique ID for this managed resource.
lastUpdated string
id str
The provider-assigned unique ID for this managed resource.
last_updated str
id String
The provider-assigned unique ID for this managed resource.
lastUpdated String

Look up Existing EnvironmentVariable Resource

Get an existing EnvironmentVariable 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?: EnvironmentVariableState, opts?: CustomResourceOptions): EnvironmentVariable
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        key: Optional[str] = None,
        last_updated: Optional[str] = None,
        scopes: Optional[Sequence[str]] = None,
        secret_values: Optional[Sequence[EnvironmentVariableSecretValueArgs]] = None,
        site_id: Optional[str] = None,
        team_id: Optional[str] = None,
        values: Optional[Sequence[EnvironmentVariableValueArgs]] = None) -> EnvironmentVariable
func GetEnvironmentVariable(ctx *Context, name string, id IDInput, state *EnvironmentVariableState, opts ...ResourceOption) (*EnvironmentVariable, error)
public static EnvironmentVariable Get(string name, Input<string> id, EnvironmentVariableState? state, CustomResourceOptions? opts = null)
public static EnvironmentVariable get(String name, Output<String> id, EnvironmentVariableState state, CustomResourceOptions options)
resources:  _:    type: netlify:EnvironmentVariable    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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:
Key string
LastUpdated string
Scopes List<string>
One or more of builds, functions, runtime, and post-processing
SecretValues List<EnvironmentVariableSecretValue>
SiteId string
TeamId string
Required if a default team was not configured in the provider configuration.
Values List<EnvironmentVariableValue>
Key string
LastUpdated string
Scopes []string
One or more of builds, functions, runtime, and post-processing
SecretValues []EnvironmentVariableSecretValueArgs
SiteId string
TeamId string
Required if a default team was not configured in the provider configuration.
Values []EnvironmentVariableValueArgs
key String
lastUpdated String
scopes List<String>
One or more of builds, functions, runtime, and post-processing
secretValues List<EnvironmentVariableSecretValue>
siteId String
teamId String
Required if a default team was not configured in the provider configuration.
values List<EnvironmentVariableValue>
key string
lastUpdated string
scopes string[]
One or more of builds, functions, runtime, and post-processing
secretValues EnvironmentVariableSecretValue[]
siteId string
teamId string
Required if a default team was not configured in the provider configuration.
values EnvironmentVariableValue[]
key str
last_updated str
scopes Sequence[str]
One or more of builds, functions, runtime, and post-processing
secret_values Sequence[EnvironmentVariableSecretValueArgs]
site_id str
team_id str
Required if a default team was not configured in the provider configuration.
values Sequence[EnvironmentVariableValueArgs]
key String
lastUpdated String
scopes List<String>
One or more of builds, functions, runtime, and post-processing
secretValues List<Property Map>
siteId String
teamId String
Required if a default team was not configured in the provider configuration.
values List<Property Map>

Supporting Types

EnvironmentVariableSecretValue
, EnvironmentVariableSecretValueArgs

Context This property is required. string
One of all, dev, branch-deploy, deploy-preview, production, or branch
Value This property is required. string
ContextParameter string
Context This property is required. string
One of all, dev, branch-deploy, deploy-preview, production, or branch
Value This property is required. string
ContextParameter string
context This property is required. String
One of all, dev, branch-deploy, deploy-preview, production, or branch
value This property is required. String
contextParameter String
context This property is required. string
One of all, dev, branch-deploy, deploy-preview, production, or branch
value This property is required. string
contextParameter string
context This property is required. str
One of all, dev, branch-deploy, deploy-preview, production, or branch
value This property is required. str
context_parameter str
context This property is required. String
One of all, dev, branch-deploy, deploy-preview, production, or branch
value This property is required. String
contextParameter String

EnvironmentVariableValue
, EnvironmentVariableValueArgs

Context This property is required. string
One of all, dev, branch-deploy, deploy-preview, production, or branch
Value This property is required. string
ContextParameter string
Context This property is required. string
One of all, dev, branch-deploy, deploy-preview, production, or branch
Value This property is required. string
ContextParameter string
context This property is required. String
One of all, dev, branch-deploy, deploy-preview, production, or branch
value This property is required. String
contextParameter String
context This property is required. string
One of all, dev, branch-deploy, deploy-preview, production, or branch
value This property is required. string
contextParameter string
context This property is required. str
One of all, dev, branch-deploy, deploy-preview, production, or branch
value This property is required. str
context_parameter str
context This property is required. String
One of all, dev, branch-deploy, deploy-preview, production, or branch
value This property is required. String
contextParameter String

Import

Import a team-level environment variable using the team ID and the environment variable key

$ pulumi import netlify:index/environmentVariable:EnvironmentVariable name 6600abcdef1234567890abcd:ASTRO_DATABASE_FILE
Copy

Import a site-level environment variable using the team ID, the site ID, and the environment variable key

$ pulumi import netlify:index/environmentVariable:EnvironmentVariable name 6600abcdef1234567890abcd:12345667-0000-0000-0000-abcdef012345:ASTRO_DATABASE_FILE
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
netlify netlify/terraform-provider-netlify
License
Notes
This Pulumi package is based on the netlify Terraform Provider.