1. Packages
  2. Packages
  3. Fastly Provider
  4. API Docs
  5. DnsZone
Viewing docs for Fastly v12.2.1
published on Saturday, Jun 6, 2026 by Pulumi
fastly logo
Viewing docs for Fastly v12.2.1
published on Saturday, Jun 6, 2026 by Pulumi

    Provides a Fastly DNS Zone.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as fastly from "@pulumi/fastly";
    
    const example = new fastly.DnsZone("example", {
        name: "example.com.",
        description: "My secondary DNS zone",
        xfrConfigInbound: {
            inboundTsigKeyId: exampleFastlyTsigKey.id,
            primaries: [
                {
                    address: "192.0.2.1",
                    description: "Primary nameserver #1",
                },
                {
                    address: "192.0.2.2",
                    description: "Primary nameserver #1",
                },
            ],
        },
    });
    
    import pulumi
    import pulumi_fastly as fastly
    
    example = fastly.DnsZone("example",
        name="example.com.",
        description="My secondary DNS zone",
        xfr_config_inbound={
            "inbound_tsig_key_id": example_fastly_tsig_key["id"],
            "primaries": [
                {
                    "address": "192.0.2.1",
                    "description": "Primary nameserver #1",
                },
                {
                    "address": "192.0.2.2",
                    "description": "Primary nameserver #1",
                },
            ],
        })
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-fastly/sdk/v12/go/fastly"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := fastly.NewDnsZone(ctx, "example", &fastly.DnsZoneArgs{
    			Name:        pulumi.String("example.com."),
    			Description: pulumi.String("My secondary DNS zone"),
    			XfrConfigInbound: &fastly.DnsZoneXfrConfigInboundArgs{
    				InboundTsigKeyId: pulumi.Any(exampleFastlyTsigKey.Id),
    				Primaries: fastly.DnsZoneXfrConfigInboundPrimaryArray{
    					&fastly.DnsZoneXfrConfigInboundPrimaryArgs{
    						Address:     pulumi.String("192.0.2.1"),
    						Description: pulumi.String("Primary nameserver #1"),
    					},
    					&fastly.DnsZoneXfrConfigInboundPrimaryArgs{
    						Address:     pulumi.String("192.0.2.2"),
    						Description: pulumi.String("Primary nameserver #1"),
    					},
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Fastly = Pulumi.Fastly;
    
    return await Deployment.RunAsync(() => 
    {
        var example = new Fastly.DnsZone("example", new()
        {
            Name = "example.com.",
            Description = "My secondary DNS zone",
            XfrConfigInbound = new Fastly.Inputs.DnsZoneXfrConfigInboundArgs
            {
                InboundTsigKeyId = exampleFastlyTsigKey.Id,
                Primaries = new[]
                {
                    new Fastly.Inputs.DnsZoneXfrConfigInboundPrimaryArgs
                    {
                        Address = "192.0.2.1",
                        Description = "Primary nameserver #1",
                    },
                    new Fastly.Inputs.DnsZoneXfrConfigInboundPrimaryArgs
                    {
                        Address = "192.0.2.2",
                        Description = "Primary nameserver #1",
                    },
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.fastly.DnsZone;
    import com.pulumi.fastly.DnsZoneArgs;
    import com.pulumi.fastly.inputs.DnsZoneXfrConfigInboundArgs;
    import java.util.ArrayList;
    import java.util.Arrays;
    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 example = new DnsZone("example", DnsZoneArgs.builder()
                .name("example.com.")
                .description("My secondary DNS zone")
                .xfrConfigInbound(DnsZoneXfrConfigInboundArgs.builder()
                    .inboundTsigKeyId(exampleFastlyTsigKey.id())
                    .primaries(                
                        DnsZoneXfrConfigInboundPrimaryArgs.builder()
                            .address("192.0.2.1")
                            .description("Primary nameserver #1")
                            .build(),
                        DnsZoneXfrConfigInboundPrimaryArgs.builder()
                            .address("192.0.2.2")
                            .description("Primary nameserver #1")
                            .build())
                    .build())
                .build());
    
        }
    }
    
    resources:
      example:
        type: fastly:DnsZone
        properties:
          name: example.com.
          description: My secondary DNS zone
          xfrConfigInbound:
            inboundTsigKeyId: ${exampleFastlyTsigKey.id}
            primaries:
              - address: 192.0.2.1
                description: 'Primary nameserver #1'
              - address: 192.0.2.2
                description: 'Primary nameserver #1'
    
    pulumi {
      required_providers {
        fastly = {
          source = "pulumi/fastly"
        }
      }
    }
    
    resource "fastly_dnszone" "example" {
      name        = "example.com."
      description = "My secondary DNS zone"
      xfr_config_inbound = {
        inbound_tsig_key_id = exampleFastlyTsigKey.id
        primaries = [{
          "address"     = "192.0.2.1"
          "description" = "Primary nameserver #1"
          }, {
          "address"     = "192.0.2.2"
          "description" = "Primary nameserver #1"
        }]
      }
    }
    

    Create DnsZone Resource

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

    Constructor syntax

    new DnsZone(name: string, args?: DnsZoneArgs, opts?: CustomResourceOptions);
    @overload
    def DnsZone(resource_name: str,
                args: Optional[DnsZoneArgs] = None,
                opts: Optional[ResourceOptions] = None)
    
    @overload
    def DnsZone(resource_name: str,
                opts: Optional[ResourceOptions] = None,
                description: Optional[str] = None,
                name: Optional[str] = None,
                xfr_config_inbound: Optional[DnsZoneXfrConfigInboundArgs] = None)
    func NewDnsZone(ctx *Context, name string, args *DnsZoneArgs, opts ...ResourceOption) (*DnsZone, error)
    public DnsZone(string name, DnsZoneArgs? args = null, CustomResourceOptions? opts = null)
    public DnsZone(String name, DnsZoneArgs args)
    public DnsZone(String name, DnsZoneArgs args, CustomResourceOptions options)
    
    type: fastly:DnsZone
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    resource "fastly_dnszone" "name" {
        # resource properties
    }

    Parameters

    name string
    The unique name of the resource.
    args DnsZoneArgs
    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 DnsZoneArgs
    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 DnsZoneArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args DnsZoneArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args DnsZoneArgs
    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 dnsZoneResource = new Fastly.DnsZone("dnsZoneResource", new()
    {
        Description = "string",
        Name = "string",
        XfrConfigInbound = new Fastly.Inputs.DnsZoneXfrConfigInboundArgs
        {
            InboundTsigKeyId = "string",
            Primaries = new[]
            {
                new Fastly.Inputs.DnsZoneXfrConfigInboundPrimaryArgs
                {
                    Address = "string",
                    Description = "string",
                },
            },
        },
    });
    
    example, err := fastly.NewDnsZone(ctx, "dnsZoneResource", &fastly.DnsZoneArgs{
    	Description: pulumi.String("string"),
    	Name:        pulumi.String("string"),
    	XfrConfigInbound: &fastly.DnsZoneXfrConfigInboundArgs{
    		InboundTsigKeyId: pulumi.String("string"),
    		Primaries: fastly.DnsZoneXfrConfigInboundPrimaryArray{
    			&fastly.DnsZoneXfrConfigInboundPrimaryArgs{
    				Address:     pulumi.String("string"),
    				Description: pulumi.String("string"),
    			},
    		},
    	},
    })
    
    resource "fastly_dnszone" "dnsZoneResource" {
      description = "string"
      name        = "string"
      xfr_config_inbound = {
        inbound_tsig_key_id = "string"
        primaries = [{
          "address"     = "string"
          "description" = "string"
        }]
      }
    }
    
    var dnsZoneResource = new DnsZone("dnsZoneResource", DnsZoneArgs.builder()
        .description("string")
        .name("string")
        .xfrConfigInbound(DnsZoneXfrConfigInboundArgs.builder()
            .inboundTsigKeyId("string")
            .primaries(DnsZoneXfrConfigInboundPrimaryArgs.builder()
                .address("string")
                .description("string")
                .build())
            .build())
        .build());
    
    dns_zone_resource = fastly.DnsZone("dnsZoneResource",
        description="string",
        name="string",
        xfr_config_inbound={
            "inbound_tsig_key_id": "string",
            "primaries": [{
                "address": "string",
                "description": "string",
            }],
        })
    
    const dnsZoneResource = new fastly.DnsZone("dnsZoneResource", {
        description: "string",
        name: "string",
        xfrConfigInbound: {
            inboundTsigKeyId: "string",
            primaries: [{
                address: "string",
                description: "string",
            }],
        },
    });
    
    type: fastly:DnsZone
    properties:
        description: string
        name: string
        xfrConfigInbound:
            inboundTsigKeyId: string
            primaries:
                - address: string
                  description: string
    

    DnsZone 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 DnsZone resource accepts the following input properties:

    Description string
    A freeform descriptive note.
    Name string
    The domain name for your zone in FQDN format (e.g. example.com.). Must include a trailing dot.
    XfrConfigInbound DnsZoneXfrConfigInbound
    All attributes associated with inbound zone transfers.
    Description string
    A freeform descriptive note.
    Name string
    The domain name for your zone in FQDN format (e.g. example.com.). Must include a trailing dot.
    XfrConfigInbound DnsZoneXfrConfigInboundArgs
    All attributes associated with inbound zone transfers.
    description string
    A freeform descriptive note.
    name string
    The domain name for your zone in FQDN format (e.g. example.com.). Must include a trailing dot.
    xfr_config_inbound object
    All attributes associated with inbound zone transfers.
    description String
    A freeform descriptive note.
    name String
    The domain name for your zone in FQDN format (e.g. example.com.). Must include a trailing dot.
    xfrConfigInbound DnsZoneXfrConfigInbound
    All attributes associated with inbound zone transfers.
    description string
    A freeform descriptive note.
    name string
    The domain name for your zone in FQDN format (e.g. example.com.). Must include a trailing dot.
    xfrConfigInbound DnsZoneXfrConfigInbound
    All attributes associated with inbound zone transfers.
    description str
    A freeform descriptive note.
    name str
    The domain name for your zone in FQDN format (e.g. example.com.). Must include a trailing dot.
    xfr_config_inbound DnsZoneXfrConfigInboundArgs
    All attributes associated with inbound zone transfers.
    description String
    A freeform descriptive note.
    name String
    The domain name for your zone in FQDN format (e.g. example.com.). Must include a trailing dot.
    xfrConfigInbound Property Map
    All attributes associated with inbound zone transfers.

    Outputs

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

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing DnsZone Resource

    Get an existing DnsZone 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?: DnsZoneState, opts?: CustomResourceOptions): DnsZone
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            description: Optional[str] = None,
            name: Optional[str] = None,
            xfr_config_inbound: Optional[DnsZoneXfrConfigInboundArgs] = None) -> DnsZone
    func GetDnsZone(ctx *Context, name string, id IDInput, state *DnsZoneState, opts ...ResourceOption) (*DnsZone, error)
    public static DnsZone Get(string name, Input<string> id, DnsZoneState? state, CustomResourceOptions? opts = null)
    public static DnsZone get(String name, Output<String> id, DnsZoneState state, CustomResourceOptions options)
    resources:  _:    type: fastly:DnsZone    get:      id: ${id}
    import {
      to = fastly_dnszone.example
      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:
    Description string
    A freeform descriptive note.
    Name string
    The domain name for your zone in FQDN format (e.g. example.com.). Must include a trailing dot.
    XfrConfigInbound DnsZoneXfrConfigInbound
    All attributes associated with inbound zone transfers.
    Description string
    A freeform descriptive note.
    Name string
    The domain name for your zone in FQDN format (e.g. example.com.). Must include a trailing dot.
    XfrConfigInbound DnsZoneXfrConfigInboundArgs
    All attributes associated with inbound zone transfers.
    description string
    A freeform descriptive note.
    name string
    The domain name for your zone in FQDN format (e.g. example.com.). Must include a trailing dot.
    xfr_config_inbound object
    All attributes associated with inbound zone transfers.
    description String
    A freeform descriptive note.
    name String
    The domain name for your zone in FQDN format (e.g. example.com.). Must include a trailing dot.
    xfrConfigInbound DnsZoneXfrConfigInbound
    All attributes associated with inbound zone transfers.
    description string
    A freeform descriptive note.
    name string
    The domain name for your zone in FQDN format (e.g. example.com.). Must include a trailing dot.
    xfrConfigInbound DnsZoneXfrConfigInbound
    All attributes associated with inbound zone transfers.
    description str
    A freeform descriptive note.
    name str
    The domain name for your zone in FQDN format (e.g. example.com.). Must include a trailing dot.
    xfr_config_inbound DnsZoneXfrConfigInboundArgs
    All attributes associated with inbound zone transfers.
    description String
    A freeform descriptive note.
    name String
    The domain name for your zone in FQDN format (e.g. example.com.). Must include a trailing dot.
    xfrConfigInbound Property Map
    All attributes associated with inbound zone transfers.

    Supporting Types

    DnsZoneXfrConfigInbound, DnsZoneXfrConfigInboundArgs

    InboundTsigKeyId string
    The ID of the TSIG key used to secure inbound zone transfers.
    Primaries List<DnsZoneXfrConfigInboundPrimary>
    An array of the primary DNS server objects associated with inbound zone transfers.
    InboundTsigKeyId string
    The ID of the TSIG key used to secure inbound zone transfers.
    Primaries []DnsZoneXfrConfigInboundPrimary
    An array of the primary DNS server objects associated with inbound zone transfers.
    inbound_tsig_key_id string
    The ID of the TSIG key used to secure inbound zone transfers.
    primaries list(object)
    An array of the primary DNS server objects associated with inbound zone transfers.
    inboundTsigKeyId String
    The ID of the TSIG key used to secure inbound zone transfers.
    primaries List<DnsZoneXfrConfigInboundPrimary>
    An array of the primary DNS server objects associated with inbound zone transfers.
    inboundTsigKeyId string
    The ID of the TSIG key used to secure inbound zone transfers.
    primaries DnsZoneXfrConfigInboundPrimary[]
    An array of the primary DNS server objects associated with inbound zone transfers.
    inbound_tsig_key_id str
    The ID of the TSIG key used to secure inbound zone transfers.
    primaries Sequence[DnsZoneXfrConfigInboundPrimary]
    An array of the primary DNS server objects associated with inbound zone transfers.
    inboundTsigKeyId String
    The ID of the TSIG key used to secure inbound zone transfers.
    primaries List<Property Map>
    An array of the primary DNS server objects associated with inbound zone transfers.

    DnsZoneXfrConfigInboundPrimary, DnsZoneXfrConfigInboundPrimaryArgs

    Address string
    An IPv4 address for the Primary DNS Server.
    Description string
    A description of the Primary DNS server.
    Address string
    An IPv4 address for the Primary DNS Server.
    Description string
    A description of the Primary DNS server.
    address string
    An IPv4 address for the Primary DNS Server.
    description string
    A description of the Primary DNS server.
    address String
    An IPv4 address for the Primary DNS Server.
    description String
    A description of the Primary DNS server.
    address string
    An IPv4 address for the Primary DNS Server.
    description string
    A description of the Primary DNS server.
    address str
    An IPv4 address for the Primary DNS Server.
    description str
    A description of the Primary DNS server.
    address String
    An IPv4 address for the Primary DNS Server.
    description String
    A description of the Primary DNS server.

    Import

    Fastly DNS Zones can be imported using their Zone ID, e.g.

    $ pulumi import fastly:index/dnsZone:DnsZone example xxxxxxxxxxxxxxxxxxxx
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    Fastly pulumi/pulumi-fastly
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the fastly Terraform Provider.
    fastly logo
    Viewing docs for Fastly v12.2.1
    published on Saturday, Jun 6, 2026 by Pulumi

      Try Pulumi Cloud free.
      Your team will thank you.

      Start free trial