cloudflare.UserAgentBlockingRule
Explore with Pulumi AI
Provides a resource to manage User Agent Blocking Rules.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as cloudflare from "@pulumi/cloudflare";
const example1 = new cloudflare.UserAgentBlockingRule("example_1", {
zoneId: "0da42c8d2132a9ddaf714f9e7c920711",
mode: "js_challenge",
paused: false,
description: "My description 1",
configuration: {
target: "ua",
value: "Chrome",
},
});
const example2 = new cloudflare.UserAgentBlockingRule("example_2", {
zoneId: "0da42c8d2132a9ddaf714f9e7c920711",
mode: "challenge",
paused: true,
description: "My description 22",
configuration: {
target: "ua",
value: "Mozilla",
},
});
import pulumi
import pulumi_cloudflare as cloudflare
example1 = cloudflare.UserAgentBlockingRule("example_1",
zone_id="0da42c8d2132a9ddaf714f9e7c920711",
mode="js_challenge",
paused=False,
description="My description 1",
configuration=cloudflare.UserAgentBlockingRuleConfigurationArgs(
target="ua",
value="Chrome",
))
example2 = cloudflare.UserAgentBlockingRule("example_2",
zone_id="0da42c8d2132a9ddaf714f9e7c920711",
mode="challenge",
paused=True,
description="My description 22",
configuration=cloudflare.UserAgentBlockingRuleConfigurationArgs(
target="ua",
value="Mozilla",
))
package main
import (
"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 {
_, err := cloudflare.NewUserAgentBlockingRule(ctx, "example_1", &cloudflare.UserAgentBlockingRuleArgs{
ZoneId: pulumi.String("0da42c8d2132a9ddaf714f9e7c920711"),
Mode: pulumi.String("js_challenge"),
Paused: pulumi.Bool(false),
Description: pulumi.String("My description 1"),
Configuration: &cloudflare.UserAgentBlockingRuleConfigurationArgs{
Target: pulumi.String("ua"),
Value: pulumi.String("Chrome"),
},
})
if err != nil {
return err
}
_, err = cloudflare.NewUserAgentBlockingRule(ctx, "example_2", &cloudflare.UserAgentBlockingRuleArgs{
ZoneId: pulumi.String("0da42c8d2132a9ddaf714f9e7c920711"),
Mode: pulumi.String("challenge"),
Paused: pulumi.Bool(true),
Description: pulumi.String("My description 22"),
Configuration: &cloudflare.UserAgentBlockingRuleConfigurationArgs{
Target: pulumi.String("ua"),
Value: pulumi.String("Mozilla"),
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Cloudflare = Pulumi.Cloudflare;
return await Deployment.RunAsync(() =>
{
var example1 = new Cloudflare.UserAgentBlockingRule("example_1", new()
{
ZoneId = "0da42c8d2132a9ddaf714f9e7c920711",
Mode = "js_challenge",
Paused = false,
Description = "My description 1",
Configuration = new Cloudflare.Inputs.UserAgentBlockingRuleConfigurationArgs
{
Target = "ua",
Value = "Chrome",
},
});
var example2 = new Cloudflare.UserAgentBlockingRule("example_2", new()
{
ZoneId = "0da42c8d2132a9ddaf714f9e7c920711",
Mode = "challenge",
Paused = true,
Description = "My description 22",
Configuration = new Cloudflare.Inputs.UserAgentBlockingRuleConfigurationArgs
{
Target = "ua",
Value = "Mozilla",
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.cloudflare.UserAgentBlockingRule;
import com.pulumi.cloudflare.UserAgentBlockingRuleArgs;
import com.pulumi.cloudflare.inputs.UserAgentBlockingRuleConfigurationArgs;
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 example1 = new UserAgentBlockingRule("example1", UserAgentBlockingRuleArgs.builder()
.zoneId("0da42c8d2132a9ddaf714f9e7c920711")
.mode("js_challenge")
.paused(false)
.description("My description 1")
.configuration(UserAgentBlockingRuleConfigurationArgs.builder()
.target("ua")
.value("Chrome")
.build())
.build());
var example2 = new UserAgentBlockingRule("example2", UserAgentBlockingRuleArgs.builder()
.zoneId("0da42c8d2132a9ddaf714f9e7c920711")
.mode("challenge")
.paused(true)
.description("My description 22")
.configuration(UserAgentBlockingRuleConfigurationArgs.builder()
.target("ua")
.value("Mozilla")
.build())
.build());
}
}
resources:
example1:
type: cloudflare:UserAgentBlockingRule
name: example_1
properties:
zoneId: 0da42c8d2132a9ddaf714f9e7c920711
mode: js_challenge
paused: false
description: My description 1
configuration:
target: ua
value: Chrome
example2:
type: cloudflare:UserAgentBlockingRule
name: example_2
properties:
zoneId: 0da42c8d2132a9ddaf714f9e7c920711
mode: challenge
paused: true
description: My description 22
configuration:
target: ua
value: Mozilla
Create UserAgentBlockingRule Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new UserAgentBlockingRule(name: string, args: UserAgentBlockingRuleArgs, opts?: CustomResourceOptions);
@overload
def UserAgentBlockingRule(resource_name: str,
args: UserAgentBlockingRuleArgs,
opts: Optional[ResourceOptions] = None)
@overload
def UserAgentBlockingRule(resource_name: str,
opts: Optional[ResourceOptions] = None,
configuration: Optional[UserAgentBlockingRuleConfigurationArgs] = None,
description: Optional[str] = None,
mode: Optional[str] = None,
paused: Optional[bool] = None,
zone_id: Optional[str] = None)
func NewUserAgentBlockingRule(ctx *Context, name string, args UserAgentBlockingRuleArgs, opts ...ResourceOption) (*UserAgentBlockingRule, error)
public UserAgentBlockingRule(string name, UserAgentBlockingRuleArgs args, CustomResourceOptions? opts = null)
public UserAgentBlockingRule(String name, UserAgentBlockingRuleArgs args)
public UserAgentBlockingRule(String name, UserAgentBlockingRuleArgs args, CustomResourceOptions options)
type: cloudflare:UserAgentBlockingRule
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 UserAgentBlockingRuleArgs
- 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 UserAgentBlockingRuleArgs
- 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 UserAgentBlockingRuleArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args UserAgentBlockingRuleArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args UserAgentBlockingRuleArgs
- 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 userAgentBlockingRuleResource = new Cloudflare.UserAgentBlockingRule("userAgentBlockingRuleResource", new()
{
Configuration = new Cloudflare.Inputs.UserAgentBlockingRuleConfigurationArgs
{
Target = "string",
Value = "string",
},
Description = "string",
Mode = "string",
Paused = false,
ZoneId = "string",
});
example, err := cloudflare.NewUserAgentBlockingRule(ctx, "userAgentBlockingRuleResource", &cloudflare.UserAgentBlockingRuleArgs{
Configuration: &cloudflare.UserAgentBlockingRuleConfigurationArgs{
Target: pulumi.String("string"),
Value: pulumi.String("string"),
},
Description: pulumi.String("string"),
Mode: pulumi.String("string"),
Paused: pulumi.Bool(false),
ZoneId: pulumi.String("string"),
})
var userAgentBlockingRuleResource = new UserAgentBlockingRule("userAgentBlockingRuleResource", UserAgentBlockingRuleArgs.builder()
.configuration(UserAgentBlockingRuleConfigurationArgs.builder()
.target("string")
.value("string")
.build())
.description("string")
.mode("string")
.paused(false)
.zoneId("string")
.build());
user_agent_blocking_rule_resource = cloudflare.UserAgentBlockingRule("userAgentBlockingRuleResource",
configuration=cloudflare.UserAgentBlockingRuleConfigurationArgs(
target="string",
value="string",
),
description="string",
mode="string",
paused=False,
zone_id="string")
const userAgentBlockingRuleResource = new cloudflare.UserAgentBlockingRule("userAgentBlockingRuleResource", {
configuration: {
target: "string",
value: "string",
},
description: "string",
mode: "string",
paused: false,
zoneId: "string",
});
type: cloudflare:UserAgentBlockingRule
properties:
configuration:
target: string
value: string
description: string
mode: string
paused: false
zoneId: string
UserAgentBlockingRule Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
The UserAgentBlockingRule resource accepts the following input properties:
- Configuration
User
Agent Blocking Rule Configuration - The configuration object for the current rule.
- Description string
- An informative summary of the rule.
- Mode string
- The action to apply to a matched request. Available values:
block
,challenge
,js_challenge
,managed_challenge
. - Paused bool
- When true, indicates that the rule is currently paused.
- Zone
Id string - The zone identifier to target for the resource. Modifying this attribute will force creation of a new resource.
- Configuration
User
Agent Blocking Rule Configuration Args - The configuration object for the current rule.
- Description string
- An informative summary of the rule.
- Mode string
- The action to apply to a matched request. Available values:
block
,challenge
,js_challenge
,managed_challenge
. - Paused bool
- When true, indicates that the rule is currently paused.
- Zone
Id string - The zone identifier to target for the resource. Modifying this attribute will force creation of a new resource.
- configuration
User
Agent Blocking Rule Configuration - The configuration object for the current rule.
- description String
- An informative summary of the rule.
- mode String
- The action to apply to a matched request. Available values:
block
,challenge
,js_challenge
,managed_challenge
. - paused Boolean
- When true, indicates that the rule is currently paused.
- zone
Id String - The zone identifier to target for the resource. Modifying this attribute will force creation of a new resource.
- configuration
User
Agent Blocking Rule Configuration - The configuration object for the current rule.
- description string
- An informative summary of the rule.
- mode string
- The action to apply to a matched request. Available values:
block
,challenge
,js_challenge
,managed_challenge
. - paused boolean
- When true, indicates that the rule is currently paused.
- zone
Id string - The zone identifier to target for the resource. Modifying this attribute will force creation of a new resource.
- configuration
User
Agent Blocking Rule Configuration Args - The configuration object for the current rule.
- description str
- An informative summary of the rule.
- mode str
- The action to apply to a matched request. Available values:
block
,challenge
,js_challenge
,managed_challenge
. - paused bool
- When true, indicates that the rule is currently paused.
- zone_
id str - The zone identifier to target for the resource. Modifying this attribute will force creation of a new resource.
- configuration Property Map
- The configuration object for the current rule.
- description String
- An informative summary of the rule.
- mode String
- The action to apply to a matched request. Available values:
block
,challenge
,js_challenge
,managed_challenge
. - paused Boolean
- When true, indicates that the rule is currently paused.
- zone
Id String - The zone identifier to target for the resource. Modifying this attribute will force creation of a new resource.
Outputs
All input properties are implicitly available as output properties. Additionally, the UserAgentBlockingRule resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
- id string
- The provider-assigned unique ID for this managed resource.
- id str
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing UserAgentBlockingRule Resource
Get an existing UserAgentBlockingRule 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?: UserAgentBlockingRuleState, opts?: CustomResourceOptions): UserAgentBlockingRule
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
configuration: Optional[UserAgentBlockingRuleConfigurationArgs] = None,
description: Optional[str] = None,
mode: Optional[str] = None,
paused: Optional[bool] = None,
zone_id: Optional[str] = None) -> UserAgentBlockingRule
func GetUserAgentBlockingRule(ctx *Context, name string, id IDInput, state *UserAgentBlockingRuleState, opts ...ResourceOption) (*UserAgentBlockingRule, error)
public static UserAgentBlockingRule Get(string name, Input<string> id, UserAgentBlockingRuleState? state, CustomResourceOptions? opts = null)
public static UserAgentBlockingRule get(String name, Output<String> id, UserAgentBlockingRuleState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- 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.
- Configuration
User
Agent Blocking Rule Configuration - The configuration object for the current rule.
- Description string
- An informative summary of the rule.
- Mode string
- The action to apply to a matched request. Available values:
block
,challenge
,js_challenge
,managed_challenge
. - Paused bool
- When true, indicates that the rule is currently paused.
- Zone
Id string - The zone identifier to target for the resource. Modifying this attribute will force creation of a new resource.
- Configuration
User
Agent Blocking Rule Configuration Args - The configuration object for the current rule.
- Description string
- An informative summary of the rule.
- Mode string
- The action to apply to a matched request. Available values:
block
,challenge
,js_challenge
,managed_challenge
. - Paused bool
- When true, indicates that the rule is currently paused.
- Zone
Id string - The zone identifier to target for the resource. Modifying this attribute will force creation of a new resource.
- configuration
User
Agent Blocking Rule Configuration - The configuration object for the current rule.
- description String
- An informative summary of the rule.
- mode String
- The action to apply to a matched request. Available values:
block
,challenge
,js_challenge
,managed_challenge
. - paused Boolean
- When true, indicates that the rule is currently paused.
- zone
Id String - The zone identifier to target for the resource. Modifying this attribute will force creation of a new resource.
- configuration
User
Agent Blocking Rule Configuration - The configuration object for the current rule.
- description string
- An informative summary of the rule.
- mode string
- The action to apply to a matched request. Available values:
block
,challenge
,js_challenge
,managed_challenge
. - paused boolean
- When true, indicates that the rule is currently paused.
- zone
Id string - The zone identifier to target for the resource. Modifying this attribute will force creation of a new resource.
- configuration
User
Agent Blocking Rule Configuration Args - The configuration object for the current rule.
- description str
- An informative summary of the rule.
- mode str
- The action to apply to a matched request. Available values:
block
,challenge
,js_challenge
,managed_challenge
. - paused bool
- When true, indicates that the rule is currently paused.
- zone_
id str - The zone identifier to target for the resource. Modifying this attribute will force creation of a new resource.
- configuration Property Map
- The configuration object for the current rule.
- description String
- An informative summary of the rule.
- mode String
- The action to apply to a matched request. Available values:
block
,challenge
,js_challenge
,managed_challenge
. - paused Boolean
- When true, indicates that the rule is currently paused.
- zone
Id String - The zone identifier to target for the resource. Modifying this attribute will force creation of a new resource.
Supporting Types
UserAgentBlockingRuleConfiguration, UserAgentBlockingRuleConfigurationArgs
Import
$ pulumi import cloudflare:index/userAgentBlockingRule:UserAgentBlockingRule example <zone_id>/<user_agent_blocking_rule_id>
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- Cloudflare pulumi/pulumi-cloudflare
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
cloudflare
Terraform Provider.