1. Packages
  2. Gcore Provider
  3. API Docs
  4. DnsNetworkMapping
Viewing docs for gcore 2.0.0-alpha.2
published on Tuesday, Mar 24, 2026 by g-core
gcore logo
Viewing docs for gcore 2.0.0-alpha.2
published on Tuesday, Mar 24, 2026 by g-core

    DNS network mappings associate CIDR ranges with network tags for private DNS resolution and traffic-based routing.

    Example Usage

    Private DNS network mapping

    Creates a DNS network mapping with IPv4 and IPv6 CIDRs for private DNS resolution.

    import * as pulumi from "@pulumi/pulumi";
    import * as gcore from "@pulumi/gcore";
    
    // Create a DNS network mapping for private DNS resolution
    const example = new gcore.DnsNetworkMapping("example", {
        name: "DevNetwork",
        mappings: [{
            tags: [
                "development",
                "test",
            ],
            cidr4s: [
                "10.0.0.0/16",
                "10.1.0.0/16",
            ],
            cidr6s: ["fd00::/8"],
        }],
    });
    
    import pulumi
    import pulumi_gcore as gcore
    
    # Create a DNS network mapping for private DNS resolution
    example = gcore.DnsNetworkMapping("example",
        name="DevNetwork",
        mappings=[{
            "tags": [
                "development",
                "test",
            ],
            "cidr4s": [
                "10.0.0.0/16",
                "10.1.0.0/16",
            ],
            "cidr6s": ["fd00::/8"],
        }])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/gcore/v2/gcore"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		// Create a DNS network mapping for private DNS resolution
    		_, err := gcore.NewDnsNetworkMapping(ctx, "example", &gcore.DnsNetworkMappingArgs{
    			Name: pulumi.String("DevNetwork"),
    			Mappings: gcore.DnsNetworkMappingMappingArray{
    				&gcore.DnsNetworkMappingMappingArgs{
    					Tags: pulumi.StringArray{
    						pulumi.String("development"),
    						pulumi.String("test"),
    					},
    					Cidr4s: pulumi.StringArray{
    						pulumi.String("10.0.0.0/16"),
    						pulumi.String("10.1.0.0/16"),
    					},
    					Cidr6s: pulumi.StringArray{
    						pulumi.String("fd00::/8"),
    					},
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcore = Pulumi.Gcore;
    
    return await Deployment.RunAsync(() => 
    {
        // Create a DNS network mapping for private DNS resolution
        var example = new Gcore.DnsNetworkMapping("example", new()
        {
            Name = "DevNetwork",
            Mappings = new[]
            {
                new Gcore.Inputs.DnsNetworkMappingMappingArgs
                {
                    Tags = new[]
                    {
                        "development",
                        "test",
                    },
                    Cidr4s = new[]
                    {
                        "10.0.0.0/16",
                        "10.1.0.0/16",
                    },
                    Cidr6s = new[]
                    {
                        "fd00::/8",
                    },
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gcore.DnsNetworkMapping;
    import com.pulumi.gcore.DnsNetworkMappingArgs;
    import com.pulumi.gcore.inputs.DnsNetworkMappingMappingArgs;
    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) {
            // Create a DNS network mapping for private DNS resolution
            var example = new DnsNetworkMapping("example", DnsNetworkMappingArgs.builder()
                .name("DevNetwork")
                .mappings(DnsNetworkMappingMappingArgs.builder()
                    .tags(                
                        "development",
                        "test")
                    .cidr4s(                
                        "10.0.0.0/16",
                        "10.1.0.0/16")
                    .cidr6s("fd00::/8")
                    .build())
                .build());
    
        }
    }
    
    resources:
      # Create a DNS network mapping for private DNS resolution
      example:
        type: gcore:DnsNetworkMapping
        properties:
          name: DevNetwork
          mappings:
            - tags:
                - development
                - test
              cidr4s:
                - 10.0.0.0/16
                - 10.1.0.0/16
              cidr6s:
                - fd00::/8
    

    Create DnsNetworkMapping Resource

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

    Constructor syntax

    new DnsNetworkMapping(name: string, args?: DnsNetworkMappingArgs, opts?: CustomResourceOptions);
    @overload
    def DnsNetworkMapping(resource_name: str,
                          args: Optional[DnsNetworkMappingArgs] = None,
                          opts: Optional[ResourceOptions] = None)
    
    @overload
    def DnsNetworkMapping(resource_name: str,
                          opts: Optional[ResourceOptions] = None,
                          mappings: Optional[Sequence[DnsNetworkMappingMappingArgs]] = None,
                          name: Optional[str] = None)
    func NewDnsNetworkMapping(ctx *Context, name string, args *DnsNetworkMappingArgs, opts ...ResourceOption) (*DnsNetworkMapping, error)
    public DnsNetworkMapping(string name, DnsNetworkMappingArgs? args = null, CustomResourceOptions? opts = null)
    public DnsNetworkMapping(String name, DnsNetworkMappingArgs args)
    public DnsNetworkMapping(String name, DnsNetworkMappingArgs args, CustomResourceOptions options)
    
    type: gcore:DnsNetworkMapping
    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 DnsNetworkMappingArgs
    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 DnsNetworkMappingArgs
    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 DnsNetworkMappingArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args DnsNetworkMappingArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args DnsNetworkMappingArgs
    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 dnsNetworkMappingResource = new Gcore.DnsNetworkMapping("dnsNetworkMappingResource", new()
    {
        Mappings = new[]
        {
            new Gcore.Inputs.DnsNetworkMappingMappingArgs
            {
                Cidr4s = new[]
                {
                    "string",
                },
                Cidr6s = new[]
                {
                    "string",
                },
                Tags = new[]
                {
                    "string",
                },
            },
        },
        Name = "string",
    });
    
    example, err := gcore.NewDnsNetworkMapping(ctx, "dnsNetworkMappingResource", &gcore.DnsNetworkMappingArgs{
    	Mappings: gcore.DnsNetworkMappingMappingArray{
    		&gcore.DnsNetworkMappingMappingArgs{
    			Cidr4s: pulumi.StringArray{
    				pulumi.String("string"),
    			},
    			Cidr6s: pulumi.StringArray{
    				pulumi.String("string"),
    			},
    			Tags: pulumi.StringArray{
    				pulumi.String("string"),
    			},
    		},
    	},
    	Name: pulumi.String("string"),
    })
    
    var dnsNetworkMappingResource = new DnsNetworkMapping("dnsNetworkMappingResource", DnsNetworkMappingArgs.builder()
        .mappings(DnsNetworkMappingMappingArgs.builder()
            .cidr4s("string")
            .cidr6s("string")
            .tags("string")
            .build())
        .name("string")
        .build());
    
    dns_network_mapping_resource = gcore.DnsNetworkMapping("dnsNetworkMappingResource",
        mappings=[{
            "cidr4s": ["string"],
            "cidr6s": ["string"],
            "tags": ["string"],
        }],
        name="string")
    
    const dnsNetworkMappingResource = new gcore.DnsNetworkMapping("dnsNetworkMappingResource", {
        mappings: [{
            cidr4s: ["string"],
            cidr6s: ["string"],
            tags: ["string"],
        }],
        name: "string",
    });
    
    type: gcore:DnsNetworkMapping
    properties:
        mappings:
            - cidr4s:
                - string
              cidr6s:
                - string
              tags:
                - string
        name: string
    

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

    Outputs

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

    DnsNetworkMappingId double
    The ID of this resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    DnsNetworkMappingId float64
    The ID of this resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    dnsNetworkMappingId Double
    The ID of this resource.
    id String
    The provider-assigned unique ID for this managed resource.
    dnsNetworkMappingId number
    The ID of this resource.
    id string
    The provider-assigned unique ID for this managed resource.
    dns_network_mapping_id float
    The ID of this resource.
    id str
    The provider-assigned unique ID for this managed resource.
    dnsNetworkMappingId Number
    The ID of this resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing DnsNetworkMapping Resource

    Get an existing DnsNetworkMapping 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?: DnsNetworkMappingState, opts?: CustomResourceOptions): DnsNetworkMapping
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            dns_network_mapping_id: Optional[float] = None,
            mappings: Optional[Sequence[DnsNetworkMappingMappingArgs]] = None,
            name: Optional[str] = None) -> DnsNetworkMapping
    func GetDnsNetworkMapping(ctx *Context, name string, id IDInput, state *DnsNetworkMappingState, opts ...ResourceOption) (*DnsNetworkMapping, error)
    public static DnsNetworkMapping Get(string name, Input<string> id, DnsNetworkMappingState? state, CustomResourceOptions? opts = null)
    public static DnsNetworkMapping get(String name, Output<String> id, DnsNetworkMappingState state, CustomResourceOptions options)
    resources:  _:    type: gcore:DnsNetworkMapping    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:
    dnsNetworkMappingId number
    The ID of this resource.
    mappings DnsNetworkMappingMapping[]
    name string
    dnsNetworkMappingId Number
    The ID of this resource.
    mappings List<Property Map>
    name String

    Supporting Types

    DnsNetworkMappingMapping, DnsNetworkMappingMappingArgs

    Cidr4s List<string>
    Cidr6s List<string>
    Tags List<string>
    Cidr4s []string
    Cidr6s []string
    Tags []string
    cidr4s List<String>
    cidr6s List<String>
    tags List<String>
    cidr4s string[]
    cidr6s string[]
    tags string[]
    cidr4s Sequence[str]
    cidr6s Sequence[str]
    tags Sequence[str]
    cidr4s List<String>
    cidr6s List<String>
    tags List<String>

    Import

    $ pulumi import gcore:index/dnsNetworkMapping:DnsNetworkMapping example '<id>'
    

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

    Package Details

    Repository
    gcore g-core/terraform-provider-gcore
    License
    Notes
    This Pulumi package is based on the gcore Terraform Provider.
    gcore logo
    Viewing docs for gcore 2.0.0-alpha.2
    published on Tuesday, Mar 24, 2026 by g-core
      Try Pulumi Cloud free. Your team will thank you.