hcloud.NetworkRoute
Explore with Pulumi AI
Provides a Hetzner Cloud Network Route to represent a Network route 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 privNet = new HCloud.NetworkRoute("privNet", new()
{
NetworkId = mynet.Id,
Destination = "10.100.1.0/24",
Gateway = "10.0.1.1",
});
});
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.NewNetworkRoute(ctx, "privNet", &hcloud.NetworkRouteArgs{
NetworkId: mynet.ID(),
Destination: pulumi.String("10.100.1.0/24"),
Gateway: pulumi.String("10.0.1.1"),
})
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.NetworkRoute;
import com.pulumi.hcloud.NetworkRouteArgs;
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 privNet = new NetworkRoute("privNet", NetworkRouteArgs.builder()
.networkId(mynet.id())
.destination("10.100.1.0/24")
.gateway("10.0.1.1")
.build());
}
}
import pulumi
import pulumi_hcloud as hcloud
mynet = hcloud.Network("mynet", ip_range="10.0.0.0/8")
priv_net = hcloud.NetworkRoute("privNet",
network_id=mynet.id,
destination="10.100.1.0/24",
gateway="10.0.1.1")
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 privNet = new hcloud.NetworkRoute("privNet", {
networkId: mynet.id,
destination: "10.100.1.0/24",
gateway: "10.0.1.1",
});
resources:
mynet:
type: hcloud:Network
properties:
ipRange: 10.0.0.0/8
privNet:
type: hcloud:NetworkRoute
properties:
networkId: ${mynet.id}
destination: 10.100.1.0/24
gateway: 10.0.1.1
Create NetworkRoute Resource
new NetworkRoute(name: string, args: NetworkRouteArgs, opts?: CustomResourceOptions);
@overload
def NetworkRoute(resource_name: str,
opts: Optional[ResourceOptions] = None,
destination: Optional[str] = None,
gateway: Optional[str] = None,
network_id: Optional[int] = None)
@overload
def NetworkRoute(resource_name: str,
args: NetworkRouteArgs,
opts: Optional[ResourceOptions] = None)
func NewNetworkRoute(ctx *Context, name string, args NetworkRouteArgs, opts ...ResourceOption) (*NetworkRoute, error)
public NetworkRoute(string name, NetworkRouteArgs args, CustomResourceOptions? opts = null)
public NetworkRoute(String name, NetworkRouteArgs args)
public NetworkRoute(String name, NetworkRouteArgs args, CustomResourceOptions options)
type: hcloud:NetworkRoute
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args NetworkRouteArgs
- 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 NetworkRouteArgs
- 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 NetworkRouteArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args NetworkRouteArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args NetworkRouteArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
NetworkRoute 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 NetworkRoute resource accepts the following input properties:
- Destination string
Destination network or host of this route. Must be a subnet of the ip_range of the Network. Must not overlap with an existing ip_range in any subnets or with any destinations in other routes or with the first ip of the networks ip_range or with 172.31.1.1.
- Gateway string
Gateway for the route. Cannot be the first ip of the networks ip_range and also cannot be 172.31.1.1 as this IP is being used as a gateway for the public network interface of servers.
- Network
Id int ID of the Network the route should be added to.
- Destination string
Destination network or host of this route. Must be a subnet of the ip_range of the Network. Must not overlap with an existing ip_range in any subnets or with any destinations in other routes or with the first ip of the networks ip_range or with 172.31.1.1.
- Gateway string
Gateway for the route. Cannot be the first ip of the networks ip_range and also cannot be 172.31.1.1 as this IP is being used as a gateway for the public network interface of servers.
- Network
Id int ID of the Network the route should be added to.
- destination String
Destination network or host of this route. Must be a subnet of the ip_range of the Network. Must not overlap with an existing ip_range in any subnets or with any destinations in other routes or with the first ip of the networks ip_range or with 172.31.1.1.
- gateway String
Gateway for the route. Cannot be the first ip of the networks ip_range and also cannot be 172.31.1.1 as this IP is being used as a gateway for the public network interface of servers.
- network
Id Integer ID of the Network the route should be added to.
- destination string
Destination network or host of this route. Must be a subnet of the ip_range of the Network. Must not overlap with an existing ip_range in any subnets or with any destinations in other routes or with the first ip of the networks ip_range or with 172.31.1.1.
- gateway string
Gateway for the route. Cannot be the first ip of the networks ip_range and also cannot be 172.31.1.1 as this IP is being used as a gateway for the public network interface of servers.
- network
Id number ID of the Network the route should be added to.
- destination str
Destination network or host of this route. Must be a subnet of the ip_range of the Network. Must not overlap with an existing ip_range in any subnets or with any destinations in other routes or with the first ip of the networks ip_range or with 172.31.1.1.
- gateway str
Gateway for the route. Cannot be the first ip of the networks ip_range and also cannot be 172.31.1.1 as this IP is being used as a gateway for the public network interface of servers.
- network_
id int ID of the Network the route should be added to.
- destination String
Destination network or host of this route. Must be a subnet of the ip_range of the Network. Must not overlap with an existing ip_range in any subnets or with any destinations in other routes or with the first ip of the networks ip_range or with 172.31.1.1.
- gateway String
Gateway for the route. Cannot be the first ip of the networks ip_range and also cannot be 172.31.1.1 as this IP is being used as a gateway for the public network interface of servers.
- network
Id Number ID of the Network the route should be added to.
Outputs
All input properties are implicitly available as output properties. Additionally, the NetworkRoute 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 str
The provider-assigned unique ID for this managed resource.
- id String
The provider-assigned unique ID for this managed resource.
Look up Existing NetworkRoute Resource
Get an existing NetworkRoute 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?: NetworkRouteState, opts?: CustomResourceOptions): NetworkRoute
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
destination: Optional[str] = None,
gateway: Optional[str] = None,
network_id: Optional[int] = None) -> NetworkRoute
func GetNetworkRoute(ctx *Context, name string, id IDInput, state *NetworkRouteState, opts ...ResourceOption) (*NetworkRoute, error)
public static NetworkRoute Get(string name, Input<string> id, NetworkRouteState? state, CustomResourceOptions? opts = null)
public static NetworkRoute get(String name, Output<String> id, NetworkRouteState 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.
- Destination string
Destination network or host of this route. Must be a subnet of the ip_range of the Network. Must not overlap with an existing ip_range in any subnets or with any destinations in other routes or with the first ip of the networks ip_range or with 172.31.1.1.
- Gateway string
Gateway for the route. Cannot be the first ip of the networks ip_range and also cannot be 172.31.1.1 as this IP is being used as a gateway for the public network interface of servers.
- Network
Id int ID of the Network the route should be added to.
- Destination string
Destination network or host of this route. Must be a subnet of the ip_range of the Network. Must not overlap with an existing ip_range in any subnets or with any destinations in other routes or with the first ip of the networks ip_range or with 172.31.1.1.
- Gateway string
Gateway for the route. Cannot be the first ip of the networks ip_range and also cannot be 172.31.1.1 as this IP is being used as a gateway for the public network interface of servers.
- Network
Id int ID of the Network the route should be added to.
- destination String
Destination network or host of this route. Must be a subnet of the ip_range of the Network. Must not overlap with an existing ip_range in any subnets or with any destinations in other routes or with the first ip of the networks ip_range or with 172.31.1.1.
- gateway String
Gateway for the route. Cannot be the first ip of the networks ip_range and also cannot be 172.31.1.1 as this IP is being used as a gateway for the public network interface of servers.
- network
Id Integer ID of the Network the route should be added to.
- destination string
Destination network or host of this route. Must be a subnet of the ip_range of the Network. Must not overlap with an existing ip_range in any subnets or with any destinations in other routes or with the first ip of the networks ip_range or with 172.31.1.1.
- gateway string
Gateway for the route. Cannot be the first ip of the networks ip_range and also cannot be 172.31.1.1 as this IP is being used as a gateway for the public network interface of servers.
- network
Id number ID of the Network the route should be added to.
- destination str
Destination network or host of this route. Must be a subnet of the ip_range of the Network. Must not overlap with an existing ip_range in any subnets or with any destinations in other routes or with the first ip of the networks ip_range or with 172.31.1.1.
- gateway str
Gateway for the route. Cannot be the first ip of the networks ip_range and also cannot be 172.31.1.1 as this IP is being used as a gateway for the public network interface of servers.
- network_
id int ID of the Network the route should be added to.
- destination String
Destination network or host of this route. Must be a subnet of the ip_range of the Network. Must not overlap with an existing ip_range in any subnets or with any destinations in other routes or with the first ip of the networks ip_range or with 172.31.1.1.
- gateway String
Gateway for the route. Cannot be the first ip of the networks ip_range and also cannot be 172.31.1.1 as this IP is being used as a gateway for the public network interface of servers.
- network
Id Number ID of the Network the route should be added to.
Import
Network Route entries can be imported using a compound ID with the following format<network-id>-<destination>
$ pulumi import hcloud:index/networkRoute:NetworkRoute myroute 123-10.0.0.0/16
Package Details
- Repository
- Hetzner Cloud pulumi/pulumi-hcloud
- License
- Apache-2.0
- Notes
This Pulumi package is based on the
hcloud
Terraform Provider.