1. Packages
  2. UpCloud
  3. API Docs
  4. NetworkPeering
UpCloud v0.2.0 published on Wednesday, Apr 16, 2025 by UpCloudLtd

upcloud.NetworkPeering

Explore with Pulumi AI

Network peerings can be used to connect networks across accounts. For the network peering to become active, the peering must be made from both directions.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as upcloud from "@upcloud/pulumi-upcloud";

// Network peering requires the networks to have routers attached to them.
const _this = new upcloud.Router("this", {name: "network-peering-example-router"});
const example = new upcloud.Network("example", {
    name: "network-peering-example-net",
    zone: "nl-ams1",
    router: exampleUpcloudRouter.id,
    ipNetwork: {
        address: "10.0.0.0/24",
        dhcp: true,
        family: "IPv4",
    },
});
const thisNetworkPeering: upcloud.NetworkPeering[] = [];
for (const range = {value: 0}; range.value < 1; range.value++) {
    thisNetworkPeering.push(new upcloud.NetworkPeering(`this-${range.value}`, {
        name: "network-peering-example-peering",
        network: {
            uuid: example.id,
        },
        peerNetwork: {
            uuid: "0305723a-e5cb-4ef6-985d-e36ed44d133a",
        },
    }));
}
Copy
import pulumi
import pulumi_upcloud as upcloud

# Network peering requires the networks to have routers attached to them.
this = upcloud.Router("this", name="network-peering-example-router")
example = upcloud.Network("example",
    name="network-peering-example-net",
    zone="nl-ams1",
    router=example_upcloud_router["id"],
    ip_network={
        "address": "10.0.0.0/24",
        "dhcp": True,
        "family": "IPv4",
    })
this_network_peering = []
for range in [{"value": i} for i in range(0, 1)]:
    this_network_peering.append(upcloud.NetworkPeering(f"this-{range['value']}",
        name="network-peering-example-peering",
        network={
            "uuid": example.id,
        },
        peer_network={
            "uuid": "0305723a-e5cb-4ef6-985d-e36ed44d133a",
        }))
Copy
package main

