PagesProjectArgs

data class PagesProjectArgs(val accountId: Output<String>? = null, val buildConfig: Output<PagesProjectBuildConfigArgs>? = null, val deploymentConfigs: Output<PagesProjectDeploymentConfigsArgs>? = null, val name: Output<String>? = null, val productionBranch: Output<String>? = null, val source: Output<PagesProjectSourceArgs>? = null) : ConvertibleToJava<PagesProjectArgs>

Provides a resource which manages Cloudflare Pages projects.

If you are using a source block configuration, you must first have a connected GitHub or GitLab account connected to Cloudflare. See the Getting Started with Pages documentation on how to link your accounts.

Example Usage

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.cloudflare.PagesProject;
import com.pulumi.cloudflare.PagesProjectArgs;
import com.pulumi.cloudflare.inputs.PagesProjectBuildConfigArgs;
import com.pulumi.cloudflare.inputs.PagesProjectSourceArgs;
import com.pulumi.cloudflare.inputs.PagesProjectSourceConfigArgs;
import com.pulumi.cloudflare.inputs.PagesProjectDeploymentConfigsArgs;
import com.pulumi.cloudflare.inputs.PagesProjectDeploymentConfigsPreviewArgs;
import com.pulumi.cloudflare.inputs.PagesProjectDeploymentConfigsProductionArgs;
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 basicProject = new PagesProject("basicProject", PagesProjectArgs.builder()
.accountId("f037e56e89293a057740de681ac9abbe")
.name("this-is-my-project-01")
.productionBranch("main")
.build());
var buildConfig = new PagesProject("buildConfig", PagesProjectArgs.builder()
.accountId("f037e56e89293a057740de681ac9abbe")
.buildConfig(PagesProjectBuildConfigArgs.builder()
.buildCommand("npm run build")
.destinationDir("build")
.rootDir("")
.webAnalyticsTag("cee1c73f6e4743d0b5e6bb1a0bcaabcc")
.webAnalyticsToken("021e1057c18547eca7b79f2516f06o7x")
.build())
.name("this-is-my-project-01")
.productionBranch("main")
.build());
var sourceConfig = new PagesProject("sourceConfig", PagesProjectArgs.builder()
.accountId("f037e56e89293a057740de681ac9abbe")
.name("this-is-my-project-01")
.productionBranch("main")
.source(PagesProjectSourceArgs.builder()
.config(PagesProjectSourceConfigArgs.builder()
.deploymentsEnabled(true)
.owner("cloudflare")
.prCommentsEnabled(true)
.previewBranchExcludes(
"main",
"prod")
.previewBranchIncludes(
"dev",
"preview")
.previewDeploymentSetting("custom")
.productionBranch("main")
.productionDeploymentEnabled(true)
.repoName("ninjakittens")
.build())
.type("github")
.build())
.build());
var deploymentConfigs = new PagesProject("deploymentConfigs", PagesProjectArgs.builder()
.accountId("f037e56e89293a057740de681ac9abbe")
.buildConfig(PagesProjectBuildConfigArgs.builder()
.buildCommand("npm run build")
.destinationDir("build")
.rootDir("")
.webAnalyticsTag("cee1c73f6e4743d0b5e6bb1a0bcaabcc")
.webAnalyticsToken("021e1057c18547eca7b79f2516f06o7x")
.build())
.deploymentConfigs(PagesProjectDeploymentConfigsArgs.builder()
.preview(PagesProjectDeploymentConfigsPreviewArgs.builder()
.compatibilityDate("2022-08-15")
.compatibilityFlags("nodejs_compat")
.d1Databases(Map.of("D1BINDING", "445e2955-951a-4358-a35b-a4d0c813f63"))
.durableObjectNamespaces(Map.of("DOBINDING", "5eb63bbbe01eeed093cb22bb8f5acdc3"))
.environmentVariables(Map.of("ENVIRONMENT", "preview"))
.kvNamespaces(Map.of("KVBINDING", "5eb63bbbe01eeed093cb22bb8f5acdc3"))
.r2Buckets(Map.of("R2BINDING", "some-bucket"))
.secrets(Map.of("TURNSTILESECRET", "1x0000000000000000000000000000000AA"))
.build())
.production(PagesProjectDeploymentConfigsProductionArgs.builder()
.compatibilityDate("2022-08-16")
.compatibilityFlags(
"nodejs_compat",
"streams_enable_constructors")
.d1Databases(Map.ofEntries(
Map.entry("D1BINDING1", "445e2955-951a-4358-a35b-a4d0c813f63"),
Map.entry("D1BINDING2", "a399414b-c697-409a-a688-377db6433cd9")
))
.durableObjectNamespaces(Map.ofEntries(
Map.entry("DOBINDING1", "5eb63bbbe01eeed093cb22bb8f5acdc3"),
Map.entry("DOBINDING2", "3cdca5f8bb22bc390deee10ebbb36be5")
))
.environmentVariables(Map.ofEntries(
Map.entry("ENVIRONMENT", "production"),
Map.entry("OTHERVALUE", "other value")
))
.kvNamespaces(Map.ofEntries(
Map.entry("KVBINDING1", "5eb63bbbe01eeed093cb22bb8f5acdc3"),
Map.entry("KVBINDING2", "3cdca5f8bb22bc390deee10ebbb36be5")
))
.r2Buckets(Map.ofEntries(
Map.entry("R2BINDING1", "some-bucket"),
Map.entry("R2BINDING2", "other-bucket")
))
.secrets(Map.ofEntries(
Map.entry("TURNSTILEINVISSECRET", "2x0000000000000000000000000000000AA"),
Map.entry("TURNSTILESECRET", "1x0000000000000000000000000000000AA")
))
.build())
.build())
.name("this-is-my-project-01")
.productionBranch("main")
.source(PagesProjectSourceArgs.builder()
.config(PagesProjectSourceConfigArgs.builder()
.deploymentsEnabled(true)
.owner("cloudflare")
.prCommentsEnabled(true)
.previewBranchExcludes(
"main",
"prod")
.previewBranchIncludes(
"dev",
"preview")
.previewDeploymentSetting("custom")
.productionBranch("main")
.productionDeploymentEnabled(true)
.repoName("ninjakittens")
.build())
.type("github")
.build())
.build());
}
}

Import

!> It is not possible to import a pages project with secret environment variables. If you have a secret environment variable, you must remove it from your project before importing it.

$ pulumi import cloudflare:index/pagesProject:PagesProject example <account_id>/<project_name>

Getting Started with Pageshttps://developers.cloudflare.com/pages/get-started/#connect-your-git-provider-to-pages

Constructors

Link copied to clipboard
fun PagesProjectArgs(accountId: Output<String>? = null, buildConfig: Output<PagesProjectBuildConfigArgs>? = null, deploymentConfigs: Output<PagesProjectDeploymentConfigsArgs>? = null, name: Output<String>? = null, productionBranch: Output<String>? = null, source: Output<PagesProjectSourceArgs>? = null)

Functions

Link copied to clipboard
open override fun toJava(): PagesProjectArgs

Properties

Link copied to clipboard
val accountId: Output<String>? = null

The account identifier to target for the resource.

Link copied to clipboard

Configuration for the project build process. Read more about the build configuration in the developer documentation.

Link copied to clipboard

Configuration for deployments in a project.

Link copied to clipboard
val name: Output<String>? = null

The global variable for the binding in your Worker code.

Link copied to clipboard
val productionBranch: Output<String>? = null

Project production branch name.

Link copied to clipboard
val source: Output<PagesProjectSourceArgs>? = null

Configuration for the project source. Read more about the source configuration in the developer documentation.