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

netlify.SiteBuildSettings

Explore with Pulumi AI

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

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as netlify from "@pulumi/netlify";
    
    const blog = new netlify.SiteBuildSettings("blog", {
        siteId: data.netlify_site.blog.id,
        buildCommand: "npm run build",
        publishDirectory: "dist",
        productionBranch: "main",
        branchDeployBranches: [
            "preview",
            "staging",
        ],
    });
    
    import pulumi
    import pulumi_netlify as netlify
    
    blog = netlify.SiteBuildSettings("blog",
        site_id=data["netlify_site"]["blog"]["id"],
        build_command="npm run build",
        publish_directory="dist",
        production_branch="main",
        branch_deploy_branches=[
            "preview",
            "staging",
        ])
    
    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 {
    		_, err := netlify.NewSiteBuildSettings(ctx, "blog", &netlify.SiteBuildSettingsArgs{
    			SiteId:           pulumi.Any(data.Netlify_site.Blog.Id),
    			BuildCommand:     pulumi.String("npm run build"),
    			PublishDirectory: pulumi.String("dist"),
    			ProductionBranch: pulumi.String("main"),
    			BranchDeployBranches: pulumi.StringArray{
    				pulumi.String("preview"),
    				pulumi.String("staging"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Netlify = Pulumi.Netlify;
    
    return await Deployment.RunAsync(() => 
    {
        var blog = new Netlify.SiteBuildSettings("blog", new()
        {
            SiteId = data.Netlify_site.Blog.Id,
            BuildCommand = "npm run build",
            PublishDirectory = "dist",
            ProductionBranch = "main",
            BranchDeployBranches = new[]
            {
                "preview",
                "staging",
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.netlify.SiteBuildSettings;
    import com.pulumi.netlify.SiteBuildSettingsArgs;
    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 blog = new SiteBuildSettings("blog", SiteBuildSettingsArgs.builder()
                .siteId(data.netlify_site().blog().id())
                .buildCommand("npm run build")
                .publishDirectory("dist")
                .productionBranch("main")
                .branchDeployBranches(            
                    "preview",
                    "staging")
                .build());
    
        }
    }
    
    resources:
      blog:
        type: netlify:SiteBuildSettings
        properties:
          siteId: ${data.netlify_site.blog.id}
          buildCommand: npm run build
          publishDirectory: dist
          productionBranch: main
          branchDeployBranches:
            - preview
            - staging
    

    Create SiteBuildSettings Resource

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

    Constructor syntax

    new SiteBuildSettings(name: string, args: SiteBuildSettingsArgs, opts?: CustomResourceOptions);
    @overload
    def SiteBuildSettings(resource_name: str,
                          args: SiteBuildSettingsArgs,
                          opts: Optional[ResourceOptions] = None)
    
    @overload
    def SiteBuildSettings(resource_name: str,
                          opts: Optional[ResourceOptions] = None,
                          production_branch: Optional[str] = None,
                          site_id: Optional[str] = None,
                          publish_directory: Optional[str] = None,
                          build_command: Optional[str] = None,
                          functions_directory: Optional[str] = None,
                          deploy_previews: Optional[bool] = None,
                          base_directory: Optional[str] = None,
                          functions_region: Optional[str] = None,
                          package_directory: Optional[str] = None,
                          pretty_urls: Optional[bool] = None,
                          build_image: Optional[str] = None,
                          branch_deploy_branches: Optional[Sequence[str]] = None,
                          branch_deploy_all_branches: Optional[bool] = None,
                          stop_builds: Optional[bool] = None,
                          waf_policy_id: Optional[str] = None)
    func NewSiteBuildSettings(ctx *Context, name string, args SiteBuildSettingsArgs, opts ...ResourceOption) (*SiteBuildSettings, error)
    public SiteBuildSettings(string name, SiteBuildSettingsArgs args, CustomResourceOptions? opts = null)
    public SiteBuildSettings(String name, SiteBuildSettingsArgs args)
    public SiteBuildSettings(String name, SiteBuildSettingsArgs args, CustomResourceOptions options)
    
    type: netlify:SiteBuildSettings
    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 SiteBuildSettingsArgs
    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 SiteBuildSettingsArgs
    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 SiteBuildSettingsArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args SiteBuildSettingsArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args SiteBuildSettingsArgs
    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 siteBuildSettingsResource = new Netlify.SiteBuildSettings("siteBuildSettingsResource", new()
    {
        ProductionBranch = "string",
        SiteId = "string",
        PublishDirectory = "string",
        BuildCommand = "string",
        FunctionsDirectory = "string",
        DeployPreviews = false,
        BaseDirectory = "string",
        FunctionsRegion = "string",
        PackageDirectory = "string",
        PrettyUrls = false,
        BuildImage = "string",
        BranchDeployBranches = new[]
        {
            "string",
        },
        BranchDeployAllBranches = false,
        StopBuilds = false,
        WafPolicyId = "string",
    });
    
    example, err := netlify.NewSiteBuildSettings(ctx, "siteBuildSettingsResource", &netlify.SiteBuildSettingsArgs{
    ProductionBranch: pulumi.String("string"),
    SiteId: pulumi.String("string"),
    PublishDirectory: pulumi.String("string"),
    BuildCommand: pulumi.String("string"),
    FunctionsDirectory: pulumi.String("string"),
    DeployPreviews: pulumi.Bool(false),
    BaseDirectory: pulumi.String("string"),
    FunctionsRegion: pulumi.String("string"),
    PackageDirectory: pulumi.String("string"),
    PrettyUrls: pulumi.Bool(false),
    BuildImage: pulumi.String("string"),
    BranchDeployBranches: pulumi.StringArray{
    pulumi.String("string"),
    },
    BranchDeployAllBranches: pulumi.Bool(false),
    StopBuilds: pulumi.Bool(false),
    WafPolicyId: pulumi.String("string"),
    })
    
    var siteBuildSettingsResource = new SiteBuildSettings("siteBuildSettingsResource", SiteBuildSettingsArgs.builder()
        .productionBranch("string")
        .siteId("string")
        .publishDirectory("string")
        .buildCommand("string")
        .functionsDirectory("string")
        .deployPreviews(false)
        .baseDirectory("string")
        .functionsRegion("string")
        .packageDirectory("string")
        .prettyUrls(false)
        .buildImage("string")
        .branchDeployBranches("string")
        .branchDeployAllBranches(false)
        .stopBuilds(false)
        .wafPolicyId("string")
        .build());
    
    site_build_settings_resource = netlify.SiteBuildSettings("siteBuildSettingsResource",
        production_branch="string",
        site_id="string",
        publish_directory="string",
        build_command="string",
        functions_directory="string",
        deploy_previews=False,
        base_directory="string",
        functions_region="string",
        package_directory="string",
        pretty_urls=False,
        build_image="string",
        branch_deploy_branches=["string"],
        branch_deploy_all_branches=False,
        stop_builds=False,
        waf_policy_id="string")
    
    const siteBuildSettingsResource = new netlify.SiteBuildSettings("siteBuildSettingsResource", {
        productionBranch: "string",
        siteId: "string",
        publishDirectory: "string",
        buildCommand: "string",
        functionsDirectory: "string",
        deployPreviews: false,
        baseDirectory: "string",
        functionsRegion: "string",
        packageDirectory: "string",
        prettyUrls: false,
        buildImage: "string",
        branchDeployBranches: ["string"],
        branchDeployAllBranches: false,
        stopBuilds: false,
        wafPolicyId: "string",
    });
    
    type: netlify:SiteBuildSettings
    properties:
        baseDirectory: string
        branchDeployAllBranches: false
        branchDeployBranches:
            - string
        buildCommand: string
        buildImage: string
        deployPreviews: false
        functionsDirectory: string
        functionsRegion: string
        packageDirectory: string
        prettyUrls: false
        productionBranch: string
        publishDirectory: string
        siteId: string
        stopBuilds: false
        wafPolicyId: string
    

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

    BuildCommand string
    ProductionBranch string
    PublishDirectory string
    SiteId string
    BaseDirectory string
    BranchDeployAllBranches bool
    BranchDeployBranches List<string>
    BuildImage string
    DeployPreviews bool
    FunctionsDirectory string
    FunctionsRegion string
    PackageDirectory string
    PrettyUrls bool
    StopBuilds bool
    WafPolicyId string
    See more details in the netlifywafpolicy resource.
    BuildCommand string
    ProductionBranch string
    PublishDirectory string
    SiteId string
    BaseDirectory string
    BranchDeployAllBranches bool
    BranchDeployBranches []string
    BuildImage string
    DeployPreviews bool
    FunctionsDirectory string
    FunctionsRegion string
    PackageDirectory string
    PrettyUrls bool
    StopBuilds bool
    WafPolicyId string
    See more details in the netlifywafpolicy resource.
    buildCommand String
    productionBranch String
    publishDirectory String
    siteId String
    baseDirectory String
    branchDeployAllBranches Boolean
    branchDeployBranches List<String>
    buildImage String
    deployPreviews Boolean
    functionsDirectory String
    functionsRegion String
    packageDirectory String
    prettyUrls Boolean
    stopBuilds Boolean
    wafPolicyId String
    See more details in the netlifywafpolicy resource.
    buildCommand string
    productionBranch string
    publishDirectory string
    siteId string
    baseDirectory string
    branchDeployAllBranches boolean
    branchDeployBranches string[]
    buildImage string
    deployPreviews boolean
    functionsDirectory string
    functionsRegion string
    packageDirectory string
    prettyUrls boolean
    stopBuilds boolean
    wafPolicyId string
    See more details in the netlifywafpolicy resource.
    buildCommand String
    productionBranch String
    publishDirectory String
    siteId String
    baseDirectory String
    branchDeployAllBranches Boolean
    branchDeployBranches List<String>
    buildImage String
    deployPreviews Boolean
    functionsDirectory String
    functionsRegion String
    packageDirectory String
    prettyUrls Boolean
    stopBuilds Boolean
    wafPolicyId String
    See more details in the netlifywafpolicy resource.

    Outputs

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

    Get an existing SiteBuildSettings 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?: SiteBuildSettingsState, opts?: CustomResourceOptions): SiteBuildSettings
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            base_directory: Optional[str] = None,
            branch_deploy_all_branches: Optional[bool] = None,
            branch_deploy_branches: Optional[Sequence[str]] = None,
            build_command: Optional[str] = None,
            build_image: Optional[str] = None,
            deploy_previews: Optional[bool] = None,
            functions_directory: Optional[str] = None,
            functions_region: Optional[str] = None,
            last_updated: Optional[str] = None,
            package_directory: Optional[str] = None,
            pretty_urls: Optional[bool] = None,
            production_branch: Optional[str] = None,
            publish_directory: Optional[str] = None,
            site_id: Optional[str] = None,
            stop_builds: Optional[bool] = None,
            waf_policy_id: Optional[str] = None) -> SiteBuildSettings
    func GetSiteBuildSettings(ctx *Context, name string, id IDInput, state *SiteBuildSettingsState, opts ...ResourceOption) (*SiteBuildSettings, error)
    public static SiteBuildSettings Get(string name, Input<string> id, SiteBuildSettingsState? state, CustomResourceOptions? opts = null)
    public static SiteBuildSettings get(String name, Output<String> id, SiteBuildSettingsState state, CustomResourceOptions options)
    resources:  _:    type: netlify:SiteBuildSettings    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:
    BaseDirectory string
    BranchDeployAllBranches bool
    BranchDeployBranches List<string>
    BuildCommand string
    BuildImage string
    DeployPreviews bool
    FunctionsDirectory string
    FunctionsRegion string
    LastUpdated string
    PackageDirectory string
    PrettyUrls bool
    ProductionBranch string
    PublishDirectory string
    SiteId string
    StopBuilds bool
    WafPolicyId string
    See more details in the netlifywafpolicy resource.
    BaseDirectory string
    BranchDeployAllBranches bool
    BranchDeployBranches []string
    BuildCommand string
    BuildImage string
    DeployPreviews bool
    FunctionsDirectory string
    FunctionsRegion string
    LastUpdated string
    PackageDirectory string
    PrettyUrls bool
    ProductionBranch string
    PublishDirectory string
    SiteId string
    StopBuilds bool
    WafPolicyId string
    See more details in the netlifywafpolicy resource.
    baseDirectory String
    branchDeployAllBranches Boolean
    branchDeployBranches List<String>
    buildCommand String
    buildImage String
    deployPreviews Boolean
    functionsDirectory String
    functionsRegion String
    lastUpdated String
    packageDirectory String
    prettyUrls Boolean
    productionBranch String
    publishDirectory String
    siteId String
    stopBuilds Boolean
    wafPolicyId String
    See more details in the netlifywafpolicy resource.
    baseDirectory string
    branchDeployAllBranches boolean
    branchDeployBranches string[]
    buildCommand string
    buildImage string
    deployPreviews boolean
    functionsDirectory string
    functionsRegion string
    lastUpdated string
    packageDirectory string
    prettyUrls boolean
    productionBranch string
    publishDirectory string
    siteId string
    stopBuilds boolean
    wafPolicyId string
    See more details in the netlifywafpolicy resource.
    baseDirectory String
    branchDeployAllBranches Boolean
    branchDeployBranches List<String>
    buildCommand String
    buildImage String
    deployPreviews Boolean
    functionsDirectory String
    functionsRegion String
    lastUpdated String
    packageDirectory String
    prettyUrls Boolean
    productionBranch String
    publishDirectory String
    siteId String
    stopBuilds Boolean
    wafPolicyId String
    See more details in the netlifywafpolicy resource.

    Import

    Import a site’s domain settings by the site ID

    $ pulumi import netlify:index/siteBuildSettings:SiteBuildSettings blog 12345667-0000-0000-0000-abcdef012345
    

    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.
    netlify logo
    netlify 0.2.2 published on Friday, Mar 7, 2025 by netlify