@upcloud/pulumi-upcloud
Version:
A Pulumi package for creating and managing UpCloud resources.
125 lines (124 loc) • 6.25 kB
TypeScript
import * as pulumi from "@pulumi/pulumi";
import * as inputs from "./types/input";
import * as outputs from "./types/output";
/**
* Firewall rules are used to control network access of UpCloud servers. Each server has its own firewall rules and there should be only one `upcloud.ServerFirewallRules` resource per server.
* The firewall is enabled on public and utility network interfaces.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as upcloud from "@upcloud/pulumi-upcloud";
*
* // The following example defines a server and then links the server to a single firewall rule.
* // The list of firewall rules applied to the server can be expanded by providing additional server_firewall_rules blocks.
* const example = new upcloud.Server("example", {
* firewall: true,
* hostname: "terraform.example.tld",
* zone: "de-fra1",
* plan: "1xCPU-1GB",
* template: {
* storage: "Ubuntu Server 20.04 LTS (Focal Fossa)",
* size: 25,
* },
* networkInterfaces: [{
* type: "utility",
* }],
* });
* const exampleServerFirewallRules = new upcloud.ServerFirewallRules("example", {
* serverId: example.id,
* firewallRules: [{
* action: "accept",
* comment: "Allow SSH from this network",
* destinationPortEnd: "22",
* destinationPortStart: "22",
* direction: "in",
* family: "IPv4",
* protocol: "tcp",
* sourceAddressEnd: "192.168.1.255",
* sourceAddressStart: "192.168.1.1",
* }],
* });
* ```
*
* ## Import
*
* ```sh
* $ pulumi import upcloud:index/serverFirewallRules:ServerFirewallRules my_example_rules 049d7ca2-757e-4fb1-a833-f87ee056547a
* ```
*/
export declare class ServerFirewallRules extends pulumi.CustomResource {
/**
* Get an existing ServerFirewallRules resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param state Any extra arguments used during the lookup.
* @param opts Optional settings to control the behavior of the CustomResource.
*/
static get(name: string, id: pulumi.Input<pulumi.ID>, state?: ServerFirewallRulesState, opts?: pulumi.CustomResourceOptions): ServerFirewallRules;
/**
* Returns true if the given object is an instance of ServerFirewallRules. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj: any): obj is ServerFirewallRules;
/**
* A single firewall rule. The rules are evaluated in order. The maximum number of firewall rules per server is 1000.
* Typical firewall rule should have `action`, `direction`, `protocol`, `family` and at least one
* destination/source-address/port range. A default rule can be created by providing only `action` and `direction`
* attributes. Default rule should be defined last. If used, IP address and port ranges must have both start and end values
* specified. These can be the same value if only one IP address or port number is specified. Source and destination port
* numbers can only be set if the protocol is TCP or UDP. The ICMP type may only be set if the protocol is ICMP.
*/
readonly firewallRules: pulumi.Output<outputs.ServerFirewallRulesFirewallRule[]>;
/**
* The unique id of the server to be protected the firewall rules
*/
readonly serverId: pulumi.Output<string>;
/**
* Create a ServerFirewallRules resource with the given unique name, arguments, and options.
*
* @param name The _unique_ name of the resource.
* @param args The arguments to use to populate this resource's properties.
* @param opts A bag of options that control this resource's behavior.
*/
constructor(name: string, args: ServerFirewallRulesArgs, opts?: pulumi.CustomResourceOptions);
}
/**
* Input properties used for looking up and filtering ServerFirewallRules resources.
*/
export interface ServerFirewallRulesState {
/**
* A single firewall rule. The rules are evaluated in order. The maximum number of firewall rules per server is 1000.
* Typical firewall rule should have `action`, `direction`, `protocol`, `family` and at least one
* destination/source-address/port range. A default rule can be created by providing only `action` and `direction`
* attributes. Default rule should be defined last. If used, IP address and port ranges must have both start and end values
* specified. These can be the same value if only one IP address or port number is specified. Source and destination port
* numbers can only be set if the protocol is TCP or UDP. The ICMP type may only be set if the protocol is ICMP.
*/
firewallRules?: pulumi.Input<pulumi.Input<inputs.ServerFirewallRulesFirewallRule>[]>;
/**
* The unique id of the server to be protected the firewall rules
*/
serverId?: pulumi.Input<string>;
}
/**
* The set of arguments for constructing a ServerFirewallRules resource.
*/
export interface ServerFirewallRulesArgs {
/**
* A single firewall rule. The rules are evaluated in order. The maximum number of firewall rules per server is 1000.
* Typical firewall rule should have `action`, `direction`, `protocol`, `family` and at least one
* destination/source-address/port range. A default rule can be created by providing only `action` and `direction`
* attributes. Default rule should be defined last. If used, IP address and port ranges must have both start and end values
* specified. These can be the same value if only one IP address or port number is specified. Source and destination port
* numbers can only be set if the protocol is TCP or UDP. The ICMP type may only be set if the protocol is ICMP.
*/
firewallRules: pulumi.Input<pulumi.Input<inputs.ServerFirewallRulesFirewallRule>[]>;
/**
* The unique id of the server to be protected the firewall rules
*/
serverId: pulumi.Input<string>;
}