Cloudflare v6.1.2 published on Monday, Apr 28, 2025 by Pulumi
cloudflare.getAccessRules
Explore with Pulumi AI
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as cloudflare from "@pulumi/cloudflare";
const exampleAccessRules = cloudflare.getAccessRules({
accountId: "account_id",
zoneId: "zone_id",
configuration: {
target: "ip",
value: "198.51.100.4",
},
direction: "desc",
mode: "challenge",
notes: "my note",
order: "mode",
});
import pulumi
import pulumi_cloudflare as cloudflare
example_access_rules = cloudflare.get_access_rules(account_id="account_id",
zone_id="zone_id",
configuration={
"target": "ip",
"value": "198.51.100.4",
},
direction="desc",
mode="challenge",
notes="my note",
order="mode")
package main
import (
"github.com/pulumi/pulumi-cloudflare/sdk/v6/go/cloudflare"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := cloudflare.LookupAccessRules(ctx, &cloudflare.LookupAccessRulesArgs{
AccountId: pulumi.StringRef("account_id"),
ZoneId: pulumi.StringRef("zone_id"),
Configuration: cloudflare.GetAccessRulesConfiguration{
Target: pulumi.StringRef("ip"),
Value: pulumi.StringRef("198.51.100.4"),
},
Direction: pulumi.StringRef("desc"),
Mode: pulumi.StringRef("challenge"),
Notes: pulumi.StringRef("my note"),
Order: pulumi.StringRef("mode"),
}, nil)
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 exampleAccessRules = Cloudflare.GetAccessRules.Invoke(new()
{
AccountId = "account_id",
ZoneId = "zone_id",
Configuration = new Cloudflare.Inputs.GetAccessRulesConfigurationInputArgs
{
Target = "ip",
Value = "198.51.100.4",
},
Direction = "desc",
Mode = "challenge",
Notes = "my note",
Order = "mode",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.cloudflare.CloudflareFunctions;
import com.pulumi.cloudflare.inputs.GetAccessRulesArgs;
import com.pulumi.cloudflare.inputs.GetAccessRulesConfigurationArgs;
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) {
final var exampleAccessRules = CloudflareFunctions.getAccessRules(GetAccessRulesArgs.builder()
.accountId("account_id")
.zoneId("zone_id")
.configuration(GetAccessRulesConfigurationArgs.builder()
.target("ip")
.value("198.51.100.4")
.build())
.direction("desc")
.mode("challenge")
.notes("my note")
.order("mode")
.build());
}
}
variables:
exampleAccessRules:
fn::invoke:
function: cloudflare:getAccessRules
arguments:
accountId: account_id
zoneId: zone_id
configuration:
target: ip
value: 198.51.100.4
direction: desc
mode: challenge
notes: my note
order: mode
Using getAccessRules
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getAccessRules(args: GetAccessRulesArgs, opts?: InvokeOptions): Promise<GetAccessRulesResult>
function getAccessRulesOutput(args: GetAccessRulesOutputArgs, opts?: InvokeOptions): Output<GetAccessRulesResult>
def get_access_rules(account_id: Optional[str] = None,
configuration: Optional[GetAccessRulesConfiguration] = None,
direction: Optional[str] = None,
match: Optional[str] = None,
max_items: Optional[int] = None,
mode: Optional[str] = None,
notes: Optional[str] = None,
order: Optional[str] = None,
zone_id: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetAccessRulesResult
def get_access_rules_output(account_id: Optional[pulumi.Input[str]] = None,
configuration: Optional[pulumi.Input[GetAccessRulesConfigurationArgs]] = None,
direction: Optional[pulumi.Input[str]] = None,
match: Optional[pulumi.Input[str]] = None,
max_items: Optional[pulumi.Input[int]] = None,
mode: Optional[pulumi.Input[str]] = None,
notes: Optional[pulumi.Input[str]] = None,
order: Optional[pulumi.Input[str]] = None,
zone_id: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetAccessRulesResult]
func LookupAccessRules(ctx *Context, args *LookupAccessRulesArgs, opts ...InvokeOption) (*LookupAccessRulesResult, error)
func LookupAccessRulesOutput(ctx *Context, args *LookupAccessRulesOutputArgs, opts ...InvokeOption) LookupAccessRulesResultOutput
> Note: This function is named LookupAccessRules
in the Go SDK.
public static class GetAccessRules
{
public static Task<GetAccessRulesResult> InvokeAsync(GetAccessRulesArgs args, InvokeOptions? opts = null)
public static Output<GetAccessRulesResult> Invoke(GetAccessRulesInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetAccessRulesResult> getAccessRules(GetAccessRulesArgs args, InvokeOptions options)
public static Output<GetAccessRulesResult> getAccessRules(GetAccessRulesArgs args, InvokeOptions options)
fn::invoke:
function: cloudflare:index/getAccessRules:getAccessRules
arguments:
# arguments dictionary
The following arguments are supported:
- Account
Id string - The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.
- Configuration
Get
Access Rules Configuration - Direction string
- The direction used to sort returned rules. Available values: "asc", "desc".
- Match string
- When set to
all
, all the search requirements must match. When set toany
, only one of the search requirements has to match. Available values: "any", "all". - Max
Items int - Max items to fetch, default: 1000
- Mode string
- The action to apply to a matched request. Available values: "block", "challenge", "whitelist", "jschallenge", "managedchallenge".
- Notes string
- The string to search for in the notes of existing IP Access rules. Notes: For example, the string 'attack' would match IP Access rules with notes 'Attack 26/02' and 'Attack 27/02'. The search is case insensitive.
- Order string
- The field used to sort returned rules. Available values: "configuration.target", "configuration.value", "mode".
- Zone
Id string - The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.
- Account
Id string - The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.
- Configuration
Get
Access Rules Configuration - Direction string
- The direction used to sort returned rules. Available values: "asc", "desc".
- Match string
- When set to
all
, all the search requirements must match. When set toany
, only one of the search requirements has to match. Available values: "any", "all". - Max
Items int - Max items to fetch, default: 1000
- Mode string
- The action to apply to a matched request. Available values: "block", "challenge", "whitelist", "jschallenge", "managedchallenge".
- Notes string
- The string to search for in the notes of existing IP Access rules. Notes: For example, the string 'attack' would match IP Access rules with notes 'Attack 26/02' and 'Attack 27/02'. The search is case insensitive.
- Order string
- The field used to sort returned rules. Available values: "configuration.target", "configuration.value", "mode".
- Zone
Id string - The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.
- account
Id String - The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.
- configuration
Get
Access Rules Configuration - direction String
- The direction used to sort returned rules. Available values: "asc", "desc".
- match String
- When set to
all
, all the search requirements must match. When set toany
, only one of the search requirements has to match. Available values: "any", "all". - max
Items Integer - Max items to fetch, default: 1000
- mode String
- The action to apply to a matched request. Available values: "block", "challenge", "whitelist", "jschallenge", "managedchallenge".
- notes String
- The string to search for in the notes of existing IP Access rules. Notes: For example, the string 'attack' would match IP Access rules with notes 'Attack 26/02' and 'Attack 27/02'. The search is case insensitive.
- order String
- The field used to sort returned rules. Available values: "configuration.target", "configuration.value", "mode".
- zone
Id String - The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.
- account
Id string - The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.
- configuration
Get
Access Rules Configuration - direction string
- The direction used to sort returned rules. Available values: "asc", "desc".
- match string
- When set to
all
, all the search requirements must match. When set toany
, only one of the search requirements has to match. Available values: "any", "all". - max
Items number - Max items to fetch, default: 1000
- mode string
- The action to apply to a matched request. Available values: "block", "challenge", "whitelist", "jschallenge", "managedchallenge".
- notes string
- The string to search for in the notes of existing IP Access rules. Notes: For example, the string 'attack' would match IP Access rules with notes 'Attack 26/02' and 'Attack 27/02'. The search is case insensitive.
- order string
- The field used to sort returned rules. Available values: "configuration.target", "configuration.value", "mode".
- zone
Id string - The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.
- account_
id str - The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.
- configuration
Get
Access Rules Configuration - direction str
- The direction used to sort returned rules. Available values: "asc", "desc".
- match str
- When set to
all
, all the search requirements must match. When set toany
, only one of the search requirements has to match. Available values: "any", "all". - max_
items int - Max items to fetch, default: 1000
- mode str
- The action to apply to a matched request. Available values: "block", "challenge", "whitelist", "jschallenge", "managedchallenge".
- notes str
- The string to search for in the notes of existing IP Access rules. Notes: For example, the string 'attack' would match IP Access rules with notes 'Attack 26/02' and 'Attack 27/02'. The search is case insensitive.
- order str
- The field used to sort returned rules. Available values: "configuration.target", "configuration.value", "mode".
- zone_
id str - The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.
- account
Id String - The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.
- configuration Property Map
- direction String
- The direction used to sort returned rules. Available values: "asc", "desc".
- match String
- When set to
all
, all the search requirements must match. When set toany
, only one of the search requirements has to match. Available values: "any", "all". - max
Items Number - Max items to fetch, default: 1000
- mode String
- The action to apply to a matched request. Available values: "block", "challenge", "whitelist", "jschallenge", "managedchallenge".
- notes String
- The string to search for in the notes of existing IP Access rules. Notes: For example, the string 'attack' would match IP Access rules with notes 'Attack 26/02' and 'Attack 27/02'. The search is case insensitive.
- order String
- The field used to sort returned rules. Available values: "configuration.target", "configuration.value", "mode".
- zone
Id String - The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.
getAccessRules Result
The following output properties are available:
- Id string
- The provider-assigned unique ID for this managed resource.
- Match string
- When set to
all
, all the search requirements must match. When set toany
, only one of the search requirements has to match. Available values: "any", "all". - Results
List<Get
Access Rules Result> - The items returned by the data source
- Account
Id string - The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.
- Configuration
Get
Access Rules Configuration - Direction string
- The direction used to sort returned rules. Available values: "asc", "desc".
- Max
Items int - Max items to fetch, default: 1000
- Mode string
- The action to apply to a matched request. Available values: "block", "challenge", "whitelist", "jschallenge", "managedchallenge".
- Notes string
- The string to search for in the notes of existing IP Access rules. Notes: For example, the string 'attack' would match IP Access rules with notes 'Attack 26/02' and 'Attack 27/02'. The search is case insensitive.
- Order string
- The field used to sort returned rules. Available values: "configuration.target", "configuration.value", "mode".
- Zone
Id string - The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.
- Id string
- The provider-assigned unique ID for this managed resource.
- Match string
- When set to
all
, all the search requirements must match. When set toany
, only one of the search requirements has to match. Available values: "any", "all". - Results
[]Get
Access Rules Result - The items returned by the data source
- Account
Id string - The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.
- Configuration
Get
Access Rules Configuration - Direction string
- The direction used to sort returned rules. Available values: "asc", "desc".
- Max
Items int - Max items to fetch, default: 1000
- Mode string
- The action to apply to a matched request. Available values: "block", "challenge", "whitelist", "jschallenge", "managedchallenge".
- Notes string
- The string to search for in the notes of existing IP Access rules. Notes: For example, the string 'attack' would match IP Access rules with notes 'Attack 26/02' and 'Attack 27/02'. The search is case insensitive.
- Order string
- The field used to sort returned rules. Available values: "configuration.target", "configuration.value", "mode".
- Zone
Id string - The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.
- id String
- The provider-assigned unique ID for this managed resource.
- match String
- When set to
all
, all the search requirements must match. When set toany
, only one of the search requirements has to match. Available values: "any", "all". - results
List<Get
Access Rules Result> - The items returned by the data source
- account
Id String - The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.
- configuration
Get
Access Rules Configuration - direction String
- The direction used to sort returned rules. Available values: "asc", "desc".
- max
Items Integer - Max items to fetch, default: 1000
- mode String
- The action to apply to a matched request. Available values: "block", "challenge", "whitelist", "jschallenge", "managedchallenge".
- notes String
- The string to search for in the notes of existing IP Access rules. Notes: For example, the string 'attack' would match IP Access rules with notes 'Attack 26/02' and 'Attack 27/02'. The search is case insensitive.
- order String
- The field used to sort returned rules. Available values: "configuration.target", "configuration.value", "mode".
- zone
Id String - The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.
- id string
- The provider-assigned unique ID for this managed resource.
- match string
- When set to
all
, all the search requirements must match. When set toany
, only one of the search requirements has to match. Available values: "any", "all". - results
Get
Access Rules Result[] - The items returned by the data source
- account
Id string - The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.
- configuration
Get
Access Rules Configuration - direction string
- The direction used to sort returned rules. Available values: "asc", "desc".
- max
Items number - Max items to fetch, default: 1000
- mode string
- The action to apply to a matched request. Available values: "block", "challenge", "whitelist", "jschallenge", "managedchallenge".
- notes string
- The string to search for in the notes of existing IP Access rules. Notes: For example, the string 'attack' would match IP Access rules with notes 'Attack 26/02' and 'Attack 27/02'. The search is case insensitive.
- order string
- The field used to sort returned rules. Available values: "configuration.target", "configuration.value", "mode".
- zone
Id string - The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.
- id str
- The provider-assigned unique ID for this managed resource.
- match str
- When set to
all
, all the search requirements must match. When set toany
, only one of the search requirements has to match. Available values: "any", "all". - results
Sequence[Get
Access Rules Result] - The items returned by the data source
- account_
id str - The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.
- configuration
Get
Access Rules Configuration - direction str
- The direction used to sort returned rules. Available values: "asc", "desc".
- max_
items int - Max items to fetch, default: 1000
- mode str
- The action to apply to a matched request. Available values: "block", "challenge", "whitelist", "jschallenge", "managedchallenge".
- notes str
- The string to search for in the notes of existing IP Access rules. Notes: For example, the string 'attack' would match IP Access rules with notes 'Attack 26/02' and 'Attack 27/02'. The search is case insensitive.
- order str
- The field used to sort returned rules. Available values: "configuration.target", "configuration.value", "mode".
- zone_
id str - The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.
- id String
- The provider-assigned unique ID for this managed resource.
- match String
- When set to
all
, all the search requirements must match. When set toany
, only one of the search requirements has to match. Available values: "any", "all". - results List<Property Map>
- The items returned by the data source
- account
Id String - The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.
- configuration Property Map
- direction String
- The direction used to sort returned rules. Available values: "asc", "desc".
- max
Items Number - Max items to fetch, default: 1000
- mode String
- The action to apply to a matched request. Available values: "block", "challenge", "whitelist", "jschallenge", "managedchallenge".
- notes String
- The string to search for in the notes of existing IP Access rules. Notes: For example, the string 'attack' would match IP Access rules with notes 'Attack 26/02' and 'Attack 27/02'. The search is case insensitive.
- order String
- The field used to sort returned rules. Available values: "configuration.target", "configuration.value", "mode".
- zone
Id String - The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.
Supporting Types
GetAccessRulesConfiguration
- Target string
- The target to search in existing rules. Available values: "ip", "ip_range", "asn", "country".
- Value string
- The target value to search for in existing rules: an IP address, an IP address range, or a country code, depending on the provided
configuration.target
. Notes: You can search for a single IPv4 address, an IP address range with a subnet of '/16' or '/24', or a two-letter ISO-3166-1 alpha-2 country code.
- Target string
- The target to search in existing rules. Available values: "ip", "ip_range", "asn", "country".
- Value string
- The target value to search for in existing rules: an IP address, an IP address range, or a country code, depending on the provided
configuration.target
. Notes: You can search for a single IPv4 address, an IP address range with a subnet of '/16' or '/24', or a two-letter ISO-3166-1 alpha-2 country code.
- target String
- The target to search in existing rules. Available values: "ip", "ip_range", "asn", "country".
- value String
- The target value to search for in existing rules: an IP address, an IP address range, or a country code, depending on the provided
configuration.target
. Notes: You can search for a single IPv4 address, an IP address range with a subnet of '/16' or '/24', or a two-letter ISO-3166-1 alpha-2 country code.
- target string
- The target to search in existing rules. Available values: "ip", "ip_range", "asn", "country".
- value string
- The target value to search for in existing rules: an IP address, an IP address range, or a country code, depending on the provided
configuration.target
. Notes: You can search for a single IPv4 address, an IP address range with a subnet of '/16' or '/24', or a two-letter ISO-3166-1 alpha-2 country code.
- target str
- The target to search in existing rules. Available values: "ip", "ip_range", "asn", "country".
- value str
- The target value to search for in existing rules: an IP address, an IP address range, or a country code, depending on the provided
configuration.target
. Notes: You can search for a single IPv4 address, an IP address range with a subnet of '/16' or '/24', or a two-letter ISO-3166-1 alpha-2 country code.
- target String
- The target to search in existing rules. Available values: "ip", "ip_range", "asn", "country".
- value String
- The target value to search for in existing rules: an IP address, an IP address range, or a country code, depending on the provided
configuration.target
. Notes: You can search for a single IPv4 address, an IP address range with a subnet of '/16' or '/24', or a two-letter ISO-3166-1 alpha-2 country code.
GetAccessRulesResult
- Allowed
Modes List<string> - The available actions that a rule can apply to a matched request.
- Configuration
Get
Access Rules Result Configuration - The rule configuration.
- Created
On string - The timestamp of when the rule was created.
- Id string
- The unique identifier of the IP Access rule.
- Mode string
- The action to apply to a matched request. Available values: "block", "challenge", "whitelist", "jschallenge", "managedchallenge".
- Modified
On string - The timestamp of when the rule was last modified.
- Notes string
- An informative summary of the rule, typically used as a reminder or explanation.
- Scope
Get
Access Rules Result Scope - All zones owned by the user will have the rule applied.
- Allowed
Modes []string - The available actions that a rule can apply to a matched request.
- Configuration
Get
Access Rules Result Configuration - The rule configuration.
- Created
On string - The timestamp of when the rule was created.
- Id string
- The unique identifier of the IP Access rule.
- Mode string
- The action to apply to a matched request. Available values: "block", "challenge", "whitelist", "jschallenge", "managedchallenge".
- Modified
On string - The timestamp of when the rule was last modified.
- Notes string
- An informative summary of the rule, typically used as a reminder or explanation.
- Scope
Get
Access Rules Result Scope - All zones owned by the user will have the rule applied.
- allowed
Modes List<String> - The available actions that a rule can apply to a matched request.
- configuration
Get
Access Rules Result Configuration - The rule configuration.
- created
On String - The timestamp of when the rule was created.
- id String
- The unique identifier of the IP Access rule.
- mode String
- The action to apply to a matched request. Available values: "block", "challenge", "whitelist", "jschallenge", "managedchallenge".
- modified
On String - The timestamp of when the rule was last modified.
- notes String
- An informative summary of the rule, typically used as a reminder or explanation.
- scope
Get
Access Rules Result Scope - All zones owned by the user will have the rule applied.
- allowed
Modes string[] - The available actions that a rule can apply to a matched request.
- configuration
Get
Access Rules Result Configuration - The rule configuration.
- created
On string - The timestamp of when the rule was created.
- id string
- The unique identifier of the IP Access rule.
- mode string
- The action to apply to a matched request. Available values: "block", "challenge", "whitelist", "jschallenge", "managedchallenge".
- modified
On string - The timestamp of when the rule was last modified.
- notes string
- An informative summary of the rule, typically used as a reminder or explanation.
- scope
Get
Access Rules Result Scope - All zones owned by the user will have the rule applied.
- allowed_
modes Sequence[str] - The available actions that a rule can apply to a matched request.
- configuration
Get
Access Rules Result Configuration - The rule configuration.
- created_
on str - The timestamp of when the rule was created.
- id str
- The unique identifier of the IP Access rule.
- mode str
- The action to apply to a matched request. Available values: "block", "challenge", "whitelist", "jschallenge", "managedchallenge".
- modified_
on str - The timestamp of when the rule was last modified.
- notes str
- An informative summary of the rule, typically used as a reminder or explanation.
- scope
Get
Access Rules Result Scope - All zones owned by the user will have the rule applied.
- allowed
Modes List<String> - The available actions that a rule can apply to a matched request.
- configuration Property Map
- The rule configuration.
- created
On String - The timestamp of when the rule was created.
- id String
- The unique identifier of the IP Access rule.
- mode String
- The action to apply to a matched request. Available values: "block", "challenge", "whitelist", "jschallenge", "managedchallenge".
- modified
On String - The timestamp of when the rule was last modified.
- notes String
- An informative summary of the rule, typically used as a reminder or explanation.
- scope Property Map
- All zones owned by the user will have the rule applied.
GetAccessRulesResultConfiguration
GetAccessRulesResultScope
Package Details
- Repository
- Cloudflare pulumi/pulumi-cloudflare
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
cloudflare
Terraform Provider.