Cloudflare v6.1.2 published on Monday, Apr 28, 2025 by Pulumi
cloudflare.getAccessRule
Explore with Pulumi AI
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as cloudflare from "@pulumi/cloudflare";
const exampleAccessRule = cloudflare.getAccessRule({
ruleId: "023e105f4ecef8ad9ca31a8372d0c353",
accountId: "account_id",
zoneId: "zone_id",
});
import pulumi
import pulumi_cloudflare as cloudflare
example_access_rule = cloudflare.get_access_rule(rule_id="023e105f4ecef8ad9ca31a8372d0c353",
account_id="account_id",
zone_id="zone_id")
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.LookupAccessRule(ctx, &cloudflare.LookupAccessRuleArgs{
RuleId: pulumi.StringRef("023e105f4ecef8ad9ca31a8372d0c353"),
AccountId: pulumi.StringRef("account_id"),
ZoneId: pulumi.StringRef("zone_id"),
}, 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 exampleAccessRule = Cloudflare.GetAccessRule.Invoke(new()
{
RuleId = "023e105f4ecef8ad9ca31a8372d0c353",
AccountId = "account_id",
ZoneId = "zone_id",
});
});
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.GetAccessRuleArgs;
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 exampleAccessRule = CloudflareFunctions.getAccessRule(GetAccessRuleArgs.builder()
.ruleId("023e105f4ecef8ad9ca31a8372d0c353")
.accountId("account_id")
.zoneId("zone_id")
.build());
}
}
variables:
exampleAccessRule:
fn::invoke:
function: cloudflare:getAccessRule
arguments:
ruleId: 023e105f4ecef8ad9ca31a8372d0c353
accountId: account_id
zoneId: zone_id
Using getAccessRule
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 getAccessRule(args: GetAccessRuleArgs, opts?: InvokeOptions): Promise<GetAccessRuleResult>
function getAccessRuleOutput(args: GetAccessRuleOutputArgs, opts?: InvokeOptions): Output<GetAccessRuleResult>
def get_access_rule(account_id: Optional[str] = None,
filter: Optional[GetAccessRuleFilter] = None,
rule_id: Optional[str] = None,
zone_id: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetAccessRuleResult
def get_access_rule_output(account_id: Optional[pulumi.Input[str]] = None,
filter: Optional[pulumi.Input[GetAccessRuleFilterArgs]] = None,
rule_id: Optional[pulumi.Input[str]] = None,
zone_id: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetAccessRuleResult]
func LookupAccessRule(ctx *Context, args *LookupAccessRuleArgs, opts ...InvokeOption) (*LookupAccessRuleResult, error)
func LookupAccessRuleOutput(ctx *Context, args *LookupAccessRuleOutputArgs, opts ...InvokeOption) LookupAccessRuleResultOutput
> Note: This function is named LookupAccessRule
in the Go SDK.
public static class GetAccessRule
{
public static Task<GetAccessRuleResult> InvokeAsync(GetAccessRuleArgs args, InvokeOptions? opts = null)
public static Output<GetAccessRuleResult> Invoke(GetAccessRuleInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetAccessRuleResult> getAccessRule(GetAccessRuleArgs args, InvokeOptions options)
public static Output<GetAccessRuleResult> getAccessRule(GetAccessRuleArgs args, InvokeOptions options)
fn::invoke:
function: cloudflare:index/getAccessRule:getAccessRule
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.
- Filter
Get
Access Rule Filter - Rule
Id string - Unique identifier for a rule
- 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.
- Filter
Get
Access Rule Filter - Rule
Id string - Unique identifier for a rule
- 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.
- filter
Get
Access Rule Filter - rule
Id String - Unique identifier for a rule
- 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.
- filter
Get
Access Rule Filter - rule
Id string - Unique identifier for a rule
- 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.
- filter
Get
Access Rule Filter - rule_
id str - Unique identifier for a rule
- 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.
- filter Property Map
- rule
Id String - Unique identifier for a rule
- zone
Id String - The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.
getAccessRule Result
The following output properties are available:
- Allowed
Modes List<string> - The available actions that a rule can apply to a matched request.
- Configuration
Get
Access Rule Configuration - The rule configuration.
- Created
On string - The timestamp of when the rule was created.
- Id string
- Unique identifier for a 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 Rule Scope - All zones owned by the user will have the rule applied.
- Account
Id string - The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.
- Filter
Get
Access Rule Filter - Rule
Id string - Unique identifier for a rule
- Zone
Id string - The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.
- Allowed
Modes []string - The available actions that a rule can apply to a matched request.
- Configuration
Get
Access Rule Configuration - The rule configuration.
- Created
On string - The timestamp of when the rule was created.
- Id string
- Unique identifier for a 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 Rule Scope - All zones owned by the user will have the rule applied.
- Account
Id string - The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.
- Filter
Get
Access Rule Filter - Rule
Id string - Unique identifier for a rule
- Zone
Id string - The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.
- allowed
Modes List<String> - The available actions that a rule can apply to a matched request.
- configuration
Get
Access Rule Configuration - The rule configuration.
- created
On String - The timestamp of when the rule was created.
- id String
- Unique identifier for a 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 Rule Scope - All zones owned by the user will have the rule applied.
- account
Id String - The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.
- filter
Get
Access Rule Filter - rule
Id String - Unique identifier for a rule
- zone
Id String - The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.
- allowed
Modes string[] - The available actions that a rule can apply to a matched request.
- configuration
Get
Access Rule Configuration - The rule configuration.
- created
On string - The timestamp of when the rule was created.
- id string
- Unique identifier for a 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 Rule Scope - All zones owned by the user will have the rule applied.
- account
Id string - The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.
- filter
Get
Access Rule Filter - rule
Id string - Unique identifier for a rule
- zone
Id string - The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.
- allowed_
modes Sequence[str] - The available actions that a rule can apply to a matched request.
- configuration
Get
Access Rule Configuration - The rule configuration.
- created_
on str - The timestamp of when the rule was created.
- id str
- Unique identifier for a 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 Rule Scope - All zones owned by the user will have the rule applied.
- account_
id str - The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.
- filter
Get
Access Rule Filter - rule_
id str - Unique identifier for a rule
- zone_
id str - The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.
- 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
- Unique identifier for a 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.
- account
Id String - The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.
- filter Property Map
- rule
Id String - Unique identifier for a rule
- zone
Id String - The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.
Supporting Types
GetAccessRuleConfiguration
GetAccessRuleFilter
- 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". - Configuration
Get
Access Rule Filter Configuration - Direction string
- The direction used to sort returned rules. Available values: "asc", "desc".
- 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".
- 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". - Configuration
Get
Access Rule Filter Configuration - Direction string
- The direction used to sort returned rules. Available values: "asc", "desc".
- 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".
- 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". - configuration
Get
Access Rule Filter Configuration - direction String
- The direction used to sort returned rules. Available values: "asc", "desc".
- 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".
- 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". - configuration
Get
Access Rule Filter Configuration - direction string
- The direction used to sort returned rules. Available values: "asc", "desc".
- 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".
- 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". - configuration
Get
Access Rule Filter Configuration - direction str
- The direction used to sort returned rules. Available values: "asc", "desc".
- 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".
- 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". - configuration Property Map
- direction String
- The direction used to sort returned rules. Available values: "asc", "desc".
- 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".
GetAccessRuleFilterConfiguration
- 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.
GetAccessRuleScope
Package Details
- Repository
- Cloudflare pulumi/pulumi-cloudflare
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
cloudflare
Terraform Provider.