@upcloud/pulumi-upcloud
Version:
A Pulumi package for creating and managing UpCloud resources.
106 lines • 4.16 kB
JavaScript
;
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.ServerFirewallRules = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* 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",
* metadata: true,
* login: {
* passwordDelivery: "none",
* },
* template: {
* storage: "Ubuntu Server 24.04 LTS (Noble Numbat)",
* },
* 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
*
* The `pulumi import` command can be used, for example:
*
* ```sh
* $ pulumi import upcloud:index/serverFirewallRules:ServerFirewallRules my_example_rules 049d7ca2-757e-4fb1-a833-f87ee056547a
* ```
*/
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, id, state, opts) {
return new ServerFirewallRules(name, state, { ...opts, id: id });
}
/**
* 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) {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === ServerFirewallRules.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["firewallRules"] = state?.firewallRules;
resourceInputs["serverId"] = state?.serverId;
}
else {
const args = argsOrState;
if (args?.serverId === undefined && !opts.urn) {
throw new Error("Missing required property 'serverId'");
}
resourceInputs["firewallRules"] = args?.firewallRules;
resourceInputs["serverId"] = args?.serverId;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(ServerFirewallRules.__pulumiType, name, resourceInputs, opts);
}
}
exports.ServerFirewallRules = ServerFirewallRules;
/** @internal */
ServerFirewallRules.__pulumiType = 'upcloud:index/serverFirewallRules:ServerFirewallRules';
//# sourceMappingURL=serverFirewallRules.js.map