Pages Project
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")
.deploymentConfigs(PagesProjectDeploymentConfigsArgs.builder()
.preview(PagesProjectDeploymentConfigsPreviewArgs.builder()
.compatibilityDate("2022-08-15")
.compatibilityFlags("preview_flag")
.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"))
.build())
.production(PagesProjectDeploymentConfigsProductionArgs.builder()
.compatibilityDate("2022-08-16")
.compatibilityFlags(
"production_flag",
"second flag")
.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")
))
.build())
.build())
.name("this-is-my-project-01")
.productionBranch("main")
.build());
}
}
Content copied to clipboard
Import
$ pulumi import cloudflare:index/pagesProject:PagesProject example <account_id>/<project_name>
Content copied to clipboard
Getting Started with Pageshttps://developers.cloudflare.com/pages/get-started/#connect-your-git-provider-to-pages
Properties
Link copied to clipboard
Configuration for the project build process.
Link copied to clipboard
Configuration for deployments in a project.
Link copied to clipboard
The name of the branch that is used for the production environment.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Configuration for the project source.