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

getZones

Use this data source to look up Zone records.

Example Usage

using Pulumi;
using Cloudflare = Pulumi.Cloudflare;

class MyStack : Stack
{
    public MyStack()
    {
        var example = Output.Create(Cloudflare.GetZones.InvokeAsync(new Cloudflare.GetZonesArgs
        {
            Filter = new Cloudflare.Inputs.GetZonesFilterArgs
            {
                Name = "example.com",
            },
        }));
    }

}
package main

import (
    "github.com/pulumi/pulumi-cloudflare/sdk/v2/go/cloudflare"
    "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)

func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
        _, err := cloudflare.GetZones(ctx, &cloudflare.GetZonesArgs{
            Filter: cloudflare.GetZonesFilter{
                Name: "example.com",
            },
        }, nil)
        if err != nil {
            return err
        }
        return nil
    })
}
import pulumi
import pulumi_cloudflare as cloudflare

example = cloudflare.get_zones(filter=cloudflare.GetZonesFilterArgs(
    name="example.com",
))
import * as pulumi from "@pulumi/pulumi";
import * as cloudflare from "@pulumi/cloudflare";

// Look for a single zone that you know exists using an exact match.
// API request will be for zones?name=example.com. Will not match not-example.com
// or example.net.
const example = pulumi.output(cloudflare.getZones({
    filter: {
        name: "example.com",
    },
}, { async: true }));

Example usage with other resources

Coming soon!

Coming soon!

Coming soon!

import * as pulumi from "@pulumi/pulumi";
import * as cloudflare from "@pulumi/cloudflare";

const test = cloudflare.getZones({
    filter: {
        name: "example",
        lookupType: "contains",
        match: `.com$`,
        status: "active",
    },
});
const endpointLockdown = new cloudflare.ZoneLockdown("endpointLockdown", {
    zone: test.then(test => test.zones[0])["name"],
    paused: "false",
    description: "Restrict access to these endpoints to requests from a known IP address",
    urls: ["api.mysite.com/some/endpoint*"],
    configurations: [{
        target: "ip",
        value: "198.51.100.4",
    }],
});
const example = new cloudflare.Zone("example", {
    zoneId: test.then(test => test.zones[0])["id"],
    name: "www",
    value: "203.0.113.1",
    type: "A",
    proxied: false,
});

Using getZones

function getZones(args: GetZonesArgs, opts?: InvokeOptions): Promise<GetZonesResult>
def get_zones(filter: Optional[GetZonesFilterArgs] = None, opts: Optional[InvokeOptions] = None) -> GetZonesResult
func GetZones(ctx *Context, args *GetZonesArgs, opts ...InvokeOption) (*GetZonesResult, error)

Note: This function is named GetZones in the Go SDK.

public static class GetZones {
    public static Task<GetZonesResult> InvokeAsync(GetZonesArgs args, InvokeOptions? opts = null)
}

The following arguments are supported:

Filter GetZonesFilterArgs

One or more values used to look up zone records. If more than one value is given all values must match in order to be included, see below for full list.

Filter GetZonesFilter

One or more values used to look up zone records. If more than one value is given all values must match in order to be included, see below for full list.

filter GetZonesFilter

One or more values used to look up zone records. If more than one value is given all values must match in order to be included, see below for full list.

filter GetZonesFilterArgs

One or more values used to look up zone records. If more than one value is given all values must match in order to be included, see below for full list.

getZones Result

The following output properties are available:

Filter GetZonesFilter
Id string

The provider-assigned unique ID for this managed resource.

Zones List<GetZonesZone>

A map of zone details. Full list below:

Filter GetZonesFilter
Id string

The provider-assigned unique ID for this managed resource.

Zones []GetZonesZone

A map of zone details. Full list below:

filter GetZonesFilter
id string

The provider-assigned unique ID for this managed resource.

zones GetZonesZone[]

A map of zone details. Full list below:

filter GetZonesFilter
id str

The provider-assigned unique ID for this managed resource.

zones Sequence[GetZonesZone]

A map of zone details. Full list below:

Supporting Types

GetZonesFilter

LookupType string

The type of search to perform for the name value when querying the zone API. Valid values: "exact" and "contains". Defaults to "exact".

Match string

A RE2 compatible regular expression to filter the results. This is performed client side whereas the name and lookup_type are performed on the Cloudflare server side.

Name string

A string value to search for.

Paused bool

Paused status of the zone to lookup. Valid values are true or false.

Status string

Status of the zone to lookup. Valid values: "active", "pending", "initializing", "moved", "deleted", "deactivated" and "read only".

LookupType string

The type of search to perform for the name value when querying the zone API. Valid values: "exact" and "contains". Defaults to "exact".

Match string

A RE2 compatible regular expression to filter the results. This is performed client side whereas the name and lookup_type are performed on the Cloudflare server side.

Name string

A string value to search for.

Paused bool

Paused status of the zone to lookup. Valid values are true or false.

Status string

Status of the zone to lookup. Valid values: "active", "pending", "initializing", "moved", "deleted", "deactivated" and "read only".

lookupType string

The type of search to perform for the name value when querying the zone API. Valid values: "exact" and "contains". Defaults to "exact".

match string

A RE2 compatible regular expression to filter the results. This is performed client side whereas the name and lookup_type are performed on the Cloudflare server side.

name string

A string value to search for.

paused boolean

Paused status of the zone to lookup. Valid values are true or false.

status string

Status of the zone to lookup. Valid values: "active", "pending", "initializing", "moved", "deleted", "deactivated" and "read only".

lookup_type str

The type of search to perform for the name value when querying the zone API. Valid values: "exact" and "contains". Defaults to "exact".

match str

A RE2 compatible regular expression to filter the results. This is performed client side whereas the name and lookup_type are performed on the Cloudflare server side.

name str

A string value to search for.

paused bool

Paused status of the zone to lookup. Valid values are true or false.

status str

Status of the zone to lookup. Valid values: "active", "pending", "initializing", "moved", "deleted", "deactivated" and "read only".

GetZonesZone

Id string

The zone ID

Name string

A string value to search for.

Id string

The zone ID

Name string

A string value to search for.

id string

The zone ID

name string

A string value to search for.

id str

The zone ID

name str

A string value to search for.

Package Details

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