gcore.Subnet
Explore with Pulumi AI
Represent subnets. Subnetwork is a range of IP addresses in a cloud network. Addresses from this range will be assigned to machines in the cloud.
Example Usage
Prerequisite
import * as pulumi from "@pulumi/pulumi";
const config = new pulumi.Config();
const dnsNameservers = config.getObject<Array<string>>("dnsNameservers") || [
"8.8.4.4",
"1.1.1.1",
];
const hostRoutes = config.getObject<Array<{destination?: string, nexthop?: string}>>("hostRoutes") || [
{
destination: "10.0.3.0/24",
nexthop: "10.0.0.13",
},
{
destination: "10.0.4.0/24",
nexthop: "10.0.0.14",
},
];
import pulumi
config = pulumi.Config()
dns_nameservers = config.get_object("dnsNameservers")
if dns_nameservers is None:
dns_nameservers = [
"8.8.4.4",
"1.1.1.1",
]
host_routes = config.get_object("hostRoutes")
if host_routes is None:
host_routes = [
{
"destination": "10.0.3.0/24",
"nexthop": "10.0.0.13",
},
{
"destination": "10.0.4.0/24",
"nexthop": "10.0.0.14",
},
]
package main
import (
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
cfg := config.New(ctx, "")
dnsNameservers := []string{
"8.8.4.4",
"1.1.1.1",
}
if param := cfg.GetObject("dnsNameservers"); param != nil {
dnsNameservers = param
}
hostRoutes := []map[string]interface{}{
map[string]interface{}{
"destination": "10.0.3.0/24",
"nexthop": "10.0.0.13",
},
map[string]interface{}{
"destination": "10.0.4.0/24",
"nexthop": "10.0.0.14",
},
}
if param := cfg.GetObject("hostRoutes"); param != nil {
hostRoutes = param
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
return await Deployment.RunAsync(() =>
{
var config = new Config();
var dnsNameservers = config.GetObject<string[]>("dnsNameservers") ?? new[]
{
"8.8.4.4",
"1.1.1.1",
};
var hostRoutes = config.GetObject<HostRoutes[]>("hostRoutes") ?? new[]
{
{
{ "destination", "10.0.3.0/24" },
{ "nexthop", "10.0.0.13" },
},
{
{ "destination", "10.0.4.0/24" },
{ "nexthop", "10.0.0.14" },
},
};
});
public class HostRoutes
{
public string destination { get; set; }
public string nexthop { get; set; }
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
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 config = ctx.config();
final var dnsNameservers = config.get("dnsNameservers").orElse(
"8.8.4.4",
"1.1.1.1");
final var hostRoutes = config.get("hostRoutes").orElse(
%!v(PANIC=Format method: runtime error: invalid memory address or nil pointer dereference),
%!v(PANIC=Format method: runtime error: invalid memory address or nil pointer dereference));
}
}
configuration:
dnsNameservers:
type: list(string)
default:
- 8.8.4.4
- 1.1.1.1
hostRoutes:
type: list(object({destination = union(none, string), nexthop = union(none, string)}))
default:
- destination: 10.0.3.0/24
nexthop: 10.0.0.13
- destination: 10.0.4.0/24
nexthop: 10.0.0.14
import * as pulumi from "@pulumi/pulumi";
import * as gcore from "@pulumi/gcore";
const project = gcore.getProject({
name: "Default",
});
const region = gcore.getRegion({
name: "Luxembourg-2",
});
const network = new gcore.Network("network", {
projectId: project.then(project => project.id),
regionId: region.then(region => region.id),
type: "vxlan",
});
import pulumi
import pulumi_gcore as gcore
project = gcore.get_project(name="Default")
region = gcore.get_region(name="Luxembourg-2")
network = gcore.Network("network",
project_id=project.id,
region_id=region.id,
type="vxlan")
package main
import (
"github.com/pulumi/pulumi-terraform-provider/sdks/go/gcore/gcore"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
project, err := gcore.GetProject(ctx, &gcore.GetProjectArgs{
Name: "Default",
}, nil)
if err != nil {
return err
}
region, err := gcore.GetRegion(ctx, &gcore.GetRegionArgs{
Name: "Luxembourg-2",
}, nil)
if err != nil {
return err
}
_, err = gcore.NewNetwork(ctx, "network", &gcore.NetworkArgs{
ProjectId: pulumi.String(project.Id),
RegionId: pulumi.String(region.Id),
Type: pulumi.String("vxlan"),
})
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 project = Gcore.GetProject.Invoke(new()
{
Name = "Default",
});
var region = Gcore.GetRegion.Invoke(new()
{
Name = "Luxembourg-2",
});
var network = new Gcore.Network("network", new()
{
ProjectId = project.Apply(getProjectResult => getProjectResult.Id),
RegionId = region.Apply(getRegionResult => getRegionResult.Id),
Type = "vxlan",
});
});
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.GetProjectArgs;
import com.pulumi.gcore.inputs.GetRegionArgs;
import com.pulumi.gcore.Network;
import com.pulumi.gcore.NetworkArgs;
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 project = GcoreFunctions.getProject(GetProjectArgs.builder()
.name("Default")
.build());
final var region = GcoreFunctions.getRegion(GetRegionArgs.builder()
.name("Luxembourg-2")
.build());
var network = new Network("network", NetworkArgs.builder()
.projectId(project.applyValue(getProjectResult -> getProjectResult.id()))
.regionId(region.applyValue(getRegionResult -> getRegionResult.id()))
.type("vxlan")
.build());
}
}
resources:
network:
type: gcore:Network
properties:
projectId: ${project.id}
regionId: ${region.id}
type: vxlan
variables:
project:
fn::invoke:
function: gcore:getProject
arguments:
name: Default
region:
fn::invoke:
function: gcore:getRegion
arguments:
name: Luxembourg-2
IPv4
Coming soon!
Coming soon!
Coming soon!
Coming soon!
Coming soon!
resources:
subnetIpv4:
type: gcore:Subnet
properties:
projectId: ${data.gcore_project.project.id}
regionId: ${data.gcore_region.region.id}
cidr: 192.168.10.0/24
networkId: ${gcore_network.network.id}
dnsNameservers: ${var.dns_nameservers}
dynamic:
- iterator: ${hr}
forEach: ${var.host_routes}
content:
- destination: ${hr.value.destination}
nexthop: ${hr.value.nexthop}
gatewayIp: 192.168.10.1
IPv6
import * as pulumi from "@pulumi/pulumi";
import * as gcore from "@pulumi/gcore";
const subnetIpv6 = new gcore.Subnet("subnetIpv6", {
projectId: data.gcore_project.project.id,
regionId: data.gcore_region.region.id,
cidr: "fd00::/8",
networkId: gcore_network.network.id,
});
import pulumi
import pulumi_gcore as gcore
subnet_ipv6 = gcore.Subnet("subnetIpv6",
project_id=data["gcore_project"]["project"]["id"],
region_id=data["gcore_region"]["region"]["id"],
cidr="fd00::/8",
network_id=gcore_network["network"]["id"])
package main
import (
"github.com/pulumi/pulumi-terraform-provider/sdks/go/gcore/gcore"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := gcore.NewSubnet(ctx, "subnetIpv6", &gcore.SubnetArgs{
ProjectId: pulumi.Any(data.Gcore_project.Project.Id),
RegionId: pulumi.Any(data.Gcore_region.Region.Id),
Cidr: pulumi.String("fd00::/8"),
NetworkId: pulumi.Any(gcore_network.Network.Id),
})
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 subnetIpv6 = new Gcore.Subnet("subnetIpv6", new()
{
ProjectId = data.Gcore_project.Project.Id,
RegionId = data.Gcore_region.Region.Id,
Cidr = "fd00::/8",
NetworkId = gcore_network.Network.Id,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcore.Subnet;
import com.pulumi.gcore.SubnetArgs;
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) {
var subnetIpv6 = new Subnet("subnetIpv6", SubnetArgs.builder()
.projectId(data.gcore_project().project().id())
.regionId(data.gcore_region().region().id())
.cidr("fd00::/8")
.networkId(gcore_network.network().id())
.build());
}
}
resources:
subnetIpv6:
type: gcore:Subnet
properties:
projectId: ${data.gcore_project.project.id}
regionId: ${data.gcore_region.region.id}
cidr: fd00::/8
networkId: ${gcore_network.network.id}
Create Subnet Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Subnet(name: string, args: SubnetArgs, opts?: CustomResourceOptions);
@overload
def Subnet(resource_name: str,
args: SubnetArgs,
opts: Optional[ResourceOptions] = None)
@overload
def Subnet(resource_name: str,
opts: Optional[ResourceOptions] = None,
cidr: Optional[str] = None,
network_id: Optional[str] = None,
metadata_map: Optional[Mapping[str, str]] = None,
enable_dhcp: Optional[bool] = None,
gateway_ip: Optional[str] = None,
host_routes: Optional[Sequence[SubnetHostRouteArgs]] = None,
dns_nameservers: Optional[Sequence[str]] = None,
name: Optional[str] = None,
connect_to_network_router: Optional[bool] = None,
project_id: Optional[float] = None,
project_name: Optional[str] = None,
region_id: Optional[float] = None,
region_name: Optional[str] = None,
subnet_id: Optional[str] = None,
timeouts: Optional[SubnetTimeoutsArgs] = None)
func NewSubnet(ctx *Context, name string, args SubnetArgs, opts ...ResourceOption) (*Subnet, error)
public Subnet(string name, SubnetArgs args, CustomResourceOptions? opts = null)
public Subnet(String name, SubnetArgs args)
public Subnet(String name, SubnetArgs args, CustomResourceOptions options)
type: gcore:Subnet
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 SubnetArgs
- 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 SubnetArgs
- 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 SubnetArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args SubnetArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args SubnetArgs
- 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 subnetResource = new Gcore.Subnet("subnetResource", new()
{
Cidr = "string",
NetworkId = "string",
MetadataMap =
{
{ "string", "string" },
},
EnableDhcp = false,
GatewayIp = "string",
HostRoutes = new[]
{
new Gcore.Inputs.SubnetHostRouteArgs
{
Destination = "string",
Nexthop = "string",
},
},
DnsNameservers = new[]
{
"string",
},
Name = "string",
ConnectToNetworkRouter = false,
ProjectId = 0,
ProjectName = "string",
RegionId = 0,
RegionName = "string",
SubnetId = "string",
Timeouts = new Gcore.Inputs.SubnetTimeoutsArgs
{
Create = "string",
Delete = "string",
},
});
example, err := gcore.NewSubnet(ctx, "subnetResource", &gcore.SubnetArgs{
Cidr: pulumi.String("string"),
NetworkId: pulumi.String("string"),
MetadataMap: pulumi.StringMap{
"string": pulumi.String("string"),
},
EnableDhcp: pulumi.Bool(false),
GatewayIp: pulumi.String("string"),
HostRoutes: gcore.SubnetHostRouteArray{
&gcore.SubnetHostRouteArgs{
Destination: pulumi.String("string"),
Nexthop: pulumi.String("string"),
},
},
DnsNameservers: pulumi.StringArray{
pulumi.String("string"),
},
Name: pulumi.String("string"),
ConnectToNetworkRouter: pulumi.Bool(false),
ProjectId: pulumi.Float64(0),
ProjectName: pulumi.String("string"),
RegionId: pulumi.Float64(0),
RegionName: pulumi.String("string"),
SubnetId: pulumi.String("string"),
Timeouts: &gcore.SubnetTimeoutsArgs{
Create: pulumi.String("string"),
Delete: pulumi.String("string"),
},
})
var subnetResource = new Subnet("subnetResource", SubnetArgs.builder()
.cidr("string")
.networkId("string")
.metadataMap(Map.of("string", "string"))
.enableDhcp(false)
.gatewayIp("string")
.hostRoutes(SubnetHostRouteArgs.builder()
.destination("string")
.nexthop("string")
.build())
.dnsNameservers("string")
.name("string")
.connectToNetworkRouter(false)
.projectId(0)
.projectName("string")
.regionId(0)
.regionName("string")
.subnetId("string")
.timeouts(SubnetTimeoutsArgs.builder()
.create("string")
.delete("string")
.build())
.build());
subnet_resource = gcore.Subnet("subnetResource",
cidr="string",
network_id="string",
metadata_map={
"string": "string",
},
enable_dhcp=False,
gateway_ip="string",
host_routes=[{
"destination": "string",
"nexthop": "string",
}],
dns_nameservers=["string"],
name="string",
connect_to_network_router=False,
project_id=0,
project_name="string",
region_id=0,
region_name="string",
subnet_id="string",
timeouts={
"create": "string",
"delete": "string",
})
const subnetResource = new gcore.Subnet("subnetResource", {
cidr: "string",
networkId: "string",
metadataMap: {
string: "string",
},
enableDhcp: false,
gatewayIp: "string",
hostRoutes: [{
destination: "string",
nexthop: "string",
}],
dnsNameservers: ["string"],
name: "string",
connectToNetworkRouter: false,
projectId: 0,
projectName: "string",
regionId: 0,
regionName: "string",
subnetId: "string",
timeouts: {
create: "string",
"delete": "string",
},
});
type: gcore:Subnet
properties:
cidr: string
connectToNetworkRouter: false
dnsNameservers:
- string
enableDhcp: false
gatewayIp: string
hostRoutes:
- destination: string
nexthop: string
metadataMap:
string: string
name: string
networkId: string
projectId: 0
projectName: string
regionId: 0
regionName: string
subnetId: string
timeouts:
create: string
delete: string
Subnet 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 Subnet resource accepts the following input properties:
- Cidr string
- Classless Inter-Domain Routing, can be IPv4 or IPv6.
- Network
Id string - ID of the desired network to create subnet in.
- Connect
To boolNetwork Router - True if the network's router should get a gateway in this subnet. Must be explicitly 'false' when gateway_ip is null. Default true.
- Dns
Nameservers List<string> - List of strings contains DNS addresses, e.g. 95.85.95.85.
- Enable
Dhcp bool - Enable DHCP for this subnet.
- Gateway
Ip string - Desired IP address of the subnet's gateway. Use
disable
value to disable gateway ip. - Host
Routes List<SubnetHost Route> - Metadata
Map Dictionary<string, string> - Metadata map to apply to the subnet.
- Name string
- Name of the subnet.
- Project
Id double - ID of the desired project to create subnet in. Alternative for
project_name
. One of them should be specified. - Project
Name string - Name of the desired project to create subnet in. Alternative for
project_id
. One of them should be specified. - Region
Id double - ID of the desired region to create subnet in. Alternative for
region_name
. One of them should be specified. - Region
Name string - Name of the desired region to create subnet in. Alternative for
region_id
. One of them should be specified. - Subnet
Id string - The ID of this resource.
- Timeouts
Subnet
Timeouts
- Cidr string
- Classless Inter-Domain Routing, can be IPv4 or IPv6.
- Network
Id string - ID of the desired network to create subnet in.
- Connect
To boolNetwork Router - True if the network's router should get a gateway in this subnet. Must be explicitly 'false' when gateway_ip is null. Default true.
- Dns
Nameservers []string - List of strings contains DNS addresses, e.g. 95.85.95.85.
- Enable
Dhcp bool - Enable DHCP for this subnet.
- Gateway
Ip string - Desired IP address of the subnet's gateway. Use
disable
value to disable gateway ip. - Host
Routes []SubnetHost Route Args - Metadata
Map map[string]string - Metadata map to apply to the subnet.
- Name string
- Name of the subnet.
- Project
Id float64 - ID of the desired project to create subnet in. Alternative for
project_name
. One of them should be specified. - Project
Name string - Name of the desired project to create subnet in. Alternative for
project_id
. One of them should be specified. - Region
Id float64 - ID of the desired region to create subnet in. Alternative for
region_name
. One of them should be specified. - Region
Name string - Name of the desired region to create subnet in. Alternative for
region_id
. One of them should be specified. - Subnet
Id string - The ID of this resource.
- Timeouts
Subnet
Timeouts Args
- cidr String
- Classless Inter-Domain Routing, can be IPv4 or IPv6.
- network
Id String - ID of the desired network to create subnet in.
- connect
To BooleanNetwork Router - True if the network's router should get a gateway in this subnet. Must be explicitly 'false' when gateway_ip is null. Default true.
- dns
Nameservers List<String> - List of strings contains DNS addresses, e.g. 95.85.95.85.
- enable
Dhcp Boolean - Enable DHCP for this subnet.
- gateway
Ip String - Desired IP address of the subnet's gateway. Use
disable
value to disable gateway ip. - host
Routes List<SubnetHost Route> - metadata
Map Map<String,String> - Metadata map to apply to the subnet.
- name String
- Name of the subnet.
- project
Id Double - ID of the desired project to create subnet in. Alternative for
project_name
. One of them should be specified. - project
Name String - Name of the desired project to create subnet in. Alternative for
project_id
. One of them should be specified. - region
Id Double - ID of the desired region to create subnet in. Alternative for
region_name
. One of them should be specified. - region
Name String - Name of the desired region to create subnet in. Alternative for
region_id
. One of them should be specified. - subnet
Id String - The ID of this resource.
- timeouts
Subnet
Timeouts
- cidr string
- Classless Inter-Domain Routing, can be IPv4 or IPv6.
- network
Id string - ID of the desired network to create subnet in.
- connect
To booleanNetwork Router - True if the network's router should get a gateway in this subnet. Must be explicitly 'false' when gateway_ip is null. Default true.
- dns
Nameservers string[] - List of strings contains DNS addresses, e.g. 95.85.95.85.
- enable
Dhcp boolean - Enable DHCP for this subnet.
- gateway
Ip string - Desired IP address of the subnet's gateway. Use
disable
value to disable gateway ip. - host
Routes SubnetHost Route[] - metadata
Map {[key: string]: string} - Metadata map to apply to the subnet.
- name string
- Name of the subnet.
- project
Id number - ID of the desired project to create subnet in. Alternative for
project_name
. One of them should be specified. - project
Name string - Name of the desired project to create subnet in. Alternative for
project_id
. One of them should be specified. - region
Id number - ID of the desired region to create subnet in. Alternative for
region_name
. One of them should be specified. - region
Name string - Name of the desired region to create subnet in. Alternative for
region_id
. One of them should be specified. - subnet
Id string - The ID of this resource.
- timeouts
Subnet
Timeouts
- cidr str
- Classless Inter-Domain Routing, can be IPv4 or IPv6.
- network_
id str - ID of the desired network to create subnet in.
- connect_
to_ boolnetwork_ router - True if the network's router should get a gateway in this subnet. Must be explicitly 'false' when gateway_ip is null. Default true.
- dns_
nameservers Sequence[str] - List of strings contains DNS addresses, e.g. 95.85.95.85.
- enable_
dhcp bool - Enable DHCP for this subnet.
- gateway_
ip str - Desired IP address of the subnet's gateway. Use
disable
value to disable gateway ip. - host_
routes Sequence[SubnetHost Route Args] - metadata_
map Mapping[str, str] - Metadata map to apply to the subnet.
- name str
- Name of the subnet.
- project_
id float - ID of the desired project to create subnet in. Alternative for
project_name
. One of them should be specified. - project_
name str - Name of the desired project to create subnet in. Alternative for
project_id
. One of them should be specified. - region_
id float - ID of the desired region to create subnet in. Alternative for
region_name
. One of them should be specified. - region_
name str - Name of the desired region to create subnet in. Alternative for
region_id
. One of them should be specified. - subnet_
id str - The ID of this resource.
- timeouts
Subnet
Timeouts Args
- cidr String
- Classless Inter-Domain Routing, can be IPv4 or IPv6.
- network
Id String - ID of the desired network to create subnet in.
- connect
To BooleanNetwork Router - True if the network's router should get a gateway in this subnet. Must be explicitly 'false' when gateway_ip is null. Default true.
- dns
Nameservers List<String> - List of strings contains DNS addresses, e.g. 95.85.95.85.
- enable
Dhcp Boolean - Enable DHCP for this subnet.
- gateway
Ip String - Desired IP address of the subnet's gateway. Use
disable
value to disable gateway ip. - host
Routes List<Property Map> - metadata
Map Map<String> - Metadata map to apply to the subnet.
- name String
- Name of the subnet.
- project
Id Number - ID of the desired project to create subnet in. Alternative for
project_name
. One of them should be specified. - project
Name String - Name of the desired project to create subnet in. Alternative for
project_id
. One of them should be specified. - region
Id Number - ID of the desired region to create subnet in. Alternative for
region_name
. One of them should be specified. - region
Name String - Name of the desired region to create subnet in. Alternative for
region_id
. One of them should be specified. - subnet
Id String - The ID of this resource.
- timeouts Property Map
Outputs
All input properties are implicitly available as output properties. Additionally, the Subnet resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Last
Updated string - Datetime when subnet was updated at the last time.
- Metadata
Read List<SubnetOnlies Metadata Read Only> - List of metadata items.
- Id string
- The provider-assigned unique ID for this managed resource.
- Last
Updated string - Datetime when subnet was updated at the last time.
- Metadata
Read []SubnetOnlies Metadata Read Only - List of metadata items.
- id String
- The provider-assigned unique ID for this managed resource.
- last
Updated String - Datetime when subnet was updated at the last time.
- metadata
Read List<SubnetOnlies Metadata Read Only> - List of metadata items.
- id string
- The provider-assigned unique ID for this managed resource.
- last
Updated string - Datetime when subnet was updated at the last time.
- metadata
Read SubnetOnlies Metadata Read Only[] - List of metadata items.
- id str
- The provider-assigned unique ID for this managed resource.
- last_
updated str - Datetime when subnet was updated at the last time.
- metadata_
read_ Sequence[Subnetonlies Metadata Read Only] - List of metadata items.
- id String
- The provider-assigned unique ID for this managed resource.
- last
Updated String - Datetime when subnet was updated at the last time.
- metadata
Read List<Property Map>Onlies - List of metadata items.
Look up Existing Subnet Resource
Get an existing Subnet 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?: SubnetState, opts?: CustomResourceOptions): Subnet
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
cidr: Optional[str] = None,
connect_to_network_router: Optional[bool] = None,
dns_nameservers: Optional[Sequence[str]] = None,
enable_dhcp: Optional[bool] = None,
gateway_ip: Optional[str] = None,
host_routes: Optional[Sequence[SubnetHostRouteArgs]] = None,
last_updated: Optional[str] = None,
metadata_map: Optional[Mapping[str, str]] = None,
metadata_read_onlies: Optional[Sequence[SubnetMetadataReadOnlyArgs]] = None,
name: Optional[str] = None,
network_id: Optional[str] = None,
project_id: Optional[float] = None,
project_name: Optional[str] = None,
region_id: Optional[float] = None,
region_name: Optional[str] = None,
subnet_id: Optional[str] = None,
timeouts: Optional[SubnetTimeoutsArgs] = None) -> Subnet
func GetSubnet(ctx *Context, name string, id IDInput, state *SubnetState, opts ...ResourceOption) (*Subnet, error)
public static Subnet Get(string name, Input<string> id, SubnetState? state, CustomResourceOptions? opts = null)
public static Subnet get(String name, Output<String> id, SubnetState state, CustomResourceOptions options)
resources: _: type: gcore:Subnet 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.
- Cidr string
- Classless Inter-Domain Routing, can be IPv4 or IPv6.
- Connect
To boolNetwork Router - True if the network's router should get a gateway in this subnet. Must be explicitly 'false' when gateway_ip is null. Default true.
- Dns
Nameservers List<string> - List of strings contains DNS addresses, e.g. 95.85.95.85.
- Enable
Dhcp bool - Enable DHCP for this subnet.
- Gateway
Ip string - Desired IP address of the subnet's gateway. Use
disable
value to disable gateway ip. - Host
Routes List<SubnetHost Route> - Last
Updated string - Datetime when subnet was updated at the last time.
- Metadata
Map Dictionary<string, string> - Metadata map to apply to the subnet.
- Metadata
Read List<SubnetOnlies Metadata Read Only> - List of metadata items.
- Name string
- Name of the subnet.
- Network
Id string - ID of the desired network to create subnet in.
- Project
Id double - ID of the desired project to create subnet in. Alternative for
project_name
. One of them should be specified. - Project
Name string - Name of the desired project to create subnet in. Alternative for
project_id
. One of them should be specified. - Region
Id double - ID of the desired region to create subnet in. Alternative for
region_name
. One of them should be specified. - Region
Name string - Name of the desired region to create subnet in. Alternative for
region_id
. One of them should be specified. - Subnet
Id string - The ID of this resource.
- Timeouts
Subnet
Timeouts
- Cidr string
- Classless Inter-Domain Routing, can be IPv4 or IPv6.
- Connect
To boolNetwork Router - True if the network's router should get a gateway in this subnet. Must be explicitly 'false' when gateway_ip is null. Default true.
- Dns
Nameservers []string - List of strings contains DNS addresses, e.g. 95.85.95.85.
- Enable
Dhcp bool - Enable DHCP for this subnet.
- Gateway
Ip string - Desired IP address of the subnet's gateway. Use
disable
value to disable gateway ip. - Host
Routes []SubnetHost Route Args - Last
Updated string - Datetime when subnet was updated at the last time.
- Metadata
Map map[string]string - Metadata map to apply to the subnet.
- Metadata
Read []SubnetOnlies Metadata Read Only Args - List of metadata items.
- Name string
- Name of the subnet.
- Network
Id string - ID of the desired network to create subnet in.
- Project
Id float64 - ID of the desired project to create subnet in. Alternative for
project_name
. One of them should be specified. - Project
Name string - Name of the desired project to create subnet in. Alternative for
project_id
. One of them should be specified. - Region
Id float64 - ID of the desired region to create subnet in. Alternative for
region_name
. One of them should be specified. - Region
Name string - Name of the desired region to create subnet in. Alternative for
region_id
. One of them should be specified. - Subnet
Id string - The ID of this resource.
- Timeouts
Subnet
Timeouts Args
- cidr String
- Classless Inter-Domain Routing, can be IPv4 or IPv6.
- connect
To BooleanNetwork Router - True if the network's router should get a gateway in this subnet. Must be explicitly 'false' when gateway_ip is null. Default true.
- dns
Nameservers List<String> - List of strings contains DNS addresses, e.g. 95.85.95.85.
- enable
Dhcp Boolean - Enable DHCP for this subnet.
- gateway
Ip String - Desired IP address of the subnet's gateway. Use
disable
value to disable gateway ip. - host
Routes List<SubnetHost Route> - last
Updated String - Datetime when subnet was updated at the last time.
- metadata
Map Map<String,String> - Metadata map to apply to the subnet.
- metadata
Read List<SubnetOnlies Metadata Read Only> - List of metadata items.
- name String
- Name of the subnet.
- network
Id String - ID of the desired network to create subnet in.
- project
Id Double - ID of the desired project to create subnet in. Alternative for
project_name
. One of them should be specified. - project
Name String - Name of the desired project to create subnet in. Alternative for
project_id
. One of them should be specified. - region
Id Double - ID of the desired region to create subnet in. Alternative for
region_name
. One of them should be specified. - region
Name String - Name of the desired region to create subnet in. Alternative for
region_id
. One of them should be specified. - subnet
Id String - The ID of this resource.
- timeouts
Subnet
Timeouts
- cidr string
- Classless Inter-Domain Routing, can be IPv4 or IPv6.
- connect
To booleanNetwork Router - True if the network's router should get a gateway in this subnet. Must be explicitly 'false' when gateway_ip is null. Default true.
- dns
Nameservers string[] - List of strings contains DNS addresses, e.g. 95.85.95.85.
- enable
Dhcp boolean - Enable DHCP for this subnet.
- gateway
Ip string - Desired IP address of the subnet's gateway. Use
disable
value to disable gateway ip. - host
Routes SubnetHost Route[] - last
Updated string - Datetime when subnet was updated at the last time.
- metadata
Map {[key: string]: string} - Metadata map to apply to the subnet.
- metadata
Read SubnetOnlies Metadata Read Only[] - List of metadata items.
- name string
- Name of the subnet.
- network
Id string - ID of the desired network to create subnet in.
- project
Id number - ID of the desired project to create subnet in. Alternative for
project_name
. One of them should be specified. - project
Name string - Name of the desired project to create subnet in. Alternative for
project_id
. One of them should be specified. - region
Id number - ID of the desired region to create subnet in. Alternative for
region_name
. One of them should be specified. - region
Name string - Name of the desired region to create subnet in. Alternative for
region_id
. One of them should be specified. - subnet
Id string - The ID of this resource.
- timeouts
Subnet
Timeouts
- cidr str
- Classless Inter-Domain Routing, can be IPv4 or IPv6.
- connect_
to_ boolnetwork_ router - True if the network's router should get a gateway in this subnet. Must be explicitly 'false' when gateway_ip is null. Default true.
- dns_
nameservers Sequence[str] - List of strings contains DNS addresses, e.g. 95.85.95.85.
- enable_
dhcp bool - Enable DHCP for this subnet.
- gateway_
ip str - Desired IP address of the subnet's gateway. Use
disable
value to disable gateway ip. - host_
routes Sequence[SubnetHost Route Args] - last_
updated str - Datetime when subnet was updated at the last time.
- metadata_
map Mapping[str, str] - Metadata map to apply to the subnet.
- metadata_
read_ Sequence[Subnetonlies Metadata Read Only Args] - List of metadata items.
- name str
- Name of the subnet.
- network_
id str - ID of the desired network to create subnet in.
- project_
id float - ID of the desired project to create subnet in. Alternative for
project_name
. One of them should be specified. - project_
name str - Name of the desired project to create subnet in. Alternative for
project_id
. One of them should be specified. - region_
id float - ID of the desired region to create subnet in. Alternative for
region_name
. One of them should be specified. - region_
name str - Name of the desired region to create subnet in. Alternative for
region_id
. One of them should be specified. - subnet_
id str - The ID of this resource.
- timeouts
Subnet
Timeouts Args
- cidr String
- Classless Inter-Domain Routing, can be IPv4 or IPv6.
- connect
To BooleanNetwork Router - True if the network's router should get a gateway in this subnet. Must be explicitly 'false' when gateway_ip is null. Default true.
- dns
Nameservers List<String> - List of strings contains DNS addresses, e.g. 95.85.95.85.
- enable
Dhcp Boolean - Enable DHCP for this subnet.
- gateway
Ip String - Desired IP address of the subnet's gateway. Use
disable
value to disable gateway ip. - host
Routes List<Property Map> - last
Updated String - Datetime when subnet was updated at the last time.
- metadata
Map Map<String> - Metadata map to apply to the subnet.
- metadata
Read List<Property Map>Onlies - List of metadata items.
- name String
- Name of the subnet.
- network
Id String - ID of the desired network to create subnet in.
- project
Id Number - ID of the desired project to create subnet in. Alternative for
project_name
. One of them should be specified. - project
Name String - Name of the desired project to create subnet in. Alternative for
project_id
. One of them should be specified. - region
Id Number - ID of the desired region to create subnet in. Alternative for
region_name
. One of them should be specified. - region
Name String - Name of the desired region to create subnet in. Alternative for
region_id
. One of them should be specified. - subnet
Id String - The ID of this resource.
- timeouts Property Map
Supporting Types
SubnetHostRoute, SubnetHostRouteArgs
- Destination string
- Classless Inter-Domain Routing, can be IPv4 or IPv6.
- Nexthop string
- IPv4 address to forward traffic to if it's destination IP matches 'destination' CIDR
- Destination string
- Classless Inter-Domain Routing, can be IPv4 or IPv6.
- Nexthop string
- IPv4 address to forward traffic to if it's destination IP matches 'destination' CIDR
- destination String
- Classless Inter-Domain Routing, can be IPv4 or IPv6.
- nexthop String
- IPv4 address to forward traffic to if it's destination IP matches 'destination' CIDR
- destination string
- Classless Inter-Domain Routing, can be IPv4 or IPv6.
- nexthop string
- IPv4 address to forward traffic to if it's destination IP matches 'destination' CIDR
- destination str
- Classless Inter-Domain Routing, can be IPv4 or IPv6.
- nexthop str
- IPv4 address to forward traffic to if it's destination IP matches 'destination' CIDR
- destination String
- Classless Inter-Domain Routing, can be IPv4 or IPv6.
- nexthop String
- IPv4 address to forward traffic to if it's destination IP matches 'destination' CIDR
SubnetMetadataReadOnly, SubnetMetadataReadOnlyArgs
SubnetTimeouts, SubnetTimeoutsArgs
Import
import using <project_id>:<region_id>:<subnet_id> format
$ pulumi import gcore:index/subnet:Subnet subnet1 1:6:447d2959-8ae0-4ca0-8d47-9f050a3637d7
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.