PagesProject

class PagesProject : KotlinCustomResource

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

Properties

Link copied to clipboard
val accountId: Output<String>

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
val createdOn: Output<String>

When the project was created.

Link copied to clipboard

Configuration for deployments in a project.

Link copied to clipboard
val domains: Output<List<String>>

A list of associated custom domains for the project.

Link copied to clipboard
val id: Output<String>
Link copied to clipboard
val name: Output<String>

The global variable for the binding in your Worker code.

Link copied to clipboard

Project production branch name.

Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

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

Link copied to clipboard
val subdomain: Output<String>

The Cloudflare subdomain associated with the project.

Link copied to clipboard
val urn: Output<String>