1. Packages
  2. Netlify Provider
netlify 0.2.2 published on Friday, Mar 7, 2025 by netlify

Netlify Provider

netlify logo
netlify 0.2.2 published on Friday, Mar 7, 2025 by netlify

    Generate Provider

    The Netlify provider must be installed as a Local Package by following the instructions for Any Terraform Provider:

    pulumi package add terraform-provider netlify/netlify
    

    Overview

    The Netlify provider provides resources to manage Netlify resources like site configuration, environment variables, and Advanced Web Security features.

    Authentication

    To use the provider, you will need a personal access token. You can create a new token in the Netlify app.

    You can expose the token as an environment variable:

    export NETLIFY_API_TOKEN="your-personal-access-token"
    

    Or by creating a Pulumi variable:

    # Pulumi.yaml provider configuration file
    name: configuration-example
    runtime: nodejs
    config:
        netlify:token:
            value: 'TODO: var.netlify_api_token'
    
    import * as pulumi from "@pulumi/pulumi";
    
    const config = new pulumi.Config();
    const netlifyApiToken = config.require("netlifyApiToken");
    
    # Pulumi.yaml provider configuration file
    name: configuration-example
    runtime: python
    config:
        netlify:token:
            value: 'TODO: var.netlify_api_token'
    
    import pulumi
    
    config = pulumi.Config()
    netlify_api_token = config.require("netlifyApiToken")
    
    # Pulumi.yaml provider configuration file
    name: configuration-example
    runtime: dotnet
    config:
        netlify:token:
            value: 'TODO: var.netlify_api_token'
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    
    return await Deployment.RunAsync(() =>
    {
        var config = new Config();
        var netlifyApiToken = config.Require("netlifyApiToken");
    });
    
    # Pulumi.yaml provider configuration file
    name: configuration-example
    runtime: go
    config:
        netlify:token:
            value: 'TODO: var.netlify_api_token'
    
    package main
    
    import (
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		cfg := config.New(ctx, "")
    		netlifyApiToken := cfg.Require("netlifyApiToken")
    		return nil
    	})
    }
    
    # Pulumi.yaml provider configuration file
    name: configuration-example
    runtime: yaml
    config:
        netlify:token:
            value: 'TODO: var.netlify_api_token'
    
    configuration:
      netlifyApiToken:
        type: string
    
    # Pulumi.yaml provider configuration file
    name: configuration-example
    runtime: java
    config:
        netlify:token:
            value: 'TODO: var.netlify_api_token'
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    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 config = ctx.config();
            final var netlifyApiToken = config.get("netlifyApiToken");
        }
    }
    

    and setting the variable’s value as an environment variable (TF_VAR_netlify_api_token).

    Example Usage

    # Pulumi.yaml provider configuration file
    name: configuration-example
    runtime: nodejs
    config:
        netlify:defaultTeamSlug:
            value: your-team-slug
        netlify:token:
            value: 'TODO: var.netlify_api_token'
    
    Example currently unavailable in this language
    
    # Pulumi.yaml provider configuration file
    name: configuration-example
    runtime: python
    config:
        netlify:defaultTeamSlug:
            value: your-team-slug
        netlify:token:
            value: 'TODO: var.netlify_api_token'
    
    Example currently unavailable in this language
    
    # Pulumi.yaml provider configuration file
    name: configuration-example
    runtime: dotnet
    config:
        netlify:defaultTeamSlug:
            value: your-team-slug
        netlify:token:
            value: 'TODO: var.netlify_api_token'
    
    Example currently unavailable in this language
    
    # Pulumi.yaml provider configuration file
    name: configuration-example
    runtime: go
    config:
        netlify:defaultTeamSlug:
            value: your-team-slug
        netlify:token:
            value: 'TODO: var.netlify_api_token'
    
    Example currently unavailable in this language
    
    # Pulumi.yaml provider configuration file
    name: configuration-example
    runtime: yaml
    config:
        netlify:defaultTeamSlug:
            value: your-team-slug
        netlify:token:
            value: 'TODO: var.netlify_api_token'
    
    Example currently unavailable in this language
    
    # Pulumi.yaml provider configuration file
    name: configuration-example
    runtime: java
    config:
        netlify:defaultTeamSlug:
            value: your-team-slug
        netlify:token:
            value: 'TODO: var.netlify_api_token'
    
    Example currently unavailable in this language
    

    Configuration Reference

    • defaultTeamId (String) The default team ID to use for resources that require a team ID or a team slug. Warning: Changing this value may not trigger recreation of resources.
    • defaultTeamSlug (String) The default team slug to use for resources that require a team ID or a team slug. Warning: Changing this value may not trigger recreation of resources.
    • endpoint (String) Defaults to: https://api.netlify.com
    • token (String, Sensitive) Read: https://docs.netlify.com/api/get-started/#authentication , will use the NETLIFY_API_TOKEN environment variable if not set.
    netlify logo
    netlify 0.2.2 published on Friday, Mar 7, 2025 by netlify