1. Packages
  2. Digitalocean Provider
  3. API Docs
  4. DatabaseFirewall
DigitalOcean v4.34.0 published on Monday, Oct 21, 2024 by Pulumi

digitalocean.DatabaseFirewall

Explore with Pulumi AI

digitalocean logo
DigitalOcean v4.34.0 published on Monday, Oct 21, 2024 by Pulumi

    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

    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",
            },
        ],
    });
    
    import pulumi
    import pulumi_digitalocean as digitalocean
    
    postgres_example = digitalocean.DatabaseCluster("postgres-example",
        name="example-postgres-cluster",
        engine="pg",
        version="15",
        size=digitalocean.DatabaseSlug.D_B_1_VPCU1_GB,
        region=digitalocean.Region.NYC1,
        node_count=1)
    example_fw = digitalocean.DatabaseFirewall("example-fw",
        cluster_id=postgres_example.id,
        rules=[
            {
                "type": "ip_addr",
                "value": "192.168.1.1",
            },
            {
                "type": "ip_addr",
                "value": "192.0.2.0",
            },
        ])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-digitalocean/sdk/v4/go/digitalocean"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := digitalocean.NewDatabaseCluster(ctx, "postgres-example", &digitalocean.DatabaseClusterArgs{
    			Name:      pulumi.String("example-postgres-cluster"),
    			Engine:    pulumi.String("pg"),
    			Version:   pulumi.String("15"),
    			Size:      pulumi.String(digitalocean.DatabaseSlug_DB_1VPCU1GB),
    			Region:    pulumi.String(digitalocean.RegionNYC1),
    			NodeCount: pulumi.Int(1),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = digitalocean.NewDatabaseFirewall(ctx, "example-fw", &digitalocean.DatabaseFirewallArgs{
    			ClusterId: postgres_example.ID(),
    			Rules: digitalocean.DatabaseFirewallRuleArray{
    				&digitalocean.DatabaseFirewallRuleArgs{
    					Type:  pulumi.String("ip_addr"),
    					Value: pulumi.String("192.168.1.1"),
    				},
    				&digitalocean.DatabaseFirewallRuleArgs{
    					Type:  pulumi.String("ip_addr"),
    					Value: pulumi.String("192.0.2.0"),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using DigitalOcean = Pulumi.DigitalOcean;
    
    return await Deployment.RunAsync(() => 
    {
        var postgres_example = new DigitalOcean.DatabaseCluster("postgres-example", new()
        {
            Name = "example-postgres-cluster",
            Engine = "pg",
            Version = "15",
            Size = DigitalOcean.DatabaseSlug.DB_1VPCU1GB,
            Region = DigitalOcean.Region.NYC1,
            NodeCount = 1,
        });
    
        var example_fw = new DigitalOcean.DatabaseFirewall("example-fw", new()
        {
            ClusterId = postgres_example.Id,
            Rules = new[]
            {
                new DigitalOcean.Inputs.DatabaseFirewallRuleArgs
                {
                    Type = "ip_addr",
                    Value = "192.168.1.1",
                },
                new DigitalOcean.Inputs.DatabaseFirewallRuleArgs
                {
                    Type = "ip_addr",
                    Value = "192.0.2.0",
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.digitalocean.DatabaseCluster;
    import com.pulumi.digitalocean.DatabaseClusterArgs;
    import com.pulumi.digitalocean.DatabaseFirewall;
    import com.pulumi.digitalocean.DatabaseFirewallArgs;
    import com.pulumi.digitalocean.inputs.DatabaseFirewallRuleArgs;
    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 postgres_example = new DatabaseCluster("postgres-example", DatabaseClusterArgs.builder()
                .name("example-postgres-cluster")
                .engine("pg")
                .version("15")
                .size("db-s-1vcpu-1gb")
                .region("nyc1")
                .nodeCount(1)
                .build());
    
            var example_fw = new DatabaseFirewall("example-fw", DatabaseFirewallArgs.builder()
                .clusterId(postgres_example.id())
                .rules(            
                    DatabaseFirewallRuleArgs.builder()
                        .type("ip_addr")
                        .value("192.168.1.1")
                        .build(),
                    DatabaseFirewallRuleArgs.builder()
                        .type("ip_addr")
                        .value("192.0.2.0")
                        .build())
                .build());
    
        }
    }
    
    resources:
      example-fw:
        type: digitalocean:DatabaseFirewall
        properties:
          clusterId: ${["postgres-example"].id}
          rules:
            - type: ip_addr
              value: 192.168.1.1
            - type: ip_addr
              value: 192.0.2.0
      postgres-example:
        type: digitalocean:DatabaseCluster
        properties:
          name: example-postgres-cluster
          engine: pg
          version: '15'
          size: db-s-1vcpu-1gb
          region: nyc1
          nodeCount: 1
    

    Create a new database firewall allowing a Droplet

    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,
        }],
    });
    
    import pulumi
    import pulumi_digitalocean as digitalocean
    
    web = digitalocean.Droplet("web",
        name="web-01",
        size=digitalocean.DropletSlug.DROPLET_S1_VCPU1_GB,
        image="ubuntu-22-04-x64",
        region=digitalocean.Region.NYC3)
    postgres_example = digitalocean.DatabaseCluster("postgres-example",
        name="example-postgres-cluster",
        engine="pg",
        version="15",
        size=digitalocean.DatabaseSlug.D_B_1_VPCU1_GB,
        region=digitalocean.Region.NYC1,
        node_count=1)
    example_fw = digitalocean.DatabaseFirewall("example-fw",
        cluster_id=postgres_example.id,
        rules=[{
            "type": "droplet",
            "value": web.id,
        }])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-digitalocean/sdk/v4/go/digitalocean"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		web, err := digitalocean.NewDroplet(ctx, "web", &digitalocean.DropletArgs{
    			Name:   pulumi.String("web-01"),
    			Size:   pulumi.String(digitalocean.DropletSlugDropletS1VCPU1GB),
    			Image:  pulumi.String("ubuntu-22-04-x64"),
    			Region: pulumi.String(digitalocean.RegionNYC3),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = digitalocean.NewDatabaseCluster(ctx, "postgres-example", &digitalocean.DatabaseClusterArgs{
    			Name:      pulumi.String("example-postgres-cluster"),
    			Engine:    pulumi.String("pg"),
    			Version:   pulumi.String("15"),
    			Size:      pulumi.String(digitalocean.DatabaseSlug_DB_1VPCU1GB),
    			Region:    pulumi.String(digitalocean.RegionNYC1),
    			NodeCount: pulumi.Int(1),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = digitalocean.NewDatabaseFirewall(ctx, "example-fw", &digitalocean.DatabaseFirewallArgs{
    			ClusterId: postgres_example.ID(),
    			Rules: digitalocean.DatabaseFirewallRuleArray{
    				&digitalocean.DatabaseFirewallRuleArgs{
    					Type:  pulumi.String("droplet"),
    					Value: web.ID(),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using DigitalOcean = Pulumi.DigitalOcean;
    
    return await Deployment.RunAsync(() => 
    {
        var web = new DigitalOcean.Droplet("web", new()
        {
            Name = "web-01",
            Size = DigitalOcean.DropletSlug.DropletS1VCPU1GB,
            Image = "ubuntu-22-04-x64",
            Region = DigitalOcean.Region.NYC3,
        });
    
        var postgres_example = new DigitalOcean.DatabaseCluster("postgres-example", new()
        {
            Name = "example-postgres-cluster",
            Engine = "pg",
            Version = "15",
            Size = DigitalOcean.DatabaseSlug.DB_1VPCU1GB,
            Region = DigitalOcean.Region.NYC1,
            NodeCount = 1,
        });
    
        var example_fw = new DigitalOcean.DatabaseFirewall("example-fw", new()
        {
            ClusterId = postgres_example.Id,
            Rules = new[]
            {
                new DigitalOcean.Inputs.DatabaseFirewallRuleArgs
                {
                    Type = "droplet",
                    Value = web.Id,
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.digitalocean.Droplet;
    import com.pulumi.digitalocean.DropletArgs;
    import com.pulumi.digitalocean.DatabaseCluster;
    import com.pulumi.digitalocean.DatabaseClusterArgs;
    import com.pulumi.digitalocean.DatabaseFirewall;
    import com.pulumi.digitalocean.DatabaseFirewallArgs;
    import com.pulumi.digitalocean.inputs.DatabaseFirewallRuleArgs;
    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 web = new Droplet("web", DropletArgs.builder()
                .name("web-01")
                .size("s-1vcpu-1gb")
                .image("ubuntu-22-04-x64")
                .region("nyc3")
                .build());
    
            var postgres_example = new DatabaseCluster("postgres-example", DatabaseClusterArgs.builder()
                .name("example-postgres-cluster")
                .engine("pg")
                .version("15")
                .size("db-s-1vcpu-1gb")
                .region("nyc1")
                .nodeCount(1)
                .build());
    
            var example_fw = new DatabaseFirewall("example-fw", DatabaseFirewallArgs.builder()
                .clusterId(postgres_example.id())
                .rules(DatabaseFirewallRuleArgs.builder()
                    .type("droplet")
                    .value(web.id())
                    .build())
                .build());
    
        }
    }
    
    resources:
      example-fw:
        type: digitalocean:DatabaseFirewall
        properties:
          clusterId: ${["postgres-example"].id}
          rules:
            - type: droplet
              value: ${web.id}
      web:
        type: digitalocean:Droplet
        properties:
          name: web-01
          size: s-1vcpu-1gb
          image: ubuntu-22-04-x64
          region: nyc3
      postgres-example:
        type: digitalocean:DatabaseCluster
        properties:
          name: example-postgres-cluster
          engine: pg
          version: '15'
          size: db-s-1vcpu-1gb
          region: nyc1
          nodeCount: 1
    

    Create a new database firewall for a database replica

    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 pulumi
    import pulumi_digitalocean as digitalocean
    
    postgres_example = digitalocean.DatabaseCluster("postgres-example",
        name="example-postgres-cluster",
        engine="pg",
        version="15",
        size=digitalocean.DatabaseSlug.D_B_1_VPCU1_GB,
        region=digitalocean.Region.NYC1,
        node_count=1)
    replica_example = digitalocean.DatabaseReplica("replica-example",
        cluster_id=postgres_example.id,
        name="replica-example",
        size=digitalocean.DatabaseSlug.D_B_1_VPCU1_GB,
        region=digitalocean.Region.NYC1)
    # Create firewall rule for database replica
    example_fw = digitalocean.DatabaseFirewall("example-fw",
        cluster_id=replica_example.uuid,
        rules=[{
            "type": "ip_addr",
            "value": "192.168.1.1",
        }])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-digitalocean/sdk/v4/go/digitalocean"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := digitalocean.NewDatabaseCluster(ctx, "postgres-example", &digitalocean.DatabaseClusterArgs{
    			Name:      pulumi.String("example-postgres-cluster"),
    			Engine:    pulumi.String("pg"),
    			Version:   pulumi.String("15"),
    			Size:      pulumi.String(digitalocean.DatabaseSlug_DB_1VPCU1GB),
    			Region:    pulumi.String(digitalocean.RegionNYC1),
    			NodeCount: pulumi.Int(1),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = digitalocean.NewDatabaseReplica(ctx, "replica-example", &digitalocean.DatabaseReplicaArgs{
    			ClusterId: postgres_example.ID(),
    			Name:      pulumi.String("replica-example"),
    			Size:      pulumi.String(digitalocean.DatabaseSlug_DB_1VPCU1GB),
    			Region:    pulumi.String(digitalocean.RegionNYC1),
    		})
    		if err != nil {
    			return err
    		}
    		// Create firewall rule for database replica
    		_, err = digitalocean.NewDatabaseFirewall(ctx, "example-fw", &digitalocean.DatabaseFirewallArgs{
    			ClusterId: replica_example.Uuid,
    			Rules: digitalocean.DatabaseFirewallRuleArray{
    				&digitalocean.DatabaseFirewallRuleArgs{
    					Type:  pulumi.String("ip_addr"),
    					Value: pulumi.String("192.168.1.1"),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using DigitalOcean = Pulumi.DigitalOcean;
    
    return await Deployment.RunAsync(() => 
    {
        var postgres_example = new DigitalOcean.DatabaseCluster("postgres-example", new()
        {
            Name = "example-postgres-cluster",
            Engine = "pg",
            Version = "15",
            Size = DigitalOcean.DatabaseSlug.DB_1VPCU1GB,
            Region = DigitalOcean.Region.NYC1,
            NodeCount = 1,
        });
    
        var replica_example = new DigitalOcean.DatabaseReplica("replica-example", new()
        {
            ClusterId = postgres_example.Id,
            Name = "replica-example",
            Size = DigitalOcean.DatabaseSlug.DB_1VPCU1GB,
            Region = DigitalOcean.Region.NYC1,
        });
    
        // Create firewall rule for database replica
        var example_fw = new DigitalOcean.DatabaseFirewall("example-fw", new()
        {
            ClusterId = replica_example.Uuid,
            Rules = new[]
            {
                new DigitalOcean.Inputs.DatabaseFirewallRuleArgs
                {
                    Type = "ip_addr",
                    Value = "192.168.1.1",
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.digitalocean.DatabaseCluster;
    import com.pulumi.digitalocean.DatabaseClusterArgs;
    import com.pulumi.digitalocean.DatabaseReplica;
    import com.pulumi.digitalocean.DatabaseReplicaArgs;
    import com.pulumi.digitalocean.DatabaseFirewall;
    import com.pulumi.digitalocean.DatabaseFirewallArgs;
    import com.pulumi.digitalocean.inputs.DatabaseFirewallRuleArgs;
    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 postgres_example = new DatabaseCluster("postgres-example", DatabaseClusterArgs.builder()
                .name("example-postgres-cluster")
                .engine("pg")
                .version("15")
                .size("db-s-1vcpu-1gb")
                .region("nyc1")
                .nodeCount(1)
                .build());
    
            var replica_example = new DatabaseReplica("replica-example", DatabaseReplicaArgs.builder()
                .clusterId(postgres_example.id())
                .name("replica-example")
                .size("db-s-1vcpu-1gb")
                .region("nyc1")
                .build());
    
            // Create firewall rule for database replica
            var example_fw = new DatabaseFirewall("example-fw", DatabaseFirewallArgs.builder()
                .clusterId(replica_example.uuid())
                .rules(DatabaseFirewallRuleArgs.builder()
                    .type("ip_addr")
                    .value("192.168.1.1")
                    .build())
                .build());
    
        }
    }
    
    resources:
      postgres-example:
        type: digitalocean:DatabaseCluster
        properties:
          name: example-postgres-cluster
          engine: pg
          version: '15'
          size: db-s-1vcpu-1gb
          region: nyc1
          nodeCount: 1
      replica-example:
        type: digitalocean:DatabaseReplica
        properties:
          clusterId: ${["postgres-example"].id}
          name: replica-example
          size: db-s-1vcpu-1gb
          region: nyc1
      # Create firewall rule for database replica
      example-fw:
        type: digitalocean:DatabaseFirewall
        properties:
          clusterId: ${["replica-example"].uuid}
          rules:
            - type: ip_addr
              value: 192.168.1.1
    

    Create DatabaseFirewall Resource

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

    Constructor syntax

    new DatabaseFirewall(name: string, args: DatabaseFirewallArgs, opts?: CustomResourceOptions);
    @overload
    def DatabaseFirewall(resource_name: str,
                         args: DatabaseFirewallArgs,
                         opts: Optional[ResourceOptions] = None)
    
    @overload
    def DatabaseFirewall(resource_name: str,
                         opts: Optional[ResourceOptions] = None,
                         cluster_id: Optional[str] = None,
                         rules: Optional[Sequence[DatabaseFirewallRuleArgs]] = None)
    func NewDatabaseFirewall(ctx *Context, name string, args DatabaseFirewallArgs, opts ...ResourceOption) (*DatabaseFirewall, error)
    public DatabaseFirewall(string name, DatabaseFirewallArgs args, CustomResourceOptions? opts = null)
    public DatabaseFirewall(String name, DatabaseFirewallArgs args)
    public DatabaseFirewall(String name, DatabaseFirewallArgs args, CustomResourceOptions options)
    
    type: digitalocean:DatabaseFirewall
    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 DatabaseFirewallArgs
    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 DatabaseFirewallArgs
    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 DatabaseFirewallArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args DatabaseFirewallArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args DatabaseFirewallArgs
    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 databaseFirewallResource = new DigitalOcean.DatabaseFirewall("databaseFirewallResource", new()
    {
        ClusterId = "string",
        Rules = new[]
        {
            new DigitalOcean.Inputs.DatabaseFirewallRuleArgs
            {
                Type = "string",
                Value = "string",
                CreatedAt = "string",
                Uuid = "string",
            },
        },
    });
    
    example, err := digitalocean.NewDatabaseFirewall(ctx, "databaseFirewallResource", &digitalocean.DatabaseFirewallArgs{
    	ClusterId: pulumi.String("string"),
    	Rules: digitalocean.DatabaseFirewallRuleArray{
    		&digitalocean.DatabaseFirewallRuleArgs{
    			Type:      pulumi.String("string"),
    			Value:     pulumi.String("string"),
    			CreatedAt: pulumi.String("string"),
    			Uuid:      pulumi.String("string"),
    		},
    	},
    })
    
    var databaseFirewallResource = new DatabaseFirewall("databaseFirewallResource", DatabaseFirewallArgs.builder()
        .clusterId("string")
        .rules(DatabaseFirewallRuleArgs.builder()
            .type("string")
            .value("string")
            .createdAt("string")
            .uuid("string")
            .build())
        .build());
    
    database_firewall_resource = digitalocean.DatabaseFirewall("databaseFirewallResource",
        cluster_id="string",
        rules=[{
            "type": "string",
            "value": "string",
            "created_at": "string",
            "uuid": "string",
        }])
    
    const databaseFirewallResource = new digitalocean.DatabaseFirewall("databaseFirewallResource", {
        clusterId: "string",
        rules: [{
            type: "string",
            value: "string",
            createdAt: "string",
            uuid: "string",
        }],
    });
    
    type: digitalocean:DatabaseFirewall
    properties:
        clusterId: string
        rules:
            - createdAt: string
              type: string
              uuid: string
              value: string
    

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

    ClusterId string
    The ID of the target database cluster.
    Rules List<Pulumi.DigitalOcean.Inputs.DatabaseFirewallRule>
    A rule specifying a resource allowed to access the database cluster. The following arguments must be specified:
    ClusterId string
    The ID of the target database cluster.
    Rules []DatabaseFirewallRuleArgs
    A rule specifying a resource allowed to access the database cluster. The following arguments must be specified:
    clusterId String
    The ID of the target database cluster.
    rules List<DatabaseFirewallRule>
    A rule specifying a resource allowed to access the database cluster. The following arguments must be specified:
    clusterId string
    The ID of the target database cluster.
    rules DatabaseFirewallRule[]
    A rule specifying a resource allowed to access the database cluster. The following arguments must be specified:
    cluster_id str
    The ID of the target database cluster.
    rules Sequence[DatabaseFirewallRuleArgs]
    A rule specifying a resource allowed to access the database cluster. The following arguments must be specified:
    clusterId String
    The ID of the target database cluster.
    rules List<Property Map>
    A rule specifying a resource allowed to access the database cluster. The following arguments must be specified:

    Outputs

    All input properties are implicitly available as output properties. Additionally, the DatabaseFirewall 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 str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing DatabaseFirewall Resource

    Get an existing DatabaseFirewall 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?: DatabaseFirewallState, opts?: CustomResourceOptions): DatabaseFirewall
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            cluster_id: Optional[str] = None,
            rules: Optional[Sequence[DatabaseFirewallRuleArgs]] = None) -> DatabaseFirewall
    func GetDatabaseFirewall(ctx *Context, name string, id IDInput, state *DatabaseFirewallState, opts ...ResourceOption) (*DatabaseFirewall, error)
    public static DatabaseFirewall Get(string name, Input<string> id, DatabaseFirewallState? state, CustomResourceOptions? opts = null)
    public static DatabaseFirewall get(String name, Output<String> id, DatabaseFirewallState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    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:
    ClusterId string
    The ID of the target database cluster.
    Rules List<Pulumi.DigitalOcean.Inputs.DatabaseFirewallRule>
    A rule specifying a resource allowed to access the database cluster. The following arguments must be specified:
    ClusterId string
    The ID of the target database cluster.
    Rules []DatabaseFirewallRuleArgs
    A rule specifying a resource allowed to access the database cluster. The following arguments must be specified:
    clusterId String
    The ID of the target database cluster.
    rules List<DatabaseFirewallRule>
    A rule specifying a resource allowed to access the database cluster. The following arguments must be specified:
    clusterId string
    The ID of the target database cluster.
    rules DatabaseFirewallRule[]
    A rule specifying a resource allowed to access the database cluster. The following arguments must be specified:
    cluster_id str
    The ID of the target database cluster.
    rules Sequence[DatabaseFirewallRuleArgs]
    A rule specifying a resource allowed to access the database cluster. The following arguments must be specified:
    clusterId String
    The ID of the target database cluster.
    rules List<Property Map>
    A rule specifying a resource allowed to access the database cluster. The following arguments must be specified:

    Supporting Types

    DatabaseFirewallRule, DatabaseFirewallRuleArgs

    Type string
    The type of resource that the firewall rule allows to access the database cluster. The possible values are: droplet, k8s, ip_addr, tag, or app.
    Value string
    The ID of the specific resource, the name of a tag applied to a group of resources, or the IP address that the firewall rule allows to access the database cluster.
    CreatedAt string
    The date and time when the firewall rule was created.
    Uuid string
    A unique identifier for the firewall rule.
    Type string
    The type of resource that the firewall rule allows to access the database cluster. The possible values are: droplet, k8s, ip_addr, tag, or app.
    Value string
    The ID of the specific resource, the name of a tag applied to a group of resources, or the IP address that the firewall rule allows to access the database cluster.
    CreatedAt string
    The date and time when the firewall rule was created.
    Uuid string
    A unique identifier for the firewall rule.
    type String
    The type of resource that the firewall rule allows to access the database cluster. The possible values are: droplet, k8s, ip_addr, tag, or app.
    value String
    The ID of the specific resource, the name of a tag applied to a group of resources, or the IP address that the firewall rule allows to access the database cluster.
    createdAt String
    The date and time when the firewall rule was created.
    uuid String
    A unique identifier for the firewall rule.
    type string
    The type of resource that the firewall rule allows to access the database cluster. The possible values are: droplet, k8s, ip_addr, tag, or app.
    value string
    The ID of the specific resource, the name of a tag applied to a group of resources, or the IP address that the firewall rule allows to access the database cluster.
    createdAt string
    The date and time when the firewall rule was created.
    uuid string
    A unique identifier for the firewall rule.
    type str
    The type of resource that the firewall rule allows to access the database cluster. The possible values are: droplet, k8s, ip_addr, tag, or app.
    value str
    The ID of the specific resource, the name of a tag applied to a group of resources, or the IP address that the firewall rule allows to access the database cluster.
    created_at str
    The date and time when the firewall rule was created.
    uuid str
    A unique identifier for the firewall rule.
    type String
    The type of resource that the firewall rule allows to access the database cluster. The possible values are: droplet, k8s, ip_addr, tag, or app.
    value String
    The ID of the specific resource, the name of a tag applied to a group of resources, or the IP address that the firewall rule allows to access the database cluster.
    createdAt String
    The date and time when the firewall rule was created.
    uuid String
    A unique identifier for the firewall rule.

    Import

    Database firewalls can be imported using the id of the target database cluster

    For example:

    $ pulumi import digitalocean:index/databaseFirewall:DatabaseFirewall example-fw 5f55c6cd-863b-4907-99b8-7e09b0275d54
    

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

    Package Details

    Repository
    DigitalOcean pulumi/pulumi-digitalocean
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the digitalocean Terraform Provider.
    digitalocean logo
    DigitalOcean v4.34.0 published on Monday, Oct 21, 2024 by Pulumi