hcloud.NetworkSubnet
Explore with Pulumi AI
Provides a Hetzner Cloud Network Subnet to represent a Subnet in the Hetzner Cloud.
Example Usage
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using HCloud = Pulumi.HCloud;
return await Deployment.RunAsync(() =>
{
var mynet = new HCloud.Network("mynet", new()
{
IpRange = "10.0.0.0/8",
});
var foonet = new HCloud.NetworkSubnet("foonet", new()
{
NetworkId = mynet.Id,
Type = "cloud",
NetworkZone = "eu-central",
IpRange = "10.0.1.0/24",
});
});
package main
import (
"github.com/pulumi/pulumi-hcloud/sdk/go/hcloud"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
mynet, err := hcloud.NewNetwork(ctx, "mynet", &hcloud.NetworkArgs{
IpRange: pulumi.String("10.0.0.0/8"),
})
if err != nil {
return err
}
_, err = hcloud.NewNetworkSubnet(ctx, "foonet", &hcloud.NetworkSubnetArgs{
NetworkId: mynet.ID(),
Type: pulumi.String("cloud"),
NetworkZone: pulumi.String("eu-central"),
IpRange: pulumi.String("10.0.1.0/24"),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.hcloud.Network;
import com.pulumi.hcloud.NetworkArgs;
import com.pulumi.hcloud.NetworkSubnet;
import com.pulumi.hcloud.NetworkSubnetArgs;
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 mynet = new Network("mynet", NetworkArgs.builder()
.ipRange("10.0.0.0/8")
.build());
var foonet = new NetworkSubnet("foonet", NetworkSubnetArgs.builder()
.networkId(mynet.id())
.type("cloud")
.networkZone("eu-central")
.ipRange("10.0.1.0/24")
.build());
}
}
import pulumi
import pulumi_hcloud as hcloud
mynet = hcloud.Network("mynet", ip_range="10.0.0.0/8")
foonet = hcloud.NetworkSubnet("foonet",
network_id=mynet.id,
type="cloud",
network_zone="eu-central",
ip_range="10.0.1.0/24")
import * as pulumi from "@pulumi/pulumi";
import * as hcloud from "@pulumi/hcloud";
const mynet = new hcloud.Network("mynet", {ipRange: "10.0.0.0/8"});
const foonet = new hcloud.NetworkSubnet("foonet", {
networkId: mynet.id,
type: "cloud",
networkZone: "eu-central",
ipRange: "10.0.1.0/24",
});
resources:
mynet:
type: hcloud:Network
properties:
ipRange: 10.0.0.0/8
foonet:
type: hcloud:NetworkSubnet
properties:
networkId: ${mynet.id}
type: cloud
networkZone: eu-central
ipRange: 10.0.1.0/24
Create NetworkSubnet Resource
new NetworkSubnet(name: string, args: NetworkSubnetArgs, opts?: CustomResourceOptions);
@overload
def NetworkSubnet(resource_name: str,
opts: Optional[ResourceOptions] = None,
ip_range: Optional[str] = None,
network_id: Optional[int] = None,
network_zone: Optional[str] = None,
type: Optional[str] = None,
vswitch_id: Optional[int] = None)
@overload
def NetworkSubnet(resource_name: str,
args: NetworkSubnetArgs,
opts: Optional[ResourceOptions] = None)
func NewNetworkSubnet(ctx *Context, name string, args NetworkSubnetArgs, opts ...ResourceOption) (*NetworkSubnet, error)
public NetworkSubnet(string name, NetworkSubnetArgs args, CustomResourceOptions? opts = null)
public NetworkSubnet(String name, NetworkSubnetArgs args)
public NetworkSubnet(String name, NetworkSubnetArgs args, CustomResourceOptions options)
type: hcloud:NetworkSubnet
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args NetworkSubnetArgs
- 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 NetworkSubnetArgs
- 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 NetworkSubnetArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args NetworkSubnetArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args NetworkSubnetArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
NetworkSubnet Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
The NetworkSubnet resource accepts the following input properties:
- Ip
Range string Range to allocate IPs from. Must be a subnet of the ip_range of the Network and must not overlap with any other subnets or with any destinations in routes.
- Network
Id int ID of the Network the subnet should be added to.
- Network
Zone string Name of network zone.
- Type string
Type of subnet.
server
,cloud
orvswitch
- Vswitch
Id int ID of the vswitch, Required if type is
vswitch
- Ip
Range string Range to allocate IPs from. Must be a subnet of the ip_range of the Network and must not overlap with any other subnets or with any destinations in routes.
- Network
Id int ID of the Network the subnet should be added to.
- Network
Zone string Name of network zone.
- Type string
Type of subnet.
server
,cloud
orvswitch
- Vswitch
Id int ID of the vswitch, Required if type is
vswitch
- ip
Range String Range to allocate IPs from. Must be a subnet of the ip_range of the Network and must not overlap with any other subnets or with any destinations in routes.
- network
Id Integer ID of the Network the subnet should be added to.
- network
Zone String Name of network zone.
- type String
Type of subnet.
server
,cloud
orvswitch
- vswitch
Id Integer ID of the vswitch, Required if type is
vswitch
- ip
Range string Range to allocate IPs from. Must be a subnet of the ip_range of the Network and must not overlap with any other subnets or with any destinations in routes.
- network
Id number ID of the Network the subnet should be added to.
- network
Zone string Name of network zone.
- type string
Type of subnet.
server
,cloud
orvswitch
- vswitch
Id number ID of the vswitch, Required if type is
vswitch
- ip_
range str Range to allocate IPs from. Must be a subnet of the ip_range of the Network and must not overlap with any other subnets or with any destinations in routes.
- network_
id int ID of the Network the subnet should be added to.
- network_
zone str Name of network zone.
- type str
Type of subnet.
server
,cloud
orvswitch
- vswitch_
id int ID of the vswitch, Required if type is
vswitch
- ip
Range String Range to allocate IPs from. Must be a subnet of the ip_range of the Network and must not overlap with any other subnets or with any destinations in routes.
- network
Id Number ID of the Network the subnet should be added to.
- network
Zone String Name of network zone.
- type String
Type of subnet.
server
,cloud
orvswitch
- vswitch
Id Number ID of the vswitch, Required if type is
vswitch
Outputs
All input properties are implicitly available as output properties. Additionally, the NetworkSubnet resource produces the following output properties:
Look up Existing NetworkSubnet Resource
Get an existing NetworkSubnet 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?: NetworkSubnetState, opts?: CustomResourceOptions): NetworkSubnet
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
gateway: Optional[str] = None,
ip_range: Optional[str] = None,
network_id: Optional[int] = None,
network_zone: Optional[str] = None,
type: Optional[str] = None,
vswitch_id: Optional[int] = None) -> NetworkSubnet
func GetNetworkSubnet(ctx *Context, name string, id IDInput, state *NetworkSubnetState, opts ...ResourceOption) (*NetworkSubnet, error)
public static NetworkSubnet Get(string name, Input<string> id, NetworkSubnetState? state, CustomResourceOptions? opts = null)
public static NetworkSubnet get(String name, Output<String> id, NetworkSubnetState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- 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.
- Gateway string
- Ip
Range string Range to allocate IPs from. Must be a subnet of the ip_range of the Network and must not overlap with any other subnets or with any destinations in routes.
- Network
Id int ID of the Network the subnet should be added to.
- Network
Zone string Name of network zone.
- Type string
Type of subnet.
server
,cloud
orvswitch
- Vswitch
Id int ID of the vswitch, Required if type is
vswitch
- Gateway string
- Ip
Range string Range to allocate IPs from. Must be a subnet of the ip_range of the Network and must not overlap with any other subnets or with any destinations in routes.
- Network
Id int ID of the Network the subnet should be added to.
- Network
Zone string Name of network zone.
- Type string
Type of subnet.
server
,cloud
orvswitch
- Vswitch
Id int ID of the vswitch, Required if type is
vswitch
- gateway String
- ip
Range String Range to allocate IPs from. Must be a subnet of the ip_range of the Network and must not overlap with any other subnets or with any destinations in routes.
- network
Id Integer ID of the Network the subnet should be added to.
- network
Zone String Name of network zone.
- type String
Type of subnet.
server
,cloud
orvswitch
- vswitch
Id Integer ID of the vswitch, Required if type is
vswitch
- gateway string
- ip
Range string Range to allocate IPs from. Must be a subnet of the ip_range of the Network and must not overlap with any other subnets or with any destinations in routes.
- network
Id number ID of the Network the subnet should be added to.
- network
Zone string Name of network zone.
- type string
Type of subnet.
server
,cloud
orvswitch
- vswitch
Id number ID of the vswitch, Required if type is
vswitch
- gateway str
- ip_
range str Range to allocate IPs from. Must be a subnet of the ip_range of the Network and must not overlap with any other subnets or with any destinations in routes.
- network_
id int ID of the Network the subnet should be added to.
- network_
zone str Name of network zone.
- type str
Type of subnet.
server
,cloud
orvswitch
- vswitch_
id int ID of the vswitch, Required if type is
vswitch
- gateway String
- ip
Range String Range to allocate IPs from. Must be a subnet of the ip_range of the Network and must not overlap with any other subnets or with any destinations in routes.
- network
Id Number ID of the Network the subnet should be added to.
- network
Zone String Name of network zone.
- type String
Type of subnet.
server
,cloud
orvswitch
- vswitch
Id Number ID of the vswitch, Required if type is
vswitch
Import
Network Subnet entries can be imported using a compound ID with the following format<network-id>-<ip_range>
$ pulumi import hcloud:index/networkSubnet:NetworkSubnet mysubnet 123-10.0.0.0/24
Package Details
- Repository
- Hetzner Cloud pulumi/pulumi-hcloud
- License
- Apache-2.0
- Notes
This Pulumi package is based on the
hcloud
Terraform Provider.