Ready to level-up your engineering skills? Join a Pulumi Workshop. Register Now

AccessRule

Provides a Cloudflare IP Firewall Access Rule resource. Access control can be applied on basis of IP addresses, IP ranges, AS numbers or countries.

Create a AccessRule Resource

new AccessRule(name: string, args: AccessRuleArgs, opts?: CustomResourceOptions);
def AccessRule(resource_name: str, opts: Optional[ResourceOptions] = None, configuration: Optional[AccessRuleConfigurationArgs] = None, mode: Optional[str] = None, notes: Optional[str] = None, zone_id: Optional[str] = None)
func NewAccessRule(ctx *Context, name string, args AccessRuleArgs, opts ...ResourceOption) (*AccessRule, error)
public AccessRule(string name, AccessRuleArgs args, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args AccessRuleArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
opts ResourceOptions
A bag of options that control this resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args AccessRuleArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args AccessRuleArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

AccessRule Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.

Inputs

The AccessRule resource accepts the following input properties:

Configuration AccessRuleConfigurationArgs

Rule configuration to apply to a matched request. It’s a complex value. See description below.

Mode string

The action to apply to a matched request. Allowed values: “block”, “challenge”, “whitelist”, “js_challenge”

Notes string

A personal note about the rule. Typically used as a reminder or explanation for the rule.

ZoneId string

The DNS zone to which the access rule should be added.

Configuration AccessRuleConfiguration

Rule configuration to apply to a matched request. It’s a complex value. See description below.

Mode string

The action to apply to a matched request. Allowed values: “block”, “challenge”, “whitelist”, “js_challenge”

Notes string

A personal note about the rule. Typically used as a reminder or explanation for the rule.

ZoneId string

The DNS zone to which the access rule should be added.

configuration AccessRuleConfiguration

Rule configuration to apply to a matched request. It’s a complex value. See description below.

mode string

The action to apply to a matched request. Allowed values: “block”, “challenge”, “whitelist”, “js_challenge”

notes string

A personal note about the rule. Typically used as a reminder or explanation for the rule.

zoneId string

The DNS zone to which the access rule should be added.

configuration AccessRuleConfigurationArgs

Rule configuration to apply to a matched request. It’s a complex value. See description below.

mode str

The action to apply to a matched request. Allowed values: “block”, “challenge”, “whitelist”, “js_challenge”

notes str

A personal note about the rule. Typically used as a reminder or explanation for the rule.

zone_id str

The DNS zone to which the access rule should be added.

Outputs

All input properties are implicitly available as output properties. Additionally, the AccessRule 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 str
The provider-assigned unique ID for this managed resource.

Look up an Existing AccessRule Resource

Get an existing AccessRule 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?: AccessRuleState, opts?: CustomResourceOptions): AccessRule
@staticmethod
def get(resource_name: str, id: str, opts: Optional[ResourceOptions] = None, configuration: Optional[AccessRuleConfigurationArgs] = None, mode: Optional[str] = None, notes: Optional[str] = None, zone_id: Optional[str] = None) -> AccessRule
func GetAccessRule(ctx *Context, name string, id IDInput, state *AccessRuleState, opts ...ResourceOption) (*AccessRule, error)
public static AccessRule Get(string name, Input<string> id, AccessRuleState? state, CustomResourceOptions? opts = null)
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.

The following state arguments are supported:

Configuration AccessRuleConfigurationArgs

Rule configuration to apply to a matched request. It’s a complex value. See description below.

Mode string

The action to apply to a matched request. Allowed values: “block”, “challenge”, “whitelist”, “js_challenge”

Notes string

A personal note about the rule. Typically used as a reminder or explanation for the rule.

ZoneId string

The DNS zone to which the access rule should be added.

Configuration AccessRuleConfiguration

Rule configuration to apply to a matched request. It’s a complex value. See description below.

Mode string

The action to apply to a matched request. Allowed values: “block”, “challenge”, “whitelist”, “js_challenge”

Notes string

A personal note about the rule. Typically used as a reminder or explanation for the rule.

ZoneId string

The DNS zone to which the access rule should be added.

configuration AccessRuleConfiguration

Rule configuration to apply to a matched request. It’s a complex value. See description below.

mode string

The action to apply to a matched request. Allowed values: “block”, “challenge”, “whitelist”, “js_challenge”

notes string

A personal note about the rule. Typically used as a reminder or explanation for the rule.

zoneId string

The DNS zone to which the access rule should be added.

configuration AccessRuleConfigurationArgs

Rule configuration to apply to a matched request. It’s a complex value. See description below.

mode str

The action to apply to a matched request. Allowed values: “block”, “challenge”, “whitelist”, “js_challenge”

notes str

A personal note about the rule. Typically used as a reminder or explanation for the rule.

zone_id str

The DNS zone to which the access rule should be added.

Supporting Types

AccessRuleConfiguration

Target string

The request property to target. Allowed values: “ip”, “ip6”, “ip_range”, “asn”, “country”

Value string

The value to target. Depends on target’s type.

Target string

The request property to target. Allowed values: “ip”, “ip6”, “ip_range”, “asn”, “country”

Value string

The value to target. Depends on target’s type.

target string

The request property to target. Allowed values: “ip”, “ip6”, “ip_range”, “asn”, “country”

value string

The value to target. Depends on target’s type.

target str

The request property to target. Allowed values: “ip”, “ip6”, “ip_range”, “asn”, “country”

value str

The value to target. Depends on target’s type.

Import

Records can be imported using a composite ID formed of access rule type, access rule type identifier and identifer value, e.g.

 $ pulumi import cloudflare:index/accessRule:AccessRule default zone/cb029e245cfdd66dc8d2e570d5dd3322/d41d8cd98f00b204e9800998ecf8427e

where* zone - access rule type (account, zone or user) * cb029e245cfdd66dc8d2e570d5dd3322 - access rule type ID (i.e the zone ID

or account ID you wish to target) * d41d8cd98f00b204e9800998ecf8427e - access rule ID as returned by

respective API endpoint for the type you are attempting to import.

Package Details

Repository
https://github.com/pulumi/pulumi-cloudflare
License
Apache-2.0
Notes
This Pulumi package is based on the cloudflare Terraform Provider.