cloudflare.getZone
Explore with Pulumi AI
Use this data source to look up zone
info. This is the singular alternative to cloudflare.getZones
.
Note Cloudflare zone names are not unique. It is possible for multiple accounts to have the same zone created but in different states. If you are using this setup, it is advised to use the
account_id
attribute on this resource or swap tocloudflare.getZones
to further filter the results.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as cloudflare from "@pulumi/cloudflare";
const example = cloudflare.getZone({
name: "example.com",
});
const exampleRecord = new cloudflare.Record("example", {
zoneId: example.then(example => example.id),
name: "www",
content: "203.0.113.1",
type: "A",
proxied: true,
});
import pulumi
import pulumi_cloudflare as cloudflare
example = cloudflare.get_zone(name="example.com")
example_record = cloudflare.Record("example",
zone_id=example.id,
name="www",
content="203.0.113.1",
type="A",
proxied=True)
package main
import (
"github.com/pulumi/pulumi-cloudflare/sdk/v5/go/cloudflare"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := cloudflare.LookupZone(ctx, &cloudflare.LookupZoneArgs{
Name: pulumi.StringRef("example.com"),
}, nil)
if err != nil {
return err
}
_, err = cloudflare.NewRecord(ctx, "example", &cloudflare.RecordArgs{
ZoneId: pulumi.String(example.Id),
Name: pulumi.String("www"),
Content: pulumi.String("203.0.113.1"),
Type: pulumi.String("A"),
Proxied: pulumi.Bool(true),
})
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 example = Cloudflare.GetZone.Invoke(new()
{
Name = "example.com",
});
var exampleRecord = new Cloudflare.Record("example", new()
{
ZoneId = example.Apply(getZoneResult => getZoneResult.Id),
Name = "www",
Content = "203.0.113.1",
Type = "A",
Proxied = true,
});
});
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.GetZoneArgs;
import com.pulumi.cloudflare.Record;
import com.pulumi.cloudflare.RecordArgs;
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 example = CloudflareFunctions.getZone(GetZoneArgs.builder()
.name("example.com")
.build());
var exampleRecord = new Record("exampleRecord", RecordArgs.builder()
.zoneId(example.applyValue(getZoneResult -> getZoneResult.id()))
.name("www")
.content("203.0.113.1")
.type("A")
.proxied(true)
.build());
}
}
resources:
exampleRecord:
type: cloudflare:Record
name: example
properties:
zoneId: ${example.id}
name: www
content: 203.0.113.1
type: A
proxied: true
variables:
example:
fn::invoke:
Function: cloudflare:getZone
Arguments:
name: example.com
Using getZone
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 getZone(args: GetZoneArgs, opts?: InvokeOptions): Promise<GetZoneResult>
function getZoneOutput(args: GetZoneOutputArgs, opts?: InvokeOptions): Output<GetZoneResult>
def get_zone(account_id: Optional[str] = None,
name: Optional[str] = None,
zone_id: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetZoneResult
def get_zone_output(account_id: Optional[pulumi.Input[str]] = None,
name: Optional[pulumi.Input[str]] = None,
zone_id: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetZoneResult]
func LookupZone(ctx *Context, args *LookupZoneArgs, opts ...InvokeOption) (*LookupZoneResult, error)
func LookupZoneOutput(ctx *Context, args *LookupZoneOutputArgs, opts ...InvokeOption) LookupZoneResultOutput
> Note: This function is named LookupZone
in the Go SDK.
public static class GetZone
{
public static Task<GetZoneResult> InvokeAsync(GetZoneArgs args, InvokeOptions? opts = null)
public static Output<GetZoneResult> Invoke(GetZoneInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetZoneResult> getZone(GetZoneArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
function: cloudflare:index/getZone:getZone
arguments:
# arguments dictionary
The following arguments are supported:
- account_
id str - The account identifier to target for the resource.
- name str
- The name of the zone. Must provide only one of
zone_id
,name
. - zone_
id str - The zone identifier to target for the resource. Must provide only one of
zone_id
,name
.
getZone Result
The following output properties are available:
- Account
Id string - The account identifier to target for the resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- Name string
- The name of the zone. Must provide only one of
zone_id
,name
. - Name
Servers List<string> - Cloudflare assigned name servers. This is only populated for zones that use Cloudflare DNS.
- Paused bool
- Whether the zone is paused on Cloudflare.
- Plan string
- The name of the plan associated with the zone.
- Status string
- Status of the zone.
- Vanity
Name List<string>Servers - List of Vanity Nameservers (if set).
- Zone
Id string - The zone identifier to target for the resource. Must provide only one of
zone_id
,name
.
- Account
Id string - The account identifier to target for the resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- Name string
- The name of the zone. Must provide only one of
zone_id
,name
. - Name
Servers []string - Cloudflare assigned name servers. This is only populated for zones that use Cloudflare DNS.
- Paused bool
- Whether the zone is paused on Cloudflare.
- Plan string
- The name of the plan associated with the zone.
- Status string
- Status of the zone.
- Vanity
Name []stringServers - List of Vanity Nameservers (if set).
- Zone
Id string - The zone identifier to target for the resource. Must provide only one of
zone_id
,name
.
- account
Id String - The account identifier to target for the resource.
- id String
- The provider-assigned unique ID for this managed resource.
- name String
- The name of the zone. Must provide only one of
zone_id
,name
. - name
Servers List<String> - Cloudflare assigned name servers. This is only populated for zones that use Cloudflare DNS.
- paused Boolean
- Whether the zone is paused on Cloudflare.
- plan String
- The name of the plan associated with the zone.
- status String
- Status of the zone.
- vanity
Name List<String>Servers - List of Vanity Nameservers (if set).
- zone
Id String - The zone identifier to target for the resource. Must provide only one of
zone_id
,name
.
- account
Id string - The account identifier to target for the resource.
- id string
- The provider-assigned unique ID for this managed resource.
- name string
- The name of the zone. Must provide only one of
zone_id
,name
. - name
Servers string[] - Cloudflare assigned name servers. This is only populated for zones that use Cloudflare DNS.
- paused boolean
- Whether the zone is paused on Cloudflare.
- plan string
- The name of the plan associated with the zone.
- status string
- Status of the zone.
- vanity
Name string[]Servers - List of Vanity Nameservers (if set).
- zone
Id string - The zone identifier to target for the resource. Must provide only one of
zone_id
,name
.
- account_
id str - The account identifier to target for the resource.
- id str
- The provider-assigned unique ID for this managed resource.
- name str
- The name of the zone. Must provide only one of
zone_id
,name
. - name_
servers Sequence[str] - Cloudflare assigned name servers. This is only populated for zones that use Cloudflare DNS.
- paused bool
- Whether the zone is paused on Cloudflare.
- plan str
- The name of the plan associated with the zone.
- status str
- Status of the zone.
- vanity_
name_ Sequence[str]servers - List of Vanity Nameservers (if set).
- zone_
id str - The zone identifier to target for the resource. Must provide only one of
zone_id
,name
.
- account
Id String - The account identifier to target for the resource.
- id String
- The provider-assigned unique ID for this managed resource.
- name String
- The name of the zone. Must provide only one of
zone_id
,name
. - name
Servers List<String> - Cloudflare assigned name servers. This is only populated for zones that use Cloudflare DNS.
- paused Boolean
- Whether the zone is paused on Cloudflare.
- plan String
- The name of the plan associated with the zone.
- status String
- Status of the zone.
- vanity
Name List<String>Servers - List of Vanity Nameservers (if set).
- zone
Id String - The zone identifier to target for the resource. Must provide only one of
zone_id
,name
.
Package Details
- Repository
- Cloudflare pulumi/pulumi-cloudflare
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
cloudflare
Terraform Provider.