1. Packages
  2. Ionoscloud
  3. API Docs
  4. vpn
  5. WireguardPeer
IonosCloud v0.2.3 published on Tuesday, May 13, 2025 by ionos-cloud

ionoscloud.vpn.WireguardPeer

Explore with Pulumi AI

ionoscloud logo
IonosCloud v0.2.3 published on Tuesday, May 13, 2025 by ionos-cloud

    This page provides an overview of the ionoscloud.vpn.WireguardPeer resource, which allows you to manage a WireGuard Peer in your cloud infrastructure. This resource enables the creation, management, and deletion of a WireGuard VPN Peer, facilitating secure connections between your network resources.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as ionoscloud from "@ionos-cloud/sdk-pulumi";
    
    const example = new ionoscloud.vpn.WireguardPeer("example", {
        location: "de/fra",
        gatewayId: "your gateway id here",
        name: "example-gateway",
        description: "An example WireGuard peer",
        endpoint: {
            host: "1.2.3.4",
            port: 51820,
        },
        allowedIps: [
            "10.0.0.0/8",
            "192.168.1.0/24",
        ],
        publicKey: "examplePublicKey==",
    });
    
    import pulumi
    import pulumi_ionoscloud as ionoscloud
    
    example = ionoscloud.vpn.WireguardPeer("example",
        location="de/fra",
        gateway_id="your gateway id here",
        name="example-gateway",
        description="An example WireGuard peer",
        endpoint={
            "host": "1.2.3.4",
            "port": 51820,
        },
        allowed_ips=[
            "10.0.0.0/8",
            "192.168.1.0/24",
        ],
        public_key="examplePublicKey==")
    
    package main
    
    import (
    	"github.com/ionos-cloud/pulumi-ionoscloud/sdk/go/ionoscloud/vpn"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := vpn.NewWireguardPeer(ctx, "example", &vpn.WireguardPeerArgs{
    			Location:    pulumi.String("de/fra"),
    			GatewayId:   pulumi.String("your gateway id here"),
    			Name:        pulumi.String("example-gateway"),
    			Description: pulumi.String("An example WireGuard peer"),
    			Endpoint: &vpn.WireguardPeerEndpointArgs{
    				Host: pulumi.String("1.2.3.4"),
    				Port: pulumi.Int(51820),
    			},
    			AllowedIps: pulumi.StringArray{
    				pulumi.String("10.0.0.0/8"),
    				pulumi.String("192.168.1.0/24"),
    			},
    			PublicKey: pulumi.String("examplePublicKey=="),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Ionoscloud = Ionoscloud.Pulumi.Ionoscloud;
    
    return await Deployment.RunAsync(() => 
    {
        var example = new Ionoscloud.Vpn.WireguardPeer("example", new()
        {
            Location = "de/fra",
            GatewayId = "your gateway id here",
            Name = "example-gateway",
            Description = "An example WireGuard peer",
            Endpoint = new Ionoscloud.Vpn.Inputs.WireguardPeerEndpointArgs
            {
                Host = "1.2.3.4",
                Port = 51820,
            },
            AllowedIps = new[]
            {
                "10.0.0.0/8",
                "192.168.1.0/24",
            },
            PublicKey = "examplePublicKey==",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.ionoscloud.vpn.WireguardPeer;
    import com.pulumi.ionoscloud.vpn.WireguardPeerArgs;
    import com.pulumi.ionoscloud.vpn.inputs.WireguardPeerEndpointArgs;
    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 example = new WireguardPeer("example", WireguardPeerArgs.builder()
                .location("de/fra")
                .gatewayId("your gateway id here")
                .name("example-gateway")
                .description("An example WireGuard peer")
                .endpoint(WireguardPeerEndpointArgs.builder()
                    .host("1.2.3.4")
                    .port(51820)
                    .build())
                .allowedIps(            
                    "10.0.0.0/8",
                    "192.168.1.0/24")
                .publicKey("examplePublicKey==")
                .build());
    
        }
    }
    
    resources:
      example:
        type: ionoscloud:vpn:WireguardPeer
        properties:
          location: de/fra
          gatewayId: your gateway id here
          name: example-gateway
          description: An example WireGuard peer
          endpoint:
            host: 1.2.3.4
            port: 51820
          allowedIps:
            - 10.0.0.0/8
            - 192.168.1.0/24
          publicKey: examplePublicKey==
    

    Create WireguardPeer Resource

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

    Constructor syntax

    new WireguardPeer(name: string, args: WireguardPeerArgs, opts?: CustomResourceOptions);
    @overload
    def WireguardPeer(resource_name: str,
                      args: WireguardPeerArgs,
                      opts: Optional[ResourceOptions] = None)
    
    @overload
    def WireguardPeer(resource_name: str,
                      opts: Optional[ResourceOptions] = None,
                      allowed_ips: Optional[Sequence[str]] = None,
                      gateway_id: Optional[str] = None,
                      public_key: Optional[str] = None,
                      description: Optional[str] = None,
                      endpoint: Optional[WireguardPeerEndpointArgs] = None,
                      location: Optional[str] = None,
                      name: Optional[str] = None)
    func NewWireguardPeer(ctx *Context, name string, args WireguardPeerArgs, opts ...ResourceOption) (*WireguardPeer, error)
    public WireguardPeer(string name, WireguardPeerArgs args, CustomResourceOptions? opts = null)
    public WireguardPeer(String name, WireguardPeerArgs args)
    public WireguardPeer(String name, WireguardPeerArgs args, CustomResourceOptions options)
    
    type: ionoscloud:vpn:WireguardPeer
    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 WireguardPeerArgs
    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 WireguardPeerArgs
    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 WireguardPeerArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args WireguardPeerArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args WireguardPeerArgs
    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 wireguardPeerResource = new Ionoscloud.Vpn.WireguardPeer("wireguardPeerResource", new()
    {
        AllowedIps = new[]
        {
            "string",
        },
        GatewayId = "string",
        PublicKey = "string",
        Description = "string",
        Endpoint = new Ionoscloud.Vpn.Inputs.WireguardPeerEndpointArgs
        {
            Host = "string",
            Port = 0,
        },
        Location = "string",
        Name = "string",
    });
    
    example, err := vpn.NewWireguardPeer(ctx, "wireguardPeerResource", &vpn.WireguardPeerArgs{
    	AllowedIps: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    	GatewayId:   pulumi.String("string"),
    	PublicKey:   pulumi.String("string"),
    	Description: pulumi.String("string"),
    	Endpoint: &vpn.WireguardPeerEndpointArgs{
    		Host: pulumi.String("string"),
    		Port: pulumi.Int(0),
    	},
    	Location: pulumi.String("string"),
    	Name:     pulumi.String("string"),
    })
    
    var wireguardPeerResource = new WireguardPeer("wireguardPeerResource", WireguardPeerArgs.builder()
        .allowedIps("string")
        .gatewayId("string")
        .publicKey("string")
        .description("string")
        .endpoint(WireguardPeerEndpointArgs.builder()
            .host("string")
            .port(0)
            .build())
        .location("string")
        .name("string")
        .build());
    
    wireguard_peer_resource = ionoscloud.vpn.WireguardPeer("wireguardPeerResource",
        allowed_ips=["string"],
        gateway_id="string",
        public_key="string",
        description="string",
        endpoint={
            "host": "string",
            "port": 0,
        },
        location="string",
        name="string")
    
    const wireguardPeerResource = new ionoscloud.vpn.WireguardPeer("wireguardPeerResource", {
        allowedIps: ["string"],
        gatewayId: "string",
        publicKey: "string",
        description: "string",
        endpoint: {
            host: "string",
            port: 0,
        },
        location: "string",
        name: "string",
    });
    
    type: ionoscloud:vpn:WireguardPeer
    properties:
        allowedIps:
            - string
        description: string
        endpoint:
            host: string
            port: 0
        gatewayId: string
        location: string
        name: string
        publicKey: string
    

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

    AllowedIps List<string>
    [list, string] A list of subnet CIDRs that are allowed to connect to the WireGuard Gateway.
    GatewayId string
    [string] The ID of the WireGuard Gateway that the Peer will connect to.
    PublicKey string
    [string] The public key for the WireGuard Gateway.
    Description string
    [string] A description of the WireGuard Gateway.
    Endpoint Ionoscloud.WireguardPeerEndpoint
    [block] An endpoint configuration block for the WireGuard Gateway. The structure of this block is as follows:
    Location string
    [string] The location of the WireGuard Gateway.
    Name string
    [string] The human-readable name of the WireGuard Gateway.
    AllowedIps []string
    [list, string] A list of subnet CIDRs that are allowed to connect to the WireGuard Gateway.
    GatewayId string
    [string] The ID of the WireGuard Gateway that the Peer will connect to.
    PublicKey string
    [string] The public key for the WireGuard Gateway.
    Description string
    [string] A description of the WireGuard Gateway.
    Endpoint WireguardPeerEndpointArgs
    [block] An endpoint configuration block for the WireGuard Gateway. The structure of this block is as follows:
    Location string
    [string] The location of the WireGuard Gateway.
    Name string
    [string] The human-readable name of the WireGuard Gateway.
    allowedIps List<String>
    [list, string] A list of subnet CIDRs that are allowed to connect to the WireGuard Gateway.
    gatewayId String
    [string] The ID of the WireGuard Gateway that the Peer will connect to.
    publicKey String
    [string] The public key for the WireGuard Gateway.
    description String
    [string] A description of the WireGuard Gateway.
    endpoint WireguardPeerEndpoint
    [block] An endpoint configuration block for the WireGuard Gateway. The structure of this block is as follows:
    location String
    [string] The location of the WireGuard Gateway.
    name String
    [string] The human-readable name of the WireGuard Gateway.
    allowedIps string[]
    [list, string] A list of subnet CIDRs that are allowed to connect to the WireGuard Gateway.
    gatewayId string
    [string] The ID of the WireGuard Gateway that the Peer will connect to.
    publicKey string
    [string] The public key for the WireGuard Gateway.
    description string
    [string] A description of the WireGuard Gateway.
    endpoint WireguardPeerEndpoint
    [block] An endpoint configuration block for the WireGuard Gateway. The structure of this block is as follows:
    location string
    [string] The location of the WireGuard Gateway.
    name string
    [string] The human-readable name of the WireGuard Gateway.
    allowed_ips Sequence[str]
    [list, string] A list of subnet CIDRs that are allowed to connect to the WireGuard Gateway.
    gateway_id str
    [string] The ID of the WireGuard Gateway that the Peer will connect to.
    public_key str
    [string] The public key for the WireGuard Gateway.
    description str
    [string] A description of the WireGuard Gateway.
    endpoint WireguardPeerEndpointArgs
    [block] An endpoint configuration block for the WireGuard Gateway. The structure of this block is as follows:
    location str
    [string] The location of the WireGuard Gateway.
    name str
    [string] The human-readable name of the WireGuard Gateway.
    allowedIps List<String>
    [list, string] A list of subnet CIDRs that are allowed to connect to the WireGuard Gateway.
    gatewayId String
    [string] The ID of the WireGuard Gateway that the Peer will connect to.
    publicKey String
    [string] The public key for the WireGuard Gateway.
    description String
    [string] A description of the WireGuard Gateway.
    endpoint Property Map
    [block] An endpoint configuration block for the WireGuard Gateway. The structure of this block is as follows:
    location String
    [string] The location of the WireGuard Gateway.
    name String
    [string] The human-readable name of the WireGuard Gateway.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the WireguardPeer resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    Status string
    The current status of the WireGuard Gateway Peer.
    Id string
    The provider-assigned unique ID for this managed resource.
    Status string
    The current status of the WireGuard Gateway Peer.
    id String
    The provider-assigned unique ID for this managed resource.
    status String
    The current status of the WireGuard Gateway Peer.
    id string
    The provider-assigned unique ID for this managed resource.
    status string
    The current status of the WireGuard Gateway Peer.
    id str
    The provider-assigned unique ID for this managed resource.
    status str
    The current status of the WireGuard Gateway Peer.
    id String
    The provider-assigned unique ID for this managed resource.
    status String
    The current status of the WireGuard Gateway Peer.

    Look up Existing WireguardPeer Resource

    Get an existing WireguardPeer 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?: WireguardPeerState, opts?: CustomResourceOptions): WireguardPeer
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            allowed_ips: Optional[Sequence[str]] = None,
            description: Optional[str] = None,
            endpoint: Optional[WireguardPeerEndpointArgs] = None,
            gateway_id: Optional[str] = None,
            location: Optional[str] = None,
            name: Optional[str] = None,
            public_key: Optional[str] = None,
            status: Optional[str] = None) -> WireguardPeer
    func GetWireguardPeer(ctx *Context, name string, id IDInput, state *WireguardPeerState, opts ...ResourceOption) (*WireguardPeer, error)
    public static WireguardPeer Get(string name, Input<string> id, WireguardPeerState? state, CustomResourceOptions? opts = null)
    public static WireguardPeer get(String name, Output<String> id, WireguardPeerState state, CustomResourceOptions options)
    resources:  _:    type: ionoscloud:vpn:WireguardPeer    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.
    The following state arguments are supported:
    AllowedIps List<string>
    [list, string] A list of subnet CIDRs that are allowed to connect to the WireGuard Gateway.
    Description string
    [string] A description of the WireGuard Gateway.
    Endpoint Ionoscloud.WireguardPeerEndpoint
    [block] An endpoint configuration block for the WireGuard Gateway. The structure of this block is as follows:
    GatewayId string
    [string] The ID of the WireGuard Gateway that the Peer will connect to.
    Location string
    [string] The location of the WireGuard Gateway.
    Name string
    [string] The human-readable name of the WireGuard Gateway.
    PublicKey string
    [string] The public key for the WireGuard Gateway.
    Status string
    The current status of the WireGuard Gateway Peer.
    AllowedIps []string
    [list, string] A list of subnet CIDRs that are allowed to connect to the WireGuard Gateway.
    Description string
    [string] A description of the WireGuard Gateway.
    Endpoint WireguardPeerEndpointArgs
    [block] An endpoint configuration block for the WireGuard Gateway. The structure of this block is as follows:
    GatewayId string
    [string] The ID of the WireGuard Gateway that the Peer will connect to.
    Location string
    [string] The location of the WireGuard Gateway.
    Name string
    [string] The human-readable name of the WireGuard Gateway.
    PublicKey string
    [string] The public key for the WireGuard Gateway.
    Status string
    The current status of the WireGuard Gateway Peer.
    allowedIps List<String>
    [list, string] A list of subnet CIDRs that are allowed to connect to the WireGuard Gateway.
    description String
    [string] A description of the WireGuard Gateway.
    endpoint WireguardPeerEndpoint
    [block] An endpoint configuration block for the WireGuard Gateway. The structure of this block is as follows:
    gatewayId String
    [string] The ID of the WireGuard Gateway that the Peer will connect to.
    location String
    [string] The location of the WireGuard Gateway.
    name String
    [string] The human-readable name of the WireGuard Gateway.
    publicKey String
    [string] The public key for the WireGuard Gateway.
    status String
    The current status of the WireGuard Gateway Peer.
    allowedIps string[]
    [list, string] A list of subnet CIDRs that are allowed to connect to the WireGuard Gateway.
    description string
    [string] A description of the WireGuard Gateway.
    endpoint WireguardPeerEndpoint
    [block] An endpoint configuration block for the WireGuard Gateway. The structure of this block is as follows:
    gatewayId string
    [string] The ID of the WireGuard Gateway that the Peer will connect to.
    location string
    [string] The location of the WireGuard Gateway.
    name string
    [string] The human-readable name of the WireGuard Gateway.
    publicKey string
    [string] The public key for the WireGuard Gateway.
    status string
    The current status of the WireGuard Gateway Peer.
    allowed_ips Sequence[str]
    [list, string] A list of subnet CIDRs that are allowed to connect to the WireGuard Gateway.
    description str
    [string] A description of the WireGuard Gateway.
    endpoint WireguardPeerEndpointArgs
    [block] An endpoint configuration block for the WireGuard Gateway. The structure of this block is as follows:
    gateway_id str
    [string] The ID of the WireGuard Gateway that the Peer will connect to.
    location str
    [string] The location of the WireGuard Gateway.
    name str
    [string] The human-readable name of the WireGuard Gateway.
    public_key str
    [string] The public key for the WireGuard Gateway.
    status str
    The current status of the WireGuard Gateway Peer.
    allowedIps List<String>
    [list, string] A list of subnet CIDRs that are allowed to connect to the WireGuard Gateway.
    description String
    [string] A description of the WireGuard Gateway.
    endpoint Property Map
    [block] An endpoint configuration block for the WireGuard Gateway. The structure of this block is as follows:
    gatewayId String
    [string] The ID of the WireGuard Gateway that the Peer will connect to.
    location String
    [string] The location of the WireGuard Gateway.
    name String
    [string] The human-readable name of the WireGuard Gateway.
    publicKey String
    [string] The public key for the WireGuard Gateway.
    status String
    The current status of the WireGuard Gateway Peer.

    Supporting Types

    WireguardPeerEndpoint, WireguardPeerEndpointArgs

    Host string
    [string] The hostname or IPV4 address that the WireGuard Server will connect to.
    Port int
    [int] The port that the WireGuard Server will connect to. Defaults to 51820.
    Host string
    [string] The hostname or IPV4 address that the WireGuard Server will connect to.
    Port int
    [int] The port that the WireGuard Server will connect to. Defaults to 51820.
    host String
    [string] The hostname or IPV4 address that the WireGuard Server will connect to.
    port Integer
    [int] The port that the WireGuard Server will connect to. Defaults to 51820.
    host string
    [string] The hostname or IPV4 address that the WireGuard Server will connect to.
    port number
    [int] The port that the WireGuard Server will connect to. Defaults to 51820.
    host str
    [string] The hostname or IPV4 address that the WireGuard Server will connect to.
    port int
    [int] The port that the WireGuard Server will connect to. Defaults to 51820.
    host String
    [string] The hostname or IPV4 address that the WireGuard Server will connect to.
    port Number
    [int] The port that the WireGuard Server will connect to. Defaults to 51820.

    Import

    WireGuard Peers can be imported using the gateway_id and id, e.g.,

    $ pulumi import ionoscloud:vpn/wireguardPeer:WireguardPeer example gateway_id:peer_id
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    ionoscloud ionos-cloud/pulumi-ionoscloud
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the ionoscloud Terraform Provider.
    ionoscloud logo
    IonosCloud v0.2.3 published on Tuesday, May 13, 2025 by ionos-cloud