1. Registry
  2. Packages
  3. UpCloud
  4. API Docs
  5. ServerPrivateFirewallRuleset
Viewing docs for UpCloud v0.22.0
published on Tuesday, Oct 13, 2026 by UpCloudLtd
upcloud logo UpCloud
Viewing docs for UpCloud v0.22.0
published on Tuesday, Oct 13, 2026 by UpCloudLtd

    This resource represents an attachment of an UpCloud SDN private firewall ruleset to a server.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as upcloud from "@upcloud/pulumi-upcloud";
    
    // Attach an SDN private firewall ruleset to a server
    const example = new upcloud.Network("example", {
        name: "terraform-example-private-network",
        zone: "de-fra1",
        ipNetwork: {
            address: "172.24.1.0/24",
            dhcp: true,
            family: "IPv4",
        },
    });
    const exampleServer = new upcloud.Server("example", {
        hostname: "terraform.example.tld",
        zone: "de-fra1",
        plan: "1xCPU-1GB",
        template: {
            storage: "Ubuntu Server 24.04 LTS (Noble Numbat)",
        },
        networkInterfaces: [{
            type: "private",
            network: example.id,
        }],
    });
    const exampleFirewallRuleset = new upcloud.FirewallRuleset("example", {
        name: "example-private-ruleset",
        description: "Private SDN ruleset",
        rules: [{
            action: "accept",
            direction: "in",
            family: "IPv4",
            protocol: "tcp",
            comment: "Allow SSH",
            destinationPortStart: 22,
            destinationPortEnd: 22,
        }],
    });
    const exampleServerPrivateFirewallRuleset = new upcloud.ServerPrivateFirewallRuleset("example", {
        serverId: exampleServer.id,
        rulesetId: exampleFirewallRuleset.id,
    });
    
    import pulumi
    import pulumi_upcloud as upcloud
    
    # Attach an SDN private firewall ruleset to a server
    example = upcloud.Network("example",
        name="terraform-example-private-network",
        zone="de-fra1",
        ip_network={
            "address": "172.24.1.0/24",
            "dhcp": True,
            "family": "IPv4",
        })
    example_server = upcloud.Server("example",
        hostname="terraform.example.tld",
        zone="de-fra1",
        plan="1xCPU-1GB",
        template={
            "storage": "Ubuntu Server 24.04 LTS (Noble Numbat)",
        },
        network_interfaces=[{
            "type": "private",
            "network": example.id,
        }])
    example_firewall_ruleset = upcloud.FirewallRuleset("example",
        name="example-private-ruleset",
        description="Private SDN ruleset",
        rules=[{
            "action": "accept",
            "direction": "in",
            "family": "IPv4",
            "protocol": "tcp",
            "comment": "Allow SSH",
            "destination_port_start": 22,
            "destination_port_end": 22,
        }])
    example_server_private_firewall_ruleset = upcloud.ServerPrivateFirewallRuleset("example",
        server_id=example_server.id,
        ruleset_id=example_firewall_ruleset.id)
    
    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 {
    		// Attach an SDN private firewall ruleset to a server
    		example, err := upcloud.NewNetwork(ctx, "example", &upcloud.NetworkArgs{
    			Name: pulumi.String("terraform-example-private-network"),
    			Zone: pulumi.String("de-fra1"),
    			IpNetwork: &upcloud.NetworkIpNetworkArgs{
    				Address: pulumi.String("172.24.1.0/24"),
    				Dhcp:    pulumi.Bool(true),
    				Family:  pulumi.String("IPv4"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		exampleServer, err := upcloud.NewServer(ctx, "example", &upcloud.ServerArgs{
    			Hostname: pulumi.String("terraform.example.tld"),
    			Zone:     pulumi.String("de-fra1"),
    			Plan:     pulumi.String("1xCPU-1GB"),
    			Template: &upcloud.ServerTemplateArgs{
    				Storage: pulumi.String("Ubuntu Server 24.04 LTS (Noble Numbat)"),
    			},
    			NetworkInterfaces: upcloud.ServerNetworkInterfaceArray{
    				&upcloud.ServerNetworkInterfaceArgs{
    					Type:    pulumi.String("private"),
    					Network: example.ID(),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		exampleFirewallRuleset, err := upcloud.NewFirewallRuleset(ctx, "example", &upcloud.FirewallRulesetArgs{
    			Name:        pulumi.String("example-private-ruleset"),
    			Description: pulumi.String("Private SDN ruleset"),
    			Rules: upcloud.FirewallRulesetRuleArray{
    				&upcloud.FirewallRulesetRuleArgs{
    					Action:               pulumi.String("accept"),
    					Direction:            pulumi.String("in"),
    					Family:               pulumi.String("IPv4"),
    					Protocol:             pulumi.String("tcp"),
    					Comment:              pulumi.String("Allow SSH"),
    					DestinationPortStart: pulumi.Int(22),
    					DestinationPortEnd:   pulumi.Int(22),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = upcloud.NewServerPrivateFirewallRuleset(ctx, "example", &upcloud.ServerPrivateFirewallRulesetArgs{
    			ServerId:  exampleServer.ID(),
    			RulesetId: exampleFirewallRuleset.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using UpCloud = UpCloud.Pulumi.UpCloud;
    
    return await Deployment.RunAsync(() => 
    {
        // Attach an SDN private firewall ruleset to a server
        var example = new UpCloud.Network("example", new()
        {
            Name = "terraform-example-private-network",
            Zone = "de-fra1",
            IpNetwork = new UpCloud.Inputs.NetworkIpNetworkArgs
            {
                Address = "172.24.1.0/24",
                Dhcp = true,
                Family = "IPv4",
            },
        });
    
        var exampleServer = new UpCloud.Server("example", new()
        {
            Hostname = "terraform.example.tld",
            Zone = "de-fra1",
            Plan = "1xCPU-1GB",
            Template = new UpCloud.Inputs.ServerTemplateArgs
            {
                Storage = "Ubuntu Server 24.04 LTS (Noble Numbat)",
            },
            NetworkInterfaces = new[]
            {
                new UpCloud.Inputs.ServerNetworkInterfaceArgs
                {
                    Type = "private",
                    Network = example.Id,
                },
            },
        });
    
        var exampleFirewallRuleset = new UpCloud.FirewallRuleset("example", new()
        {
            Name = "example-private-ruleset",
            Description = "Private SDN ruleset",
            Rules = new[]
            {
                new UpCloud.Inputs.FirewallRulesetRuleArgs
                {
                    Action = "accept",
                    Direction = "in",
                    Family = "IPv4",
                    Protocol = "tcp",
                    Comment = "Allow SSH",
                    DestinationPortStart = 22,
                    DestinationPortEnd = 22,
                },
            },
        });
    
        var exampleServerPrivateFirewallRuleset = new UpCloud.ServerPrivateFirewallRuleset("example", new()
        {
            ServerId = exampleServer.Id,
            RulesetId = exampleFirewallRuleset.Id,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.upcloud.Network;
    import com.pulumi.upcloud.NetworkArgs;
    import com.pulumi.upcloud.inputs.NetworkIpNetworkArgs;
    import com.pulumi.upcloud.Server;
    import com.pulumi.upcloud.ServerArgs;
    import com.pulumi.upcloud.inputs.ServerTemplateArgs;
    import com.pulumi.upcloud.inputs.ServerNetworkInterfaceArgs;
    import com.pulumi.upcloud.FirewallRuleset;
    import com.pulumi.upcloud.FirewallRulesetArgs;
    import com.pulumi.upcloud.inputs.FirewallRulesetRuleArgs;
    import com.pulumi.upcloud.ServerPrivateFirewallRuleset;
    import com.pulumi.upcloud.ServerPrivateFirewallRulesetArgs;
    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) {
            // Attach an SDN private firewall ruleset to a server
            var example = new Network("example", NetworkArgs.builder()
                .name("terraform-example-private-network")
                .zone("de-fra1")
                .ipNetwork(NetworkIpNetworkArgs.builder()
                    .address("172.24.1.0/24")
                    .dhcp(true)
                    .family("IPv4")
                    .build())
                .build());
    
            var exampleServer = new Server("exampleServer", ServerArgs.builder()
                .hostname("terraform.example.tld")
                .zone("de-fra1")
                .plan("1xCPU-1GB")
                .template(ServerTemplateArgs.builder()
                    .storage("Ubuntu Server 24.04 LTS (Noble Numbat)")
                    .build())
                .networkInterfaces(ServerNetworkInterfaceArgs.builder()
                    .type("private")
                    .network(example.id())
                    .build())
                .build());
    
            var exampleFirewallRuleset = new FirewallRuleset("exampleFirewallRuleset", FirewallRulesetArgs.builder()
                .name("example-private-ruleset")
                .description("Private SDN ruleset")
                .rules(FirewallRulesetRuleArgs.builder()
                    .action("accept")
                    .direction("in")
                    .family("IPv4")
                    .protocol("tcp")
                    .comment("Allow SSH")
                    .destinationPortStart(22)
                    .destinationPortEnd(22)
                    .build())
                .build());
    
            var exampleServerPrivateFirewallRuleset = new ServerPrivateFirewallRuleset("exampleServerPrivateFirewallRuleset", ServerPrivateFirewallRulesetArgs.builder()
                .serverId(exampleServer.id())
                .rulesetId(exampleFirewallRuleset.id())
                .build());
    
        }
    }
    
    resources:
      # Attach an SDN private firewall ruleset to a server
      example:
        type: upcloud:Network
        properties:
          name: terraform-example-private-network
          zone: de-fra1
          ipNetwork:
            address: 172.24.1.0/24
            dhcp: true
            family: IPv4
      exampleServer:
        type: upcloud:Server
        name: example
        properties:
          hostname: terraform.example.tld
          zone: de-fra1
          plan: 1xCPU-1GB
          template:
            storage: Ubuntu Server 24.04 LTS (Noble Numbat)
          networkInterfaces:
            - type: private
              network: ${example.id}
      exampleFirewallRuleset:
        type: upcloud:FirewallRuleset
        name: example
        properties:
          name: example-private-ruleset
          description: Private SDN ruleset
          rules:
            - action: accept
              direction: in
              family: IPv4
              protocol: tcp
              comment: Allow SSH
              destinationPortStart: 22
              destinationPortEnd: 22
      exampleServerPrivateFirewallRuleset:
        type: upcloud:ServerPrivateFirewallRuleset
        name: example
        properties:
          serverId: ${exampleServer.id}
          rulesetId: ${exampleFirewallRuleset.id}
    
    Example coming soon!
    

    Create ServerPrivateFirewallRuleset Resource

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

    Constructor syntax

    new ServerPrivateFirewallRuleset(name: string, args: ServerPrivateFirewallRulesetArgs, opts?: CustomResourceOptions);
    @overload
    def ServerPrivateFirewallRuleset(resource_name: str,
                                     args: ServerPrivateFirewallRulesetArgs,
                                     opts: Optional[ResourceOptions] = None)
    
    @overload
    def ServerPrivateFirewallRuleset(resource_name: str,
                                     opts: Optional[ResourceOptions] = None,
                                     ruleset_id: Optional[str] = None,
                                     server_id: Optional[str] = None)
    func NewServerPrivateFirewallRuleset(ctx *Context, name string, args ServerPrivateFirewallRulesetArgs, opts ...ResourceOption) (*ServerPrivateFirewallRuleset, error)
    public ServerPrivateFirewallRuleset(string name, ServerPrivateFirewallRulesetArgs args, CustomResourceOptions? opts = null)
    public ServerPrivateFirewallRuleset(String name, ServerPrivateFirewallRulesetArgs args)
    public ServerPrivateFirewallRuleset(String name, ServerPrivateFirewallRulesetArgs args, CustomResourceOptions options)
    
    type: upcloud:ServerPrivateFirewallRuleset
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    resource "upcloud_server_private_firewall_ruleset" "name" {
        # resource properties
    }

    Parameters

    name string
    The unique name of the resource.
    args ServerPrivateFirewallRulesetArgs
    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 ServerPrivateFirewallRulesetArgs
    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 ServerPrivateFirewallRulesetArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ServerPrivateFirewallRulesetArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ServerPrivateFirewallRulesetArgs
    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 serverPrivateFirewallRulesetResource = new UpCloud.ServerPrivateFirewallRuleset("serverPrivateFirewallRulesetResource", new()
    {
        RulesetId = "string",
        ServerId = "string",
    });
    
    example, err := upcloud.NewServerPrivateFirewallRuleset(ctx, "serverPrivateFirewallRulesetResource", &upcloud.ServerPrivateFirewallRulesetArgs{
    	RulesetId: pulumi.String("string"),
    	ServerId:  pulumi.String("string"),
    })
    
    resource "upcloud_server_private_firewall_ruleset" "serverPrivateFirewallRulesetResource" {
      lifecycle {
        create_before_destroy = true
      }
      ruleset_id = "string"
      server_id  = "string"
    }
    
    var serverPrivateFirewallRulesetResource = new ServerPrivateFirewallRuleset("serverPrivateFirewallRulesetResource", ServerPrivateFirewallRulesetArgs.builder()
        .rulesetId("string")
        .serverId("string")
        .build());
    
    server_private_firewall_ruleset_resource = upcloud.ServerPrivateFirewallRuleset("serverPrivateFirewallRulesetResource",
        ruleset_id="string",
        server_id="string")
    
    const serverPrivateFirewallRulesetResource = new upcloud.ServerPrivateFirewallRuleset("serverPrivateFirewallRulesetResource", {
        rulesetId: "string",
        serverId: "string",
    });
    
    type: upcloud:ServerPrivateFirewallRuleset
    properties:
        rulesetId: string
        serverId: string
    

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

    RulesetId string
    The UUID of the firewall ruleset to attach.
    ServerId string
    The UUID of the server to attach the firewall ruleset to.
    RulesetId string
    The UUID of the firewall ruleset to attach.
    ServerId string
    The UUID of the server to attach the firewall ruleset to.
    ruleset_id string
    The UUID of the firewall ruleset to attach.
    server_id string
    The UUID of the server to attach the firewall ruleset to.
    rulesetId String
    The UUID of the firewall ruleset to attach.
    serverId String
    The UUID of the server to attach the firewall ruleset to.
    rulesetId string
    The UUID of the firewall ruleset to attach.
    serverId string
    The UUID of the server to attach the firewall ruleset to.
    ruleset_id str
    The UUID of the firewall ruleset to attach.
    server_id str
    The UUID of the server to attach the firewall ruleset to.
    rulesetId String
    The UUID of the firewall ruleset to attach.
    serverId String
    The UUID of the server to attach the firewall ruleset to.

    Outputs

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

    Get an existing ServerPrivateFirewallRuleset 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?: ServerPrivateFirewallRulesetState, opts?: CustomResourceOptions): ServerPrivateFirewallRuleset
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            ruleset_id: Optional[str] = None,
            server_id: Optional[str] = None) -> ServerPrivateFirewallRuleset
    func GetServerPrivateFirewallRuleset(ctx *Context, name string, id IDInput, state *ServerPrivateFirewallRulesetState, opts ...ResourceOption) (*ServerPrivateFirewallRuleset, error)
    public static ServerPrivateFirewallRuleset Get(string name, Input<string> id, ServerPrivateFirewallRulesetState? state, CustomResourceOptions? opts = null)
    public static ServerPrivateFirewallRuleset get(String name, Output<String> id, ServerPrivateFirewallRulesetState state, CustomResourceOptions options)
    resources:  _:    type: upcloud:ServerPrivateFirewallRuleset    get:      id: ${id}
    import {
      to = upcloud_server_private_firewall_ruleset.example
      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:
    RulesetId string
    The UUID of the firewall ruleset to attach.
    ServerId string
    The UUID of the server to attach the firewall ruleset to.
    RulesetId string
    The UUID of the firewall ruleset to attach.
    ServerId string
    The UUID of the server to attach the firewall ruleset to.
    ruleset_id string
    The UUID of the firewall ruleset to attach.
    server_id string
    The UUID of the server to attach the firewall ruleset to.
    rulesetId String
    The UUID of the firewall ruleset to attach.
    serverId String
    The UUID of the server to attach the firewall ruleset to.
    rulesetId string
    The UUID of the firewall ruleset to attach.
    serverId string
    The UUID of the server to attach the firewall ruleset to.
    ruleset_id str
    The UUID of the firewall ruleset to attach.
    server_id str
    The UUID of the server to attach the firewall ruleset to.
    rulesetId String
    The UUID of the firewall ruleset to attach.
    serverId String
    The UUID of the server to attach the firewall ruleset to.

    Import

    The pulumi import command can be used, for example:

    Import an existing server private firewall ruleset attachment using composite ID: {server_uuid}/{ruleset_uuid}

    $ pulumi import upcloud:index/serverPrivateFirewallRuleset:ServerPrivateFirewallRuleset example 00b52f84-24e8-4bd0-a5da-11404b99c4f8/19b2ebad-cf02-48af-88d2-9f1bde7fde41
    

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

    Package Details

    Repository
    upcloud UpCloudLtd/pulumi-upcloud
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the upcloud Terraform Provider.
    upcloud logo UpCloud
    Viewing docs for UpCloud v0.22.0
    published on Tuesday, Oct 13, 2026 by UpCloudLtd

      Try Pulumi Cloud free.
      Your team will thank you.

      Start free trial