import (
	"github.com/UpCloudLtd/pulumi-upcloud/sdk/go/upcloud"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		// Network peering requires the networks to have routers attached to them.
		_, err := upcloud.NewRouter(ctx, "this", &upcloud.RouterArgs{
			Name: pulumi.String("network-peering-example-router"),
		})
		if err != nil {
			return err
		}
		example, err := upcloud.NewNetwork(ctx, "example", &upcloud.NetworkArgs{
			Name:   pulumi.String("network-peering-example-net"),
			Zone:   pulumi.String("nl-ams1"),
			Router: pulumi.Any(exampleUpcloudRouter.Id),
			IpNetwork: &upcloud.NetworkIpNetworkArgs{
				Address: pulumi.String("10.0.0.0/24"),
				Dhcp:    pulumi.Bool(true),
				Family:  pulumi.String("IPv4"),
			},
		})
		if err != nil {
			return err
		}
		var thisNetworkPeering []*upcloud.NetworkPeering
		for index := 0; index < 1; index++ {
			key0 := index
			_ := index
			__res, err := upcloud.NewNetworkPeering(ctx, fmt.Sprintf("this-%v", key0), &upcloud.NetworkPeeringArgs{
				Name: pulumi.String("network-peering-example-peering"),
				Network: &upcloud.NetworkPeeringNetworkArgs{
					Uuid: example.ID(),
				},
				PeerNetwork: &upcloud.NetworkPeeringPeerNetworkArgs{
					Uuid: pulumi.String("0305723a-e5cb-4ef6-985d-e36ed44d133a"),
				},
			})
			if err != nil {
				return err
			}
			thisNetworkPeering = append(thisNetworkPeering, __res)
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using UpCloud = UpCloud.Pulumi.UpCloud;

return await Deployment.RunAsync(() => 
{
    // Network peering requires the networks to have routers attached to them.
    var @this = new UpCloud.Router("this", new()
    {
        Name = "network-peering-example-router",
    });

    var example = new UpCloud.Network("example", new()
    {
        Name = "network-peering-example-net",
        Zone = "nl-ams1",
        Router = exampleUpcloudRouter.Id,
        IpNetwork = new UpCloud.Inputs.NetworkIpNetworkArgs
        {
            Address = "10.0.0.0/24",
            Dhcp = true,
            Family = "IPv4",
        },
    });

    var thisNetworkPeering = new List<UpCloud.NetworkPeering>();
    for (var rangeIndex = 0; rangeIndex < 1; rangeIndex++)
    {
        var range = new { Value = rangeIndex };
        thisNetworkPeering.Add(new UpCloud.NetworkPeering($"this-{range.Value}", new()
        {
            Name = "network-peering-example-peering",
            Network = new UpCloud.Inputs.NetworkPeeringNetworkArgs
            {
                Uuid = example.Id,
            },
            PeerNetwork = new UpCloud.Inputs.NetworkPeeringPeerNetworkArgs
            {
                Uuid = "0305723a-e5cb-4ef6-985d-e36ed44d133a",
            },
        }));
    }
});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.upcloud.Router;
import com.pulumi.upcloud.RouterArgs;
import com.pulumi.upcloud.Network;
import com.pulumi.upcloud.NetworkArgs;
import com.pulumi.upcloud.inputs.NetworkIpNetworkArgs;
import com.pulumi.upcloud.NetworkPeering;
import com.pulumi.upcloud.NetworkPeeringArgs;
import com.pulumi.upcloud.inputs.NetworkPeeringNetworkArgs;
import com.pulumi.upcloud.inputs.NetworkPeeringPeerNetworkArgs;
import com.pulumi.codegen.internal.KeyedValue;
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) {
        // Network peering requires the networks to have routers attached to them.
        var this_ = new Router("this", RouterArgs.builder()
            .name("network-peering-example-router")
            .build());

        var example = new Network("example", NetworkArgs.builder()
            .name("network-peering-example-net")
            .zone("nl-ams1")
            .router(exampleUpcloudRouter.id())
            .ipNetwork(NetworkIpNetworkArgs.builder()
                .address("10.0.0.0/24")
                .dhcp(true)
                .family("IPv4")
                .build())
            .build());

        for (var i = 0; i < 1; i++) {
            new NetworkPeering("thisNetworkPeering-" + i, NetworkPeeringArgs.builder()
                .name("network-peering-example-peering")
                .network(NetworkPeeringNetworkArgs.builder()
                    .uuid(example.id())
                    .build())
                .peerNetwork(NetworkPeeringPeerNetworkArgs.builder()
                    .uuid("0305723a-e5cb-4ef6-985d-e36ed44d133a")
                    .build())
                .build());

        
}
    }
}
Copy
resources:
  # Network peering requires the networks to have routers attached to them.
  this:
    type: upcloud:Router
    properties:
      name: network-peering-example-router
  example:
    type: upcloud:Network
    properties:
      name: network-peering-example-net
      zone: nl-ams1
      router: ${exampleUpcloudRouter.id}
      ipNetwork:
        address: 10.0.0.0/24
        dhcp: true
        family: IPv4
  thisNetworkPeering:
    type: upcloud:NetworkPeering
    name: this
    properties:
      name: network-peering-example-peering
      network:
        uuid: ${example.id}
      peerNetwork:
        uuid: 0305723a-e5cb-4ef6-985d-e36ed44d133a
    options: {}
Copy

Create NetworkPeering Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new NetworkPeering(name: string, args: NetworkPeeringArgs, opts?: CustomResourceOptions);
@overload
def NetworkPeering(resource_name: str,
                   args: NetworkPeeringArgs,
                   opts: Optional[ResourceOptions] = None)

@overload
def NetworkPeering(resource_name: str,
                   opts: Optional[ResourceOptions] = None,
                   network: Optional[NetworkPeeringNetworkArgs] = None,
                   peer_network: Optional[NetworkPeeringPeerNetworkArgs] = None,
                   configured_status: Optional[str] = None,
                   labels: Optional[Mapping[str, str]] = None,
                   name: Optional[str] = None)
func NewNetworkPeering(ctx *Context, name string, args NetworkPeeringArgs, opts ...ResourceOption) (*NetworkPeering, error)
public NetworkPeering(string name, NetworkPeeringArgs args, CustomResourceOptions? opts = null)
public NetworkPeering(String name, NetworkPeeringArgs args)
public NetworkPeering(String name, NetworkPeeringArgs args, CustomResourceOptions options)
type: upcloud:NetworkPeering
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. NetworkPeeringArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. NetworkPeeringArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. NetworkPeeringArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. NetworkPeeringArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. NetworkPeeringArgs
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 networkPeeringResource = new UpCloud.NetworkPeering("networkPeeringResource", new()
{
    Network = new UpCloud.Inputs.NetworkPeeringNetworkArgs
    {
        Uuid = "string",
    },
    PeerNetwork = new UpCloud.Inputs.NetworkPeeringPeerNetworkArgs
    {
        Uuid = "string",
    },
    ConfiguredStatus = "string",
    Labels = 
    {
        { "string", "string" },
    },
    Name = "string",
});
Copy
example, err := upcloud.NewNetworkPeering(ctx, "networkPeeringResource", &upcloud.NetworkPeeringArgs{
	Network: &upcloud.NetworkPeeringNetworkArgs{
		Uuid: pulumi.String("string"),
	},
	PeerNetwork: &upcloud.NetworkPeeringPeerNetworkArgs{
		Uuid: pulumi.String("string"),
	},
	ConfiguredStatus: pulumi.String("string"),
	Labels: pulumi.StringMap{
		"string": pulumi.String("string"),
	},
	Name: pulumi.String("string"),
})
Copy
var networkPeeringResource = new NetworkPeering("networkPeeringResource", NetworkPeeringArgs.builder()
    .network(NetworkPeeringNetworkArgs.builder()
        .uuid("string")
        .build())
    .peerNetwork(NetworkPeeringPeerNetworkArgs.builder()
        .uuid("string")
        .build())
    .configuredStatus("string")
    .labels(Map.of("string", "string"))
    .name("string")
    .build());
Copy
network_peering_resource = upcloud.NetworkPeering("networkPeeringResource",
    network={
        "uuid": "string",
    },
    peer_network={
        "uuid": "string",
    },
    configured_status="string",
    labels={
        "string": "string",
    },
    name="string")
Copy
const networkPeeringResource = new upcloud.NetworkPeering("networkPeeringResource", {
    network: {
        uuid: "string",
    },
    peerNetwork: {
        uuid: "string",
    },
    configuredStatus: "string",
    labels: {
        string: "string",
    },
    name: "string",
});
Copy
type: upcloud:NetworkPeering
properties:
    configuredStatus: string
    labels:
        string: string
    name: string
    network:
        uuid: string
    peerNetwork:
        uuid: string
Copy

NetworkPeering 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 NetworkPeering resource accepts the following input properties:

Network This property is required. UpCloud.Pulumi.UpCloud.Inputs.NetworkPeeringNetwork
Local network of the network peering.
PeerNetwork This property is required. UpCloud.Pulumi.UpCloud.Inputs.NetworkPeeringPeerNetwork
Peer network of the network peering.
ConfiguredStatus string
Configured status of the network peering.
Labels Dictionary<string, string>
User defined key-value pairs to classify the network peering.
Name string
Name of the network peering.
Network This property is required. NetworkPeeringNetworkArgs
Local network of the network peering.
PeerNetwork This property is required. NetworkPeeringPeerNetworkArgs
Peer network of the network peering.
ConfiguredStatus string
Configured status of the network peering.
Labels map[string]string
User defined key-value pairs to classify the network peering.
Name string
Name of the network peering.
network This property is required. NetworkPeeringNetwork
Local network of the network peering.
peerNetwork This property is required. NetworkPeeringPeerNetwork
Peer network of the network peering.
configuredStatus String
Configured status of the network peering.
labels Map<String,String>
User defined key-value pairs to classify the network peering.
name String
Name of the network peering.
network This property is required. NetworkPeeringNetwork
Local network of the network peering.
peerNetwork This property is required. NetworkPeeringPeerNetwork
Peer network of the network peering.
configuredStatus string
Configured status of the network peering.
labels {[key: string]: string}
User defined key-value pairs to classify the network peering.
name string
Name of the network peering.
network This property is required. NetworkPeeringNetworkArgs
Local network of the network peering.
peer_network This property is required. NetworkPeeringPeerNetworkArgs
Peer network of the network peering.
configured_status str
Configured status of the network peering.
labels Mapping[str, str]
User defined key-value pairs to classify the network peering.
name str
Name of the network peering.
network This property is required. Property Map
Local network of the network peering.
peerNetwork This property is required. Property Map
Peer network of the network peering.
configuredStatus String
Configured status of the network peering.
labels Map<String>
User defined key-value pairs to classify the network peering.
name String
Name of the network peering.

Outputs

All input properties are implicitly available as output properties. Additionally, the NetworkPeering 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 NetworkPeering Resource

Get an existing NetworkPeering 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?: NetworkPeeringState, opts?: CustomResourceOptions): NetworkPeering
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        configured_status: Optional[str] = None,
        labels: Optional[Mapping[str, str]] = None,
        name: Optional[str] = None,
        network: Optional[NetworkPeeringNetworkArgs] = None,
        peer_network: Optional[NetworkPeeringPeerNetworkArgs] = None) -> NetworkPeering
func GetNetworkPeering(ctx *Context, name string, id IDInput, state *NetworkPeeringState, opts ...ResourceOption) (*NetworkPeering, error)
public static NetworkPeering Get(string name, Input<string> id, NetworkPeeringState? state, CustomResourceOptions? opts = null)
public static NetworkPeering get(String name, Output<String> id, NetworkPeeringState state, CustomResourceOptions options)
resources:  _:    type: upcloud:NetworkPeering    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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:
ConfiguredStatus string
Configured status of the network peering.
Labels Dictionary<string, string>
User defined key-value pairs to classify the network peering.
Name string
Name of the network peering.
Network UpCloud.Pulumi.UpCloud.Inputs.NetworkPeeringNetwork
Local network of the network peering.
PeerNetwork UpCloud.Pulumi.UpCloud.Inputs.NetworkPeeringPeerNetwork
Peer network of the network peering.
ConfiguredStatus string
Configured status of the network peering.
Labels map[string]string
User defined key-value pairs to classify the network peering.
Name string
Name of the network peering.
Network NetworkPeeringNetworkArgs
Local network of the network peering.
PeerNetwork NetworkPeeringPeerNetworkArgs
Peer network of the network peering.
configuredStatus String
Configured status of the network peering.
labels Map<String,String>
User defined key-value pairs to classify the network peering.
name String
Name of the network peering.
network NetworkPeeringNetwork
Local network of the network peering.
peerNetwork NetworkPeeringPeerNetwork
Peer network of the network peering.
configuredStatus string
Configured status of the network peering.
labels {[key: string]: string}
User defined key-value pairs to classify the network peering.
name string
Name of the network peering.
network NetworkPeeringNetwork
Local network of the network peering.
peerNetwork NetworkPeeringPeerNetwork
Peer network of the network peering.
configured_status str
Configured status of the network peering.
labels Mapping[str, str]
User defined key-value pairs to classify the network peering.
name str
Name of the network peering.
network NetworkPeeringNetworkArgs
Local network of the network peering.
peer_network NetworkPeeringPeerNetworkArgs
Peer network of the network peering.
configuredStatus String
Configured status of the network peering.
labels Map<String>
User defined key-value pairs to classify the network peering.
name String
Name of the network peering.
network Property Map
Local network of the network peering.
peerNetwork Property Map
Peer network of the network peering.

Supporting Types

NetworkPeeringNetwork
, NetworkPeeringNetworkArgs

Uuid This property is required. string
The UUID of the network.
Uuid This property is required. string
The UUID of the network.
uuid This property is required. String
The UUID of the network.
uuid This property is required. string
The UUID of the network.
uuid This property is required. str
The UUID of the network.
uuid This property is required. String
The UUID of the network.

NetworkPeeringPeerNetwork
, NetworkPeeringPeerNetworkArgs

Uuid This property is required. string
The UUID of the network.
Uuid This property is required. string
The UUID of the network.
uuid This property is required. String
The UUID of the network.
uuid This property is required. string
The UUID of the network.
uuid This property is required. str
The UUID of the network.
uuid This property is required. String
The UUID of the network.

Package Details

Repository
upcloud UpCloudLtd/pulumi-upcloud
License
Apache-2.0
Notes
This Pulumi package is based on the upcloud Terraform Provider.