Page Rule Args
data class PageRuleArgs(val actions: Output<PageRuleActionsArgs>? = null, val priority: Output<Int>? = null, val status: Output<String>? = null, val target: Output<String>? = null, val zoneId: Output<String>? = null) : ConvertibleToJava<PageRuleArgs>
Provides a Cloudflare page rule resource.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as cloudflare from "@pulumi/cloudflare";
// Add a page rule to the domain
const foobar = new cloudflare.PageRule("foobar", {
zoneId: cloudflareZoneId,
target: `sub.${cloudflareZone}/page`,
priority: 1,
actions: {
ssl: "flexible",
emailObfuscation: "on",
minifies: [{
html: "off",
css: "on",
js: "on",
}],
},
});
Content copied to clipboard
import pulumi
import pulumi_cloudflare as cloudflare
# Add a page rule to the domain
foobar = cloudflare.PageRule("foobar",
zone_id=cloudflare_zone_id,
target=f"sub.{cloudflare_zone}/page",
priority=1,
actions={
"ssl": "flexible",
"email_obfuscation": "on",
"minifies": [{
"html": "off",
"css": "on",
"js": "on",
}],
})
Content copied to clipboard
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Cloudflare = Pulumi.Cloudflare;
return await Deployment.RunAsync(() =>
{
// Add a page rule to the domain
var foobar = new Cloudflare.PageRule("foobar", new()
{
ZoneId = cloudflareZoneId,
Target = $"sub.{cloudflareZone}/page",
Priority = 1,
Actions = new Cloudflare.Inputs.PageRuleActionsArgs
{
Ssl = "flexible",
EmailObfuscation = "on",
Minifies = new[]
{
new Cloudflare.Inputs.PageRuleActionsMinifyArgs
{
Html = "off",
Css = "on",
Js = "on",
},
},
},
});
});
Content copied to clipboard
package main
import (
"fmt"
"github.com/pulumi/pulumi-cloudflare/sdk/v5/go/cloudflare"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
// Add a page rule to the domain
_, err := cloudflare.NewPageRule(ctx, "foobar", &cloudflare.PageRuleArgs{
ZoneId: pulumi.Any(cloudflareZoneId),
Target: pulumi.Sprintf("sub.%v/page", cloudflareZone),
Priority: pulumi.Int(1),
Actions: &cloudflare.PageRuleActionsArgs{
Ssl: pulumi.String("flexible"),
EmailObfuscation: pulumi.String("on"),
Minifies: cloudflare.PageRuleActionsMinifyArray{
&cloudflare.PageRuleActionsMinifyArgs{
Html: pulumi.String("off"),
Css: pulumi.String("on"),
Js: pulumi.String("on"),
},
},
},
})
if err != nil {
return err
}
return nil
})
}
Content copied to clipboard
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.cloudflare.PageRule;
import com.pulumi.cloudflare.PageRuleArgs;
import com.pulumi.cloudflare.inputs.PageRuleActionsArgs;
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) {
// Add a page rule to the domain
var foobar = new PageRule("foobar", PageRuleArgs.builder()
.zoneId(cloudflareZoneId)
.target(String.format("sub.%s/page", cloudflareZone))
.priority(1)
.actions(PageRuleActionsArgs.builder()
.ssl("flexible")
.emailObfuscation("on")
.minifies(PageRuleActionsMinifyArgs.builder()
.html("off")
.css("on")
.js("on")
.build())
.build())
.build());
}
}
Content copied to clipboard
resources:
# Add a page rule to the domain
foobar:
type: cloudflare:PageRule
properties:
zoneId: ${cloudflareZoneId}
target: sub.${cloudflareZone}/page
priority: 1
actions:
ssl: flexible
emailObfuscation: on
minifies:
- html: off
css: on
js: on
Content copied to clipboard
Import
Page rules can be imported using a composite ID formed of zone ID and page rule ID, e.g.
$ pulumi import cloudflare:index/pageRule:PageRule default d41d8cd98f00b204e9800998ecf8427e/ch8374ftwdghsif43
Content copied to clipboard
Constructors
Link copied to clipboard
constructor(actions: Output<PageRuleActionsArgs>? = null, priority: Output<Int>? = null, status: Output<String>? = null, target: Output<String>? = null, zoneId: Output<String>? = null)
Properties
Link copied to clipboard
The actions taken by the page rule, options given below.
Link copied to clipboard
The priority of the page rule among others for this target, the higher the number the higher the priority as per API documentation.