ServerNetwork
Provides a Hetzner Cloud Server Network to represent a private network on a server in the Hetzner Cloud.
Example Usage
using Pulumi;
using HCloud = Pulumi.HCloud;
class MyStack : Stack
{
public MyStack()
{
var node1 = new HCloud.Server("node1", new HCloud.ServerArgs
{
Image = "debian-9",
ServerType = "cx11",
});
var mynet = new HCloud.Network("mynet", new HCloud.NetworkArgs
{
IpRange = "10.0.0.0/8",
});
var foonet = new HCloud.NetworkSubnet("foonet", new HCloud.NetworkSubnetArgs
{
IpRange = "10.0.1.0/24",
NetworkId = mynet.Id,
NetworkZone = "eu-central",
Type = "cloud",
});
var srvnetwork = new HCloud.ServerNetwork("srvnetwork", new HCloud.ServerNetworkArgs
{
Ip = "10.0.1.5",
NetworkId = mynet.Id,
ServerId = node1.Id,
});
}
}
package main
import (
"github.com/pulumi/pulumi-hcloud/sdk/go/hcloud"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
node1, err := hcloud.NewServer(ctx, "node1", &hcloud.ServerArgs{
Image: pulumi.String("debian-9"),
ServerType: pulumi.String("cx11"),
})
if err != nil {
return err
}
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{
IpRange: pulumi.String("10.0.1.0/24"),
NetworkId: mynet.ID(),
NetworkZone: pulumi.String("eu-central"),
Type: pulumi.String("cloud"),
})
if err != nil {
return err
}
_, err = hcloud.NewServerNetwork(ctx, "srvnetwork", &hcloud.ServerNetworkArgs{
Ip: pulumi.String("10.0.1.5"),
NetworkId: mynet.ID(),
ServerId: node1.ID(),
})
if err != nil {
return err
}
return nil
})
}import pulumi
import pulumi_hcloud as hcloud
node1 = hcloud.Server("node1",
image="debian-9",
server_type="cx11")
mynet = hcloud.Network("mynet", ip_range="10.0.0.0/8")
foonet = hcloud.NetworkSubnet("foonet",
ip_range="10.0.1.0/24",
network_id=mynet.id,
network_zone="eu-central",
type="cloud")
srvnetwork = hcloud.ServerNetwork("srvnetwork",
ip="10.0.1.5",
network_id=mynet.id,
server_id=node1.id)import * as pulumi from "@pulumi/pulumi";
import * as hcloud from "@pulumi/hcloud";
const node1 = new hcloud.Server("node1", {
image: "debian-9",
serverType: "cx11",
});
const mynet = new hcloud.Network("mynet", {
ipRange: "10.0.0.0/8",
});
const foonet = new hcloud.NetworkSubnet("foonet", {
ipRange: "10.0.1.0/24",
networkId: mynet.id.apply(id => Number.parseFloat(id)),
networkZone: "eu-central",
type: "cloud",
});
const srvnetwork = new hcloud.ServerNetwork("srvnetwork", {
ip: "10.0.1.5",
networkId: mynet.id.apply(id => Number.parseFloat(id)),
serverId: node1.id.apply(id => Number.parseFloat(id)),
});Create a ServerNetwork Resource
new ServerNetwork(name: string, args: ServerNetworkArgs, opts?: CustomResourceOptions);def ServerNetwork(resource_name, opts=None, alias_ips=None, ip=None, network_id=None, server_id=None, __props__=None);func NewServerNetwork(ctx *Context, name string, args ServerNetworkArgs, opts ...ResourceOption) (*ServerNetwork, error)public ServerNetwork(string name, ServerNetworkArgs args, CustomResourceOptions? opts = null)- name string
- The unique name of the resource.
- args ServerNetworkArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- opts ResourceOptions
- A bag of options that control this resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args ServerNetworkArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args ServerNetworkArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
ServerNetwork Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.
Inputs
The ServerNetwork resource accepts the following input properties:
Outputs
All input properties are implicitly available as output properties. Additionally, the ServerNetwork resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Mac
Address string
- Id string
- The provider-assigned unique ID for this managed resource.
- Mac
Address string
- id string
- The provider-assigned unique ID for this managed resource.
- mac
Address string
- id str
- The provider-assigned unique ID for this managed resource.
- mac_
address str
Look up an Existing ServerNetwork Resource
Get an existing ServerNetwork 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?: ServerNetworkState, opts?: CustomResourceOptions): ServerNetworkstatic get(resource_name, id, opts=None, alias_ips=None, ip=None, mac_address=None, network_id=None, server_id=None, __props__=None);func GetServerNetwork(ctx *Context, name string, id IDInput, state *ServerNetworkState, opts ...ResourceOption) (*ServerNetwork, error)public static ServerNetwork Get(string name, Input<string> id, ServerNetworkState? state, CustomResourceOptions? opts = null)- 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.
The following state arguments are supported:
Package Details
- Repository
- https://github.com/pulumi/pulumi-hcloud
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
hcloudTerraform Provider.