@pulumi/digitalocean
Version:
A Pulumi package for creating and managing DigitalOcean cloud resources.
168 lines (167 loc) • 5.88 kB
TypeScript
import * as pulumi from "@pulumi/pulumi";
import * as inputs from "./types/input";
import * as outputs from "./types/output";
/**
* Provides a DigitalOcean database firewall resource allowing you to restrict
* connections to your database to trusted sources. You may limit connections to
* specific Droplets, Kubernetes clusters, or IP addresses.
*
* ## Example Usage
*
* ### Create a new database firewall allowing multiple IP addresses
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as digitalocean from "@pulumi/digitalocean";
*
* const postgres_example = new digitalocean.DatabaseCluster("postgres-example", {
* name: "example-postgres-cluster",
* engine: "pg",
* version: "15",
* size: digitalocean.DatabaseSlug.DB_1VPCU1GB,
* region: digitalocean.Region.NYC1,
* nodeCount: 1,
* });
* const example_fw = new digitalocean.DatabaseFirewall("example-fw", {
* clusterId: postgres_example.id,
* rules: [
* {
* type: "ip_addr",
* value: "192.168.1.1",
* },
* {
* type: "ip_addr",
* value: "192.0.2.0",
* },
* ],
* });
* ```
*
* ### Create a new database firewall allowing a Droplet
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as digitalocean from "@pulumi/digitalocean";
*
* const web = new digitalocean.Droplet("web", {
* name: "web-01",
* size: digitalocean.DropletSlug.DropletS1VCPU1GB,
* image: "ubuntu-22-04-x64",
* region: digitalocean.Region.NYC3,
* });
* const postgres_example = new digitalocean.DatabaseCluster("postgres-example", {
* name: "example-postgres-cluster",
* engine: "pg",
* version: "15",
* size: digitalocean.DatabaseSlug.DB_1VPCU1GB,
* region: digitalocean.Region.NYC1,
* nodeCount: 1,
* });
* const example_fw = new digitalocean.DatabaseFirewall("example-fw", {
* clusterId: postgres_example.id,
* rules: [{
* type: "droplet",
* value: web.id,
* }],
* });
* ```
*
* ### Create a new database firewall for a database replica
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as digitalocean from "@pulumi/digitalocean";
*
* const postgres_example = new digitalocean.DatabaseCluster("postgres-example", {
* name: "example-postgres-cluster",
* engine: "pg",
* version: "15",
* size: digitalocean.DatabaseSlug.DB_1VPCU1GB,
* region: digitalocean.Region.NYC1,
* nodeCount: 1,
* });
* const replica_example = new digitalocean.DatabaseReplica("replica-example", {
* clusterId: postgres_example.id,
* name: "replica-example",
* size: digitalocean.DatabaseSlug.DB_1VPCU1GB,
* region: digitalocean.Region.NYC1,
* });
* // Create firewall rule for database replica
* const example_fw = new digitalocean.DatabaseFirewall("example-fw", {
* clusterId: replica_example.uuid,
* rules: [{
* type: "ip_addr",
* value: "192.168.1.1",
* }],
* });
* ```
*
* ## Import
*
* Database firewalls can be imported using the `id` of the target database cluster
*
* For example:
*
* ```sh
* $ pulumi import digitalocean:index/databaseFirewall:DatabaseFirewall example-fw 5f55c6cd-863b-4907-99b8-7e09b0275d54
* ```
*/
export declare class DatabaseFirewall extends pulumi.CustomResource {
/**
* Get an existing DatabaseFirewall 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?: DatabaseFirewallState, opts?: pulumi.CustomResourceOptions): DatabaseFirewall;
/**
* Returns true if the given object is an instance of DatabaseFirewall. 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 DatabaseFirewall;
/**
* The ID of the target database cluster.
*/
readonly clusterId: pulumi.Output<string>;
/**
* A rule specifying a resource allowed to access the database cluster. The following arguments must be specified:
*/
readonly rules: pulumi.Output<outputs.DatabaseFirewallRule[]>;
/**
* Create a DatabaseFirewall 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: DatabaseFirewallArgs, opts?: pulumi.CustomResourceOptions);
}
/**
* Input properties used for looking up and filtering DatabaseFirewall resources.
*/
export interface DatabaseFirewallState {
/**
* The ID of the target database cluster.
*/
clusterId?: pulumi.Input<string>;
/**
* A rule specifying a resource allowed to access the database cluster. The following arguments must be specified:
*/
rules?: pulumi.Input<pulumi.Input<inputs.DatabaseFirewallRule>[]>;
}
/**
* The set of arguments for constructing a DatabaseFirewall resource.
*/
export interface DatabaseFirewallArgs {
/**
* The ID of the target database cluster.
*/
clusterId: pulumi.Input<string>;
/**
* A rule specifying a resource allowed to access the database cluster. The following arguments must be specified:
*/
rules: pulumi.Input<pulumi.Input<inputs.DatabaseFirewallRule>[]>;
}