1. Packages
  2. Cloudflare Provider
  3. API Docs
  4. getAccessRule
Cloudflare v6.1.2 published on Monday, Apr 28, 2025 by Pulumi

cloudflare.getAccessRule

Explore with Pulumi AI

cloudflare logo
Cloudflare v6.1.2 published on Monday, Apr 28, 2025 by Pulumi

    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:

    AccountId string
    The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.
    Filter GetAccessRuleFilter
    RuleId string
    Unique identifier for a rule
    ZoneId string
    The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.
    AccountId string
    The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.
    Filter GetAccessRuleFilter
    RuleId string
    Unique identifier for a rule
    ZoneId string
    The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.
    accountId String
    The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.
    filter GetAccessRuleFilter
    ruleId String
    Unique identifier for a rule
    zoneId String
    The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.
    accountId string
    The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.
    filter GetAccessRuleFilter
    ruleId string
    Unique identifier for a rule
    zoneId 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 GetAccessRuleFilter
    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.
    accountId String
    The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.
    filter Property Map
    ruleId String
    Unique identifier for a rule
    zoneId String
    The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.

    getAccessRule Result

    The following output properties are available:

    AllowedModes List<string>
    The available actions that a rule can apply to a matched request.
    Configuration GetAccessRuleConfiguration
    The rule configuration.
    CreatedOn 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".
    ModifiedOn 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 GetAccessRuleScope
    All zones owned by the user will have the rule applied.
    AccountId string
    The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.
    Filter GetAccessRuleFilter
    RuleId string
    Unique identifier for a rule
    ZoneId string
    The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.
    AllowedModes []string
    The available actions that a rule can apply to a matched request.
    Configuration GetAccessRuleConfiguration
    The rule configuration.
    CreatedOn 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".
    ModifiedOn 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 GetAccessRuleScope
    All zones owned by the user will have the rule applied.
    AccountId string
    The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.
    Filter GetAccessRuleFilter
    RuleId string
    Unique identifier for a rule
    ZoneId string
    The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.
    allowedModes List<String>
    The available actions that a rule can apply to a matched request.
    configuration GetAccessRuleConfiguration
    The rule configuration.
    createdOn 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".
    modifiedOn 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 GetAccessRuleScope
    All zones owned by the user will have the rule applied.
    accountId String
    The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.
    filter GetAccessRuleFilter
    ruleId String
    Unique identifier for a rule
    zoneId String
    The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.
    allowedModes string[]
    The available actions that a rule can apply to a matched request.
    configuration GetAccessRuleConfiguration
    The rule configuration.
    createdOn 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".
    modifiedOn 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 GetAccessRuleScope
    All zones owned by the user will have the rule applied.
    accountId string
    The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.
    filter GetAccessRuleFilter
    ruleId string
    Unique identifier for a rule
    zoneId 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 GetAccessRuleConfiguration
    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 GetAccessRuleScope
    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 GetAccessRuleFilter
    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.
    allowedModes List<String>
    The available actions that a rule can apply to a matched request.
    configuration Property Map
    The rule configuration.
    createdOn 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".
    modifiedOn 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.
    accountId String
    The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.
    filter Property Map
    ruleId String
    Unique identifier for a rule
    zoneId String
    The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.

    Supporting Types

    GetAccessRuleConfiguration

    Target string
    The configuration target. You must set the target to ip when specifying an IP address in the rule. Available values: "ip".
    Value string
    The IP address to match. This address will be compared to the IP address of incoming requests.
    Target string
    The configuration target. You must set the target to ip when specifying an IP address in the rule. Available values: "ip".
    Value string
    The IP address to match. This address will be compared to the IP address of incoming requests.
    target String
    The configuration target. You must set the target to ip when specifying an IP address in the rule. Available values: "ip".
    value String
    The IP address to match. This address will be compared to the IP address of incoming requests.
    target string
    The configuration target. You must set the target to ip when specifying an IP address in the rule. Available values: "ip".
    value string
    The IP address to match. This address will be compared to the IP address of incoming requests.
    target str
    The configuration target. You must set the target to ip when specifying an IP address in the rule. Available values: "ip".
    value str
    The IP address to match. This address will be compared to the IP address of incoming requests.
    target String
    The configuration target. You must set the target to ip when specifying an IP address in the rule. Available values: "ip".
    value String
    The IP address to match. This address will be compared to the IP address of incoming requests.

    GetAccessRuleFilter

    Match string
    When set to all, all the search requirements must match. When set to any, only one of the search requirements has to match. Available values: "any", "all".
    Configuration GetAccessRuleFilterConfiguration
    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 to any, only one of the search requirements has to match. Available values: "any", "all".
    Configuration GetAccessRuleFilterConfiguration
    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 to any, only one of the search requirements has to match. Available values: "any", "all".
    configuration GetAccessRuleFilterConfiguration
    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 to any, only one of the search requirements has to match. Available values: "any", "all".
    configuration GetAccessRuleFilterConfiguration
    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 to any, only one of the search requirements has to match. Available values: "any", "all".
    configuration GetAccessRuleFilterConfiguration
    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 to any, 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

    Email string
    The contact email address of the user.
    Id string
    Identifier
    Type string
    The scope of the rule. Available values: "user", "organization".
    Email string
    The contact email address of the user.
    Id string
    Identifier
    Type string
    The scope of the rule. Available values: "user", "organization".
    email String
    The contact email address of the user.
    id String
    Identifier
    type String
    The scope of the rule. Available values: "user", "organization".
    email string
    The contact email address of the user.
    id string
    Identifier
    type string
    The scope of the rule. Available values: "user", "organization".
    email str
    The contact email address of the user.
    id str
    Identifier
    type str
    The scope of the rule. Available values: "user", "organization".
    email String
    The contact email address of the user.
    id String
    Identifier
    type String
    The scope of the rule. Available values: "user", "organization".

    Package Details

    Repository
    Cloudflare pulumi/pulumi-cloudflare
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the cloudflare Terraform Provider.
    cloudflare logo
    Cloudflare v6.1.2 published on Monday, Apr 28, 2025 by Pulumi