1. Packages
  2. Gcore Provider
  3. API Docs
  4. getCloudNetworkSubnet
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

    Subnets define IP address ranges within a network for instance connectivity, with support for DHCP and DNS configuration.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as gcore from "@pulumi/gcore";
    
    const exampleCloudNetworkSubnet = gcore.getCloudNetworkSubnet({
        projectId: 1,
        regionId: 1,
        subnetId: "b39792c3-3160-4356-912e-ba396c95cdcf",
    });
    
    import pulumi
    import pulumi_gcore as gcore
    
    example_cloud_network_subnet = gcore.get_cloud_network_subnet(project_id=1,
        region_id=1,
        subnet_id="b39792c3-3160-4356-912e-ba396c95cdcf")
    
    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 {
    		_, err := gcore.LookupCloudNetworkSubnet(ctx, &gcore.LookupCloudNetworkSubnetArgs{
    			ProjectId: pulumi.Float64Ref(1),
    			RegionId:  pulumi.Float64Ref(1),
    			SubnetId:  pulumi.StringRef("b39792c3-3160-4356-912e-ba396c95cdcf"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcore = Pulumi.Gcore;
    
    return await Deployment.RunAsync(() => 
    {
        var exampleCloudNetworkSubnet = Gcore.GetCloudNetworkSubnet.Invoke(new()
        {
            ProjectId = 1,
            RegionId = 1,
            SubnetId = "b39792c3-3160-4356-912e-ba396c95cdcf",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gcore.GcoreFunctions;
    import com.pulumi.gcore.inputs.GetCloudNetworkSubnetArgs;
    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 exampleCloudNetworkSubnet = GcoreFunctions.getCloudNetworkSubnet(GetCloudNetworkSubnetArgs.builder()
                .projectId(1)
                .regionId(1)
                .subnetId("b39792c3-3160-4356-912e-ba396c95cdcf")
                .build());
    
        }
    }
    
    variables:
      exampleCloudNetworkSubnet:
        fn::invoke:
          function: gcore:getCloudNetworkSubnet
          arguments:
            projectId: 1
            regionId: 1
            subnetId: b39792c3-3160-4356-912e-ba396c95cdcf
    

    Using getCloudNetworkSubnet

    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 getCloudNetworkSubnet(args: GetCloudNetworkSubnetArgs, opts?: InvokeOptions): Promise<GetCloudNetworkSubnetResult>
    function getCloudNetworkSubnetOutput(args: GetCloudNetworkSubnetOutputArgs, opts?: InvokeOptions): Output<GetCloudNetworkSubnetResult>
    def get_cloud_network_subnet(find_one_by: Optional[GetCloudNetworkSubnetFindOneBy] = None,
                                 project_id: Optional[float] = None,
                                 region_id: Optional[float] = None,
                                 subnet_id: Optional[str] = None,
                                 opts: Optional[InvokeOptions] = None) -> GetCloudNetworkSubnetResult
    def get_cloud_network_subnet_output(find_one_by: Optional[pulumi.Input[GetCloudNetworkSubnetFindOneByArgs]] = None,
                                 project_id: Optional[pulumi.Input[float]] = None,
                                 region_id: Optional[pulumi.Input[float]] = None,
                                 subnet_id: Optional[pulumi.Input[str]] = None,
                                 opts: Optional[InvokeOptions] = None) -> Output[GetCloudNetworkSubnetResult]
    func LookupCloudNetworkSubnet(ctx *Context, args *LookupCloudNetworkSubnetArgs, opts ...InvokeOption) (*LookupCloudNetworkSubnetResult, error)
    func LookupCloudNetworkSubnetOutput(ctx *Context, args *LookupCloudNetworkSubnetOutputArgs, opts ...InvokeOption) LookupCloudNetworkSubnetResultOutput

    > Note: This function is named LookupCloudNetworkSubnet in the Go SDK.

    public static class GetCloudNetworkSubnet 
    {
        public static Task<GetCloudNetworkSubnetResult> InvokeAsync(GetCloudNetworkSubnetArgs args, InvokeOptions? opts = null)
        public static Output<GetCloudNetworkSubnetResult> Invoke(GetCloudNetworkSubnetInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetCloudNetworkSubnetResult> getCloudNetworkSubnet(GetCloudNetworkSubnetArgs args, InvokeOptions options)
    public static Output<GetCloudNetworkSubnetResult> getCloudNetworkSubnet(GetCloudNetworkSubnetArgs args, InvokeOptions options)
    
    fn::invoke:
      function: gcore:index/getCloudNetworkSubnet:getCloudNetworkSubnet
      arguments:
        # arguments dictionary

    The following arguments are supported:

    FindOneBy GetCloudNetworkSubnetFindOneBy
    ProjectId double
    Project ID
    RegionId double
    Region ID
    SubnetId string
    Subnet ID
    FindOneBy GetCloudNetworkSubnetFindOneBy
    ProjectId float64
    Project ID
    RegionId float64
    Region ID
    SubnetId string
    Subnet ID
    findOneBy GetCloudNetworkSubnetFindOneBy
    projectId Double
    Project ID
    regionId Double
    Region ID
    subnetId String
    Subnet ID
    findOneBy GetCloudNetworkSubnetFindOneBy
    projectId number
    Project ID
    regionId number
    Region ID
    subnetId string
    Subnet ID
    findOneBy Property Map
    projectId Number
    Project ID
    regionId Number
    Region ID
    subnetId String
    Subnet ID

    getCloudNetworkSubnet Result

    The following output properties are available:

    AvailableIps double
    Number of available ips in subnet
    Cidr string
    CIDR
    CreatedAt string
    Datetime when the subnet was created
    CreatorTaskId string
    Task that created this entity
    DnsNameservers List<string>
    List IP addresses of a DNS resolver reachable from the network
    EnableDhcp bool
    True if DHCP should be enabled
    GatewayIp string
    Default GW IPv4 address, advertised in DHCP routes of this subnet. If null, no gateway is advertised by this subnet.
    HasRouter bool
    Deprecated. Always returns false.

    Deprecated: Deprecated

    HostRoutes List<GetCloudNetworkSubnetHostRoute>
    List of custom static routes to advertise via DHCP.
    Id string
    Subnet ID
    IpVersion double
    IP version Available values: 4, 6.
    Name string
    Subnet name
    NetworkId string
    Network ID
    Region string
    Region name
    Tags List<GetCloudNetworkSubnetTag>
    List of key-value tags associated with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for better organization and management. Some tags are read-only and cannot be modified by the user. Tags are also integrated with cost reports, allowing cost data to be filtered based on tag keys or values.
    TotalIps double
    Total number of ips in subnet
    UpdatedAt string
    Datetime when the subnet was last updated
    FindOneBy GetCloudNetworkSubnetFindOneBy
    ProjectId double
    Project ID
    RegionId double
    Region ID
    SubnetId string
    Subnet ID
    AvailableIps float64
    Number of available ips in subnet
    Cidr string
    CIDR
    CreatedAt string
    Datetime when the subnet was created
    CreatorTaskId string
    Task that created this entity
    DnsNameservers []string
    List IP addresses of a DNS resolver reachable from the network
    EnableDhcp bool
    True if DHCP should be enabled
    GatewayIp string
    Default GW IPv4 address, advertised in DHCP routes of this subnet. If null, no gateway is advertised by this subnet.
    HasRouter bool
    Deprecated. Always returns false.

    Deprecated: Deprecated

    HostRoutes []GetCloudNetworkSubnetHostRoute
    List of custom static routes to advertise via DHCP.
    Id string
    Subnet ID
    IpVersion float64
    IP version Available values: 4, 6.
    Name string
    Subnet name
    NetworkId string
    Network ID
    Region string
    Region name
    Tags []GetCloudNetworkSubnetTag
    List of key-value tags associated with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for better organization and management. Some tags are read-only and cannot be modified by the user. Tags are also integrated with cost reports, allowing cost data to be filtered based on tag keys or values.
    TotalIps float64
    Total number of ips in subnet
    UpdatedAt string
    Datetime when the subnet was last updated
    FindOneBy GetCloudNetworkSubnetFindOneBy
    ProjectId float64
    Project ID
    RegionId float64
    Region ID
    SubnetId string
    Subnet ID
    availableIps Double
    Number of available ips in subnet
    cidr String
    CIDR
    createdAt String
    Datetime when the subnet was created
    creatorTaskId String
    Task that created this entity
    dnsNameservers List<String>
    List IP addresses of a DNS resolver reachable from the network
    enableDhcp Boolean
    True if DHCP should be enabled
    gatewayIp String
    Default GW IPv4 address, advertised in DHCP routes of this subnet. If null, no gateway is advertised by this subnet.
    hasRouter Boolean
    Deprecated. Always returns false.

    Deprecated: Deprecated

    hostRoutes List<GetCloudNetworkSubnetHostRoute>
    List of custom static routes to advertise via DHCP.
    id String
    Subnet ID
    ipVersion Double
    IP version Available values: 4, 6.
    name String
    Subnet name
    networkId String
    Network ID
    region String
    Region name
    tags List<GetCloudNetworkSubnetTag>
    List of key-value tags associated with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for better organization and management. Some tags are read-only and cannot be modified by the user. Tags are also integrated with cost reports, allowing cost data to be filtered based on tag keys or values.
    totalIps Double
    Total number of ips in subnet
    updatedAt String
    Datetime when the subnet was last updated
    findOneBy GetCloudNetworkSubnetFindOneBy
    projectId Double
    Project ID
    regionId Double
    Region ID
    subnetId String
    Subnet ID
    availableIps number
    Number of available ips in subnet
    cidr string
    CIDR
    createdAt string
    Datetime when the subnet was created
    creatorTaskId string
    Task that created this entity
    dnsNameservers string[]
    List IP addresses of a DNS resolver reachable from the network
    enableDhcp boolean
    True if DHCP should be enabled
    gatewayIp string
    Default GW IPv4 address, advertised in DHCP routes of this subnet. If null, no gateway is advertised by this subnet.
    hasRouter boolean
    Deprecated. Always returns false.

    Deprecated: Deprecated

    hostRoutes GetCloudNetworkSubnetHostRoute[]
    List of custom static routes to advertise via DHCP.
    id string
    Subnet ID
    ipVersion number
    IP version Available values: 4, 6.
    name string
    Subnet name
    networkId string
    Network ID
    region string
    Region name
    tags GetCloudNetworkSubnetTag[]
    List of key-value tags associated with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for better organization and management. Some tags are read-only and cannot be modified by the user. Tags are also integrated with cost reports, allowing cost data to be filtered based on tag keys or values.
    totalIps number
    Total number of ips in subnet
    updatedAt string
    Datetime when the subnet was last updated
    findOneBy GetCloudNetworkSubnetFindOneBy
    projectId number
    Project ID
    regionId number
    Region ID
    subnetId string
    Subnet ID
    available_ips float
    Number of available ips in subnet
    cidr str
    CIDR
    created_at str
    Datetime when the subnet was created
    creator_task_id str
    Task that created this entity
    dns_nameservers Sequence[str]
    List IP addresses of a DNS resolver reachable from the network
    enable_dhcp bool
    True if DHCP should be enabled
    gateway_ip str
    Default GW IPv4 address, advertised in DHCP routes of this subnet. If null, no gateway is advertised by this subnet.
    has_router bool
    Deprecated. Always returns false.

    Deprecated: Deprecated

    host_routes Sequence[GetCloudNetworkSubnetHostRoute]
    List of custom static routes to advertise via DHCP.
    id str
    Subnet ID
    ip_version float
    IP version Available values: 4, 6.
    name str
    Subnet name
    network_id str
    Network ID
    region str
    Region name
    tags Sequence[GetCloudNetworkSubnetTag]
    List of key-value tags associated with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for better organization and management. Some tags are read-only and cannot be modified by the user. Tags are also integrated with cost reports, allowing cost data to be filtered based on tag keys or values.
    total_ips float
    Total number of ips in subnet
    updated_at str
    Datetime when the subnet was last updated
    find_one_by GetCloudNetworkSubnetFindOneBy
    project_id float
    Project ID
    region_id float
    Region ID
    subnet_id str
    Subnet ID
    availableIps Number
    Number of available ips in subnet
    cidr String
    CIDR
    createdAt String
    Datetime when the subnet was created
    creatorTaskId String
    Task that created this entity
    dnsNameservers List<String>
    List IP addresses of a DNS resolver reachable from the network
    enableDhcp Boolean
    True if DHCP should be enabled
    gatewayIp String
    Default GW IPv4 address, advertised in DHCP routes of this subnet. If null, no gateway is advertised by this subnet.
    hasRouter Boolean
    Deprecated. Always returns false.

    Deprecated: Deprecated

    hostRoutes List<Property Map>
    List of custom static routes to advertise via DHCP.
    id String
    Subnet ID
    ipVersion Number
    IP version Available values: 4, 6.
    name String
    Subnet name
    networkId String
    Network ID
    region String
    Region name
    tags List<Property Map>
    List of key-value tags associated with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for better organization and management. Some tags are read-only and cannot be modified by the user. Tags are also integrated with cost reports, allowing cost data to be filtered based on tag keys or values.
    totalIps Number
    Total number of ips in subnet
    updatedAt String
    Datetime when the subnet was last updated
    findOneBy Property Map
    projectId Number
    Project ID
    regionId Number
    Region ID
    subnetId String
    Subnet ID

    Supporting Types

    GetCloudNetworkSubnetFindOneBy

    OrderBy string
    Ordering subnets list result by name, created_at, updated_at, available_ips, total_ips, and cidr (default) fields of the subnet and directions (name.asc). Available values: "availableips.asc", "availableips.desc", "cidr.asc", "cidr.desc", "createdat.asc", "createdat.desc", "name.asc", "name.desc", "totalips.asc", "totalips.desc", "updatedat.asc", "updatedat.desc".
    OwnedBy string
    Controls which subnets are returned. 'project' (default) returns only subnets owned by the project. 'any' returns all subnets from networks available to the project, including subnets from shared networks. Available values: "any", "project".
    NetworkId string
    Only list subnets of this network
    TagKeyValue string
    Optional. Filter by tag key-value pairs.
    TagKeys List<string>
    Optional. Filter by tag keys. ?tag_key=key1&tag_key=key2
    OrderBy string
    Ordering subnets list result by name, created_at, updated_at, available_ips, total_ips, and cidr (default) fields of the subnet and directions (name.asc). Available values: "availableips.asc", "availableips.desc", "cidr.asc", "cidr.desc", "createdat.asc", "createdat.desc", "name.asc", "name.desc", "totalips.asc", "totalips.desc", "updatedat.asc", "updatedat.desc".
    OwnedBy string
    Controls which subnets are returned. 'project' (default) returns only subnets owned by the project. 'any' returns all subnets from networks available to the project, including subnets from shared networks. Available values: "any", "project".
    NetworkId string
    Only list subnets of this network
    TagKeyValue string
    Optional. Filter by tag key-value pairs.
    TagKeys []string
    Optional. Filter by tag keys. ?tag_key=key1&tag_key=key2
    orderBy String
    Ordering subnets list result by name, created_at, updated_at, available_ips, total_ips, and cidr (default) fields of the subnet and directions (name.asc). Available values: "availableips.asc", "availableips.desc", "cidr.asc", "cidr.desc", "createdat.asc", "createdat.desc", "name.asc", "name.desc", "totalips.asc", "totalips.desc", "updatedat.asc", "updatedat.desc".
    ownedBy String
    Controls which subnets are returned. 'project' (default) returns only subnets owned by the project. 'any' returns all subnets from networks available to the project, including subnets from shared networks. Available values: "any", "project".
    networkId String
    Only list subnets of this network
    tagKeyValue String
    Optional. Filter by tag key-value pairs.
    tagKeys List<String>
    Optional. Filter by tag keys. ?tag_key=key1&tag_key=key2
    orderBy string
    Ordering subnets list result by name, created_at, updated_at, available_ips, total_ips, and cidr (default) fields of the subnet and directions (name.asc). Available values: "availableips.asc", "availableips.desc", "cidr.asc", "cidr.desc", "createdat.asc", "createdat.desc", "name.asc", "name.desc", "totalips.asc", "totalips.desc", "updatedat.asc", "updatedat.desc".
    ownedBy string
    Controls which subnets are returned. 'project' (default) returns only subnets owned by the project. 'any' returns all subnets from networks available to the project, including subnets from shared networks. Available values: "any", "project".
    networkId string
    Only list subnets of this network
    tagKeyValue string
    Optional. Filter by tag key-value pairs.
    tagKeys string[]
    Optional. Filter by tag keys. ?tag_key=key1&tag_key=key2
    order_by str
    Ordering subnets list result by name, created_at, updated_at, available_ips, total_ips, and cidr (default) fields of the subnet and directions (name.asc). Available values: "availableips.asc", "availableips.desc", "cidr.asc", "cidr.desc", "createdat.asc", "createdat.desc", "name.asc", "name.desc", "totalips.asc", "totalips.desc", "updatedat.asc", "updatedat.desc".
    owned_by str
    Controls which subnets are returned. 'project' (default) returns only subnets owned by the project. 'any' returns all subnets from networks available to the project, including subnets from shared networks. Available values: "any", "project".
    network_id str
    Only list subnets of this network
    tag_key_value str
    Optional. Filter by tag key-value pairs.
    tag_keys Sequence[str]
    Optional. Filter by tag keys. ?tag_key=key1&tag_key=key2
    orderBy String
    Ordering subnets list result by name, created_at, updated_at, available_ips, total_ips, and cidr (default) fields of the subnet and directions (name.asc). Available values: "availableips.asc", "availableips.desc", "cidr.asc", "cidr.desc", "createdat.asc", "createdat.desc", "name.asc", "name.desc", "totalips.asc", "totalips.desc", "updatedat.asc", "updatedat.desc".
    ownedBy String
    Controls which subnets are returned. 'project' (default) returns only subnets owned by the project. 'any' returns all subnets from networks available to the project, including subnets from shared networks. Available values: "any", "project".
    networkId String
    Only list subnets of this network
    tagKeyValue String
    Optional. Filter by tag key-value pairs.
    tagKeys List<String>
    Optional. Filter by tag keys. ?tag_key=key1&tag_key=key2

    GetCloudNetworkSubnetHostRoute

    Destination string
    CIDR of destination IPv4 subnet.
    Nexthop string
    IPv4 address to forward traffic to if it's destination IP matches 'destination' CIDR.
    Destination string
    CIDR of destination IPv4 subnet.
    Nexthop string
    IPv4 address to forward traffic to if it's destination IP matches 'destination' CIDR.
    destination String
    CIDR of destination IPv4 subnet.
    nexthop String
    IPv4 address to forward traffic to if it's destination IP matches 'destination' CIDR.
    destination string
    CIDR of destination IPv4 subnet.
    nexthop string
    IPv4 address to forward traffic to if it's destination IP matches 'destination' CIDR.
    destination str
    CIDR of destination IPv4 subnet.
    nexthop str
    IPv4 address to forward traffic to if it's destination IP matches 'destination' CIDR.
    destination String
    CIDR of destination IPv4 subnet.
    nexthop String
    IPv4 address to forward traffic to if it's destination IP matches 'destination' CIDR.

    GetCloudNetworkSubnetTag

    Key string
    Tag key. Maximum 255 characters. Cannot contain spaces, tabs, newlines, empty string or '=' character.
    ReadOnly bool
    If true, the tag is read-only and cannot be modified by the user
    Value string
    Tag value. Maximum 255 characters. Cannot contain spaces, tabs, newlines, empty string or '=' character.
    Key string
    Tag key. Maximum 255 characters. Cannot contain spaces, tabs, newlines, empty string or '=' character.
    ReadOnly bool
    If true, the tag is read-only and cannot be modified by the user
    Value string
    Tag value. Maximum 255 characters. Cannot contain spaces, tabs, newlines, empty string or '=' character.
    key String
    Tag key. Maximum 255 characters. Cannot contain spaces, tabs, newlines, empty string or '=' character.
    readOnly Boolean
    If true, the tag is read-only and cannot be modified by the user
    value String
    Tag value. Maximum 255 characters. Cannot contain spaces, tabs, newlines, empty string or '=' character.
    key string
    Tag key. Maximum 255 characters. Cannot contain spaces, tabs, newlines, empty string or '=' character.
    readOnly boolean
    If true, the tag is read-only and cannot be modified by the user
    value string
    Tag value. Maximum 255 characters. Cannot contain spaces, tabs, newlines, empty string or '=' character.
    key str
    Tag key. Maximum 255 characters. Cannot contain spaces, tabs, newlines, empty string or '=' character.
    read_only bool
    If true, the tag is read-only and cannot be modified by the user
    value str
    Tag value. Maximum 255 characters. Cannot contain spaces, tabs, newlines, empty string or '=' character.
    key String
    Tag key. Maximum 255 characters. Cannot contain spaces, tabs, newlines, empty string or '=' character.
    readOnly Boolean
    If true, the tag is read-only and cannot be modified by the user
    value String
    Tag value. Maximum 255 characters. Cannot contain spaces, tabs, newlines, empty string or '=' character.

    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.