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

cloudflare.ListItem

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 exampleListItem = new cloudflare.ListItem("example_list_item", {
        accountId: "023e105f4ecef8ad9ca31a8372d0c353",
        listId: "2c0fc9fa937b11eaa1b71c4d701ab86e",
        ip: "10.0.0.1",
    });
    
    import pulumi
    import pulumi_cloudflare as cloudflare
    
    example_list_item = cloudflare.ListItem("example_list_item",
        account_id="023e105f4ecef8ad9ca31a8372d0c353",
        list_id="2c0fc9fa937b11eaa1b71c4d701ab86e",
        ip="10.0.0.1")
    
    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.NewListItem(ctx, "example_list_item", &cloudflare.ListItemArgs{
    			AccountId: pulumi.String("023e105f4ecef8ad9ca31a8372d0c353"),
    			ListId:    pulumi.String("2c0fc9fa937b11eaa1b71c4d701ab86e"),
    			Ip:        pulumi.String("10.0.0.1"),
    		})
    		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 exampleListItem = new Cloudflare.ListItem("example_list_item", new()
        {
            AccountId = "023e105f4ecef8ad9ca31a8372d0c353",
            ListId = "2c0fc9fa937b11eaa1b71c4d701ab86e",
            Ip = "10.0.0.1",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.cloudflare.ListItem;
    import com.pulumi.cloudflare.ListItemArgs;
    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 exampleListItem = new ListItem("exampleListItem", ListItemArgs.builder()
                .accountId("023e105f4ecef8ad9ca31a8372d0c353")
                .listId("2c0fc9fa937b11eaa1b71c4d701ab86e")
                .ip("10.0.0.1")
                .build());
    
        }
    }
    
    resources:
      exampleListItem:
        type: cloudflare:ListItem
        name: example_list_item
        properties:
          accountId: 023e105f4ecef8ad9ca31a8372d0c353
          listId: 2c0fc9fa937b11eaa1b71c4d701ab86e
          ip: 10.0.0.1
    

    Create ListItem Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new ListItem(name: string, args: ListItemArgs, opts?: CustomResourceOptions);
    @overload
    def ListItem(resource_name: str,
                 args: ListItemArgs,
                 opts: Optional[ResourceOptions] = None)
    
    @overload
    def ListItem(resource_name: str,
                 opts: Optional[ResourceOptions] = None,
                 list_id: Optional[str] = None,
                 account_id: Optional[str] = None,
                 asn: Optional[int] = None,
                 comment: Optional[str] = None,
                 hostname: Optional[ListItemHostnameArgs] = None,
                 ip: Optional[str] = None,
                 redirect: Optional[ListItemRedirectArgs] = None)
    func NewListItem(ctx *Context, name string, args ListItemArgs, opts ...ResourceOption) (*ListItem, error)
    public ListItem(string name, ListItemArgs args, CustomResourceOptions? opts = null)
    public ListItem(String name, ListItemArgs args)
    public ListItem(String name, ListItemArgs args, CustomResourceOptions options)
    
    type: cloudflare:ListItem
    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 ListItemArgs
    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 ListItemArgs
    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 ListItemArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ListItemArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ListItemArgs
    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 listItemResource = new Cloudflare.ListItem("listItemResource", new()
    {
        ListId = "string",
        AccountId = "string",
        Asn = 0,
        Comment = "string",
        Hostname = new Cloudflare.Inputs.ListItemHostnameArgs
        {
            UrlHostname = "string",
        },
        Ip = "string",
        Redirect = new Cloudflare.Inputs.ListItemRedirectArgs
        {
            SourceUrl = "string",
            TargetUrl = "string",
            IncludeSubdomains = false,
            PreservePathSuffix = false,
            PreserveQueryString = false,
            StatusCode = 0,
            SubpathMatching = false,
        },
    });
    
    example, err := cloudflare.NewListItem(ctx, "listItemResource", &cloudflare.ListItemArgs{
    	ListId:    pulumi.String("string"),
    	AccountId: pulumi.String("string"),
    	Asn:       pulumi.Int(0),
    	Comment:   pulumi.String("string"),
    	Hostname: &cloudflare.ListItemHostnameArgs{
    		UrlHostname: pulumi.String("string"),
    	},
    	Ip: pulumi.String("string"),
    	Redirect: &cloudflare.ListItemRedirectArgs{
    		SourceUrl:           pulumi.String("string"),
    		TargetUrl:           pulumi.String("string"),
    		IncludeSubdomains:   pulumi.Bool(false),
    		PreservePathSuffix:  pulumi.Bool(false),
    		PreserveQueryString: pulumi.Bool(false),
    		StatusCode:          pulumi.Int(0),
    		SubpathMatching:     pulumi.Bool(false),
    	},
    })
    
    var listItemResource = new ListItem("listItemResource", ListItemArgs.builder()
        .listId("string")
        .accountId("string")
        .asn(0)
        .comment("string")
        .hostname(ListItemHostnameArgs.builder()
            .urlHostname("string")
            .build())
        .ip("string")
        .redirect(ListItemRedirectArgs.builder()
            .sourceUrl("string")
            .targetUrl("string")
            .includeSubdomains(false)
            .preservePathSuffix(false)
            .preserveQueryString(false)
            .statusCode(0)
            .subpathMatching(false)
            .build())
        .build());
    
    list_item_resource = cloudflare.ListItem("listItemResource",
        list_id="string",
        account_id="string",
        asn=0,
        comment="string",
        hostname={
            "url_hostname": "string",
        },
        ip="string",
        redirect={
            "source_url": "string",
            "target_url": "string",
            "include_subdomains": False,
            "preserve_path_suffix": False,
            "preserve_query_string": False,
            "status_code": 0,
            "subpath_matching": False,
        })
    
    const listItemResource = new cloudflare.ListItem("listItemResource", {
        listId: "string",
        accountId: "string",
        asn: 0,
        comment: "string",
        hostname: {
            urlHostname: "string",
        },
        ip: "string",
        redirect: {
            sourceUrl: "string",
            targetUrl: "string",
            includeSubdomains: false,
            preservePathSuffix: false,
            preserveQueryString: false,
            statusCode: 0,
            subpathMatching: false,
        },
    });
    
    type: cloudflare:ListItem
    properties:
        accountId: string
        asn: 0
        comment: string
        hostname:
            urlHostname: string
        ip: string
        listId: string
        redirect:
            includeSubdomains: false
            preservePathSuffix: false
            preserveQueryString: false
            sourceUrl: string
            statusCode: 0
            subpathMatching: false
            targetUrl: string
    

    ListItem Resource Properties

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

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The ListItem resource accepts the following input properties:

    ListId string
    The unique ID of the list.
    AccountId string
    Identifier
    Asn int
    A non-negative 32 bit integer
    Comment string
    An informative summary of the list item.
    Hostname ListItemHostname
    Valid characters for hostnames are ASCII(7) letters from a to z, the digits from 0 to 9, wildcards (*), and the hyphen (-).
    Ip string
    An IPv4 address, an IPv4 CIDR, or an IPv6 CIDR. IPv6 CIDRs are limited to a maximum of /64.
    Redirect ListItemRedirect
    The definition of the redirect.
    ListId string
    The unique ID of the list.
    AccountId string
    Identifier
    Asn int
    A non-negative 32 bit integer
    Comment string
    An informative summary of the list item.
    Hostname ListItemHostnameArgs
    Valid characters for hostnames are ASCII(7) letters from a to z, the digits from 0 to 9, wildcards (*), and the hyphen (-).
    Ip string
    An IPv4 address, an IPv4 CIDR, or an IPv6 CIDR. IPv6 CIDRs are limited to a maximum of /64.
    Redirect ListItemRedirectArgs
    The definition of the redirect.
    listId String
    The unique ID of the list.
    accountId String
    Identifier
    asn Integer
    A non-negative 32 bit integer
    comment String
    An informative summary of the list item.
    hostname ListItemHostname
    Valid characters for hostnames are ASCII(7) letters from a to z, the digits from 0 to 9, wildcards (*), and the hyphen (-).
    ip String
    An IPv4 address, an IPv4 CIDR, or an IPv6 CIDR. IPv6 CIDRs are limited to a maximum of /64.
    redirect ListItemRedirect
    The definition of the redirect.
    listId string
    The unique ID of the list.
    accountId string
    Identifier
    asn number
    A non-negative 32 bit integer
    comment string
    An informative summary of the list item.
    hostname ListItemHostname
    Valid characters for hostnames are ASCII(7) letters from a to z, the digits from 0 to 9, wildcards (*), and the hyphen (-).
    ip string
    An IPv4 address, an IPv4 CIDR, or an IPv6 CIDR. IPv6 CIDRs are limited to a maximum of /64.
    redirect ListItemRedirect
    The definition of the redirect.
    list_id str
    The unique ID of the list.
    account_id str
    Identifier
    asn int
    A non-negative 32 bit integer
    comment str
    An informative summary of the list item.
    hostname ListItemHostnameArgs
    Valid characters for hostnames are ASCII(7) letters from a to z, the digits from 0 to 9, wildcards (*), and the hyphen (-).
    ip str
    An IPv4 address, an IPv4 CIDR, or an IPv6 CIDR. IPv6 CIDRs are limited to a maximum of /64.
    redirect ListItemRedirectArgs
    The definition of the redirect.
    listId String
    The unique ID of the list.
    accountId String
    Identifier
    asn Number
    A non-negative 32 bit integer
    comment String
    An informative summary of the list item.
    hostname Property Map
    Valid characters for hostnames are ASCII(7) letters from a to z, the digits from 0 to 9, wildcards (*), and the hyphen (-).
    ip String
    An IPv4 address, an IPv4 CIDR, or an IPv6 CIDR. IPv6 CIDRs are limited to a maximum of /64.
    redirect Property Map
    The definition of the redirect.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the ListItem resource produces the following output properties:

    CreatedOn string
    The RFC 3339 timestamp of when the item was created.
    Id string
    The provider-assigned unique ID for this managed resource.
    ModifiedOn string
    The RFC 3339 timestamp of when the item was last modified.
    OperationId string
    The unique operation ID of the asynchronous action.
    CreatedOn string
    The RFC 3339 timestamp of when the item was created.
    Id string
    The provider-assigned unique ID for this managed resource.
    ModifiedOn string
    The RFC 3339 timestamp of when the item was last modified.
    OperationId string
    The unique operation ID of the asynchronous action.
    createdOn String
    The RFC 3339 timestamp of when the item was created.
    id String
    The provider-assigned unique ID for this managed resource.
    modifiedOn String
    The RFC 3339 timestamp of when the item was last modified.
    operationId String
    The unique operation ID of the asynchronous action.
    createdOn string
    The RFC 3339 timestamp of when the item was created.
    id string
    The provider-assigned unique ID for this managed resource.
    modifiedOn string
    The RFC 3339 timestamp of when the item was last modified.
    operationId string
    The unique operation ID of the asynchronous action.
    created_on str
    The RFC 3339 timestamp of when the item was created.
    id str
    The provider-assigned unique ID for this managed resource.
    modified_on str
    The RFC 3339 timestamp of when the item was last modified.
    operation_id str
    The unique operation ID of the asynchronous action.
    createdOn String
    The RFC 3339 timestamp of when the item was created.
    id String
    The provider-assigned unique ID for this managed resource.
    modifiedOn String
    The RFC 3339 timestamp of when the item was last modified.
    operationId String
    The unique operation ID of the asynchronous action.

    Look up Existing ListItem Resource

    Get an existing ListItem 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?: ListItemState, opts?: CustomResourceOptions): ListItem
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            account_id: Optional[str] = None,
            asn: Optional[int] = None,
            comment: Optional[str] = None,
            created_on: Optional[str] = None,
            hostname: Optional[ListItemHostnameArgs] = None,
            ip: Optional[str] = None,
            list_id: Optional[str] = None,
            modified_on: Optional[str] = None,
            operation_id: Optional[str] = None,
            redirect: Optional[ListItemRedirectArgs] = None) -> ListItem
    func GetListItem(ctx *Context, name string, id IDInput, state *ListItemState, opts ...ResourceOption) (*ListItem, error)
    public static ListItem Get(string name, Input<string> id, ListItemState? state, CustomResourceOptions? opts = null)
    public static ListItem get(String name, Output<String> id, ListItemState state, CustomResourceOptions options)
    resources:  _:    type: cloudflare:ListItem    get:      id: ${id}
    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.
    The following state arguments are supported:
    AccountId string
    Identifier
    Asn int
    A non-negative 32 bit integer
    Comment string
    An informative summary of the list item.
    CreatedOn string
    The RFC 3339 timestamp of when the item was created.
    Hostname ListItemHostname
    Valid characters for hostnames are ASCII(7) letters from a to z, the digits from 0 to 9, wildcards (*), and the hyphen (-).
    Ip string
    An IPv4 address, an IPv4 CIDR, or an IPv6 CIDR. IPv6 CIDRs are limited to a maximum of /64.
    ListId string
    The unique ID of the list.
    ModifiedOn string
    The RFC 3339 timestamp of when the item was last modified.
    OperationId string
    The unique operation ID of the asynchronous action.
    Redirect ListItemRedirect
    The definition of the redirect.
    AccountId string
    Identifier
    Asn int
    A non-negative 32 bit integer
    Comment string
    An informative summary of the list item.
    CreatedOn string
    The RFC 3339 timestamp of when the item was created.
    Hostname ListItemHostnameArgs
    Valid characters for hostnames are ASCII(7) letters from a to z, the digits from 0 to 9, wildcards (*), and the hyphen (-).
    Ip string
    An IPv4 address, an IPv4 CIDR, or an IPv6 CIDR. IPv6 CIDRs are limited to a maximum of /64.
    ListId string
    The unique ID of the list.
    ModifiedOn string
    The RFC 3339 timestamp of when the item was last modified.
    OperationId string
    The unique operation ID of the asynchronous action.
    Redirect ListItemRedirectArgs
    The definition of the redirect.
    accountId String
    Identifier
    asn Integer
    A non-negative 32 bit integer
    comment String
    An informative summary of the list item.
    createdOn String
    The RFC 3339 timestamp of when the item was created.
    hostname ListItemHostname
    Valid characters for hostnames are ASCII(7) letters from a to z, the digits from 0 to 9, wildcards (*), and the hyphen (-).
    ip String
    An IPv4 address, an IPv4 CIDR, or an IPv6 CIDR. IPv6 CIDRs are limited to a maximum of /64.
    listId String
    The unique ID of the list.
    modifiedOn String
    The RFC 3339 timestamp of when the item was last modified.
    operationId String
    The unique operation ID of the asynchronous action.
    redirect ListItemRedirect
    The definition of the redirect.
    accountId string
    Identifier
    asn number
    A non-negative 32 bit integer
    comment string
    An informative summary of the list item.
    createdOn string
    The RFC 3339 timestamp of when the item was created.
    hostname ListItemHostname
    Valid characters for hostnames are ASCII(7) letters from a to z, the digits from 0 to 9, wildcards (*), and the hyphen (-).
    ip string
    An IPv4 address, an IPv4 CIDR, or an IPv6 CIDR. IPv6 CIDRs are limited to a maximum of /64.
    listId string
    The unique ID of the list.
    modifiedOn string
    The RFC 3339 timestamp of when the item was last modified.
    operationId string
    The unique operation ID of the asynchronous action.
    redirect ListItemRedirect
    The definition of the redirect.
    account_id str
    Identifier
    asn int
    A non-negative 32 bit integer
    comment str
    An informative summary of the list item.
    created_on str
    The RFC 3339 timestamp of when the item was created.
    hostname ListItemHostnameArgs
    Valid characters for hostnames are ASCII(7) letters from a to z, the digits from 0 to 9, wildcards (*), and the hyphen (-).
    ip str
    An IPv4 address, an IPv4 CIDR, or an IPv6 CIDR. IPv6 CIDRs are limited to a maximum of /64.
    list_id str
    The unique ID of the list.
    modified_on str
    The RFC 3339 timestamp of when the item was last modified.
    operation_id str
    The unique operation ID of the asynchronous action.
    redirect ListItemRedirectArgs
    The definition of the redirect.
    accountId String
    Identifier
    asn Number
    A non-negative 32 bit integer
    comment String
    An informative summary of the list item.
    createdOn String
    The RFC 3339 timestamp of when the item was created.
    hostname Property Map
    Valid characters for hostnames are ASCII(7) letters from a to z, the digits from 0 to 9, wildcards (*), and the hyphen (-).
    ip String
    An IPv4 address, an IPv4 CIDR, or an IPv6 CIDR. IPv6 CIDRs are limited to a maximum of /64.
    listId String
    The unique ID of the list.
    modifiedOn String
    The RFC 3339 timestamp of when the item was last modified.
    operationId String
    The unique operation ID of the asynchronous action.
    redirect Property Map
    The definition of the redirect.

    Supporting Types

    ListItemHostname, ListItemHostnameArgs

    ListItemRedirect, ListItemRedirectArgs

    SourceUrl string
    TargetUrl string
    IncludeSubdomains bool
    PreservePathSuffix bool
    PreserveQueryString bool
    StatusCode int
    Available values: 301, 302, 307, 308.
    SubpathMatching bool
    SourceUrl string
    TargetUrl string
    IncludeSubdomains bool
    PreservePathSuffix bool
    PreserveQueryString bool
    StatusCode int
    Available values: 301, 302, 307, 308.
    SubpathMatching bool
    sourceUrl String
    targetUrl String
    includeSubdomains Boolean
    preservePathSuffix Boolean
    preserveQueryString Boolean
    statusCode Integer
    Available values: 301, 302, 307, 308.
    subpathMatching Boolean
    sourceUrl string
    targetUrl string
    includeSubdomains boolean
    preservePathSuffix boolean
    preserveQueryString boolean
    statusCode number
    Available values: 301, 302, 307, 308.
    subpathMatching boolean
    sourceUrl String
    targetUrl String
    includeSubdomains Boolean
    preservePathSuffix Boolean
    preserveQueryString Boolean
    statusCode Number
    Available values: 301, 302, 307, 308.
    subpathMatching Boolean

    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