1. Packages
  2. DigitalOcean Provider
  3. API Docs
  4. getFirewall
DigitalOcean v4.41.0 published on Wednesday, Mar 26, 2025 by Pulumi

digitalocean.getFirewall

Explore with Pulumi AI

DigitalOcean v4.41.0 published on Wednesday, Mar 26, 2025 by Pulumi

Get information on a DigitalOcean Firewall.

Example Usage

Get the firewall:

import * as pulumi from "@pulumi/pulumi";
import * as digitalocean from "@pulumi/digitalocean";

const example = digitalocean.getFirewall({
    firewallId: "1df48973-6eef-4214-854f-fa7726e7e583",
});
export const exampleFirewallName = example.then(example => example.name);
Copy
import pulumi
import pulumi_digitalocean as digitalocean

example = digitalocean.get_firewall(firewall_id="1df48973-6eef-4214-854f-fa7726e7e583")
pulumi.export("exampleFirewallName", example.name)
Copy
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 {
		example, err := digitalocean.LookupFirewall(ctx, &digitalocean.LookupFirewallArgs{
			FirewallId: "1df48973-6eef-4214-854f-fa7726e7e583",
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("exampleFirewallName", example.Name)
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using DigitalOcean = Pulumi.DigitalOcean;

return await Deployment.RunAsync(() => 
{
    var example = DigitalOcean.GetFirewall.Invoke(new()
    {
        FirewallId = "1df48973-6eef-4214-854f-fa7726e7e583",
    });

    return new Dictionary<string, object?>
    {
        ["exampleFirewallName"] = example.Apply(getFirewallResult => getFirewallResult.Name),
    };
});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.digitalocean.DigitaloceanFunctions;
import com.pulumi.digitalocean.inputs.GetFirewallArgs;
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) {
        final var example = DigitaloceanFunctions.getFirewall(GetFirewallArgs.builder()
            .firewallId("1df48973-6eef-4214-854f-fa7726e7e583")
            .build());

        ctx.export("exampleFirewallName", example.applyValue(getFirewallResult -> getFirewallResult.name()));
    }
}
Copy
variables:
  example:
    fn::invoke:
      function: digitalocean:getFirewall
      arguments:
        firewallId: 1df48973-6eef-4214-854f-fa7726e7e583
outputs:
  exampleFirewallName: ${example.name}
Copy

Using getFirewall

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

function getFirewall(args: GetFirewallArgs, opts?: InvokeOptions): Promise<GetFirewallResult>
function getFirewallOutput(args: GetFirewallOutputArgs, opts?: InvokeOptions): Output<GetFirewallResult>
Copy
def get_firewall(droplet_ids: Optional[Sequence[int]] = None,
                 firewall_id: Optional[str] = None,
                 inbound_rules: Optional[Sequence[GetFirewallInboundRule]] = None,
                 outbound_rules: Optional[Sequence[GetFirewallOutboundRule]] = None,
                 tags: Optional[Sequence[str]] = None,
                 opts: Optional[InvokeOptions] = None) -> GetFirewallResult
def get_firewall_output(droplet_ids: Optional[pulumi.Input[Sequence[pulumi.Input[int]]]] = None,
                 firewall_id: Optional[pulumi.Input[str]] = None,
                 inbound_rules: Optional[pulumi.Input[Sequence[pulumi.Input[GetFirewallInboundRuleArgs]]]] = None,
                 outbound_rules: Optional[pulumi.Input[Sequence[pulumi.Input[GetFirewallOutboundRuleArgs]]]] = None,
                 tags: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                 opts: Optional[InvokeOptions] = None) -> Output[GetFirewallResult]
Copy
func LookupFirewall(ctx *Context, args *LookupFirewallArgs, opts ...InvokeOption) (*LookupFirewallResult, error)
func LookupFirewallOutput(ctx *Context, args *LookupFirewallOutputArgs, opts ...InvokeOption) LookupFirewallResultOutput
Copy

> Note: This function is named LookupFirewall in the Go SDK.

public static class GetFirewall 
{
    public static Task<GetFirewallResult> InvokeAsync(GetFirewallArgs args, InvokeOptions? opts = null)
    public static Output<GetFirewallResult> Invoke(GetFirewallInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetFirewallResult> getFirewall(GetFirewallArgs args, InvokeOptions options)
public static Output<GetFirewallResult> getFirewall(GetFirewallArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: digitalocean:index/getFirewall:getFirewall
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

FirewallId This property is required. string
The ID of the firewall to retrieve information about.
DropletIds List<int>
The list of the IDs of the Droplets assigned to the Firewall.
InboundRules List<Pulumi.DigitalOcean.Inputs.GetFirewallInboundRule>
OutboundRules List<Pulumi.DigitalOcean.Inputs.GetFirewallOutboundRule>
Tags List<string>
The names of the Tags assigned to the Firewall.
FirewallId This property is required. string
The ID of the firewall to retrieve information about.
DropletIds []int
The list of the IDs of the Droplets assigned to the Firewall.
InboundRules []GetFirewallInboundRule
OutboundRules []GetFirewallOutboundRule
Tags []string
The names of the Tags assigned to the Firewall.
firewallId This property is required. String
The ID of the firewall to retrieve information about.
dropletIds List<Integer>
The list of the IDs of the Droplets assigned to the Firewall.
inboundRules List<GetFirewallInboundRule>
outboundRules List<GetFirewallOutboundRule>
tags List<String>
The names of the Tags assigned to the Firewall.
firewallId This property is required. string
The ID of the firewall to retrieve information about.
dropletIds number[]
The list of the IDs of the Droplets assigned to the Firewall.
inboundRules GetFirewallInboundRule[]
outboundRules GetFirewallOutboundRule[]
tags string[]
The names of the Tags assigned to the Firewall.
firewall_id This property is required. str
The ID of the firewall to retrieve information about.
droplet_ids Sequence[int]
The list of the IDs of the Droplets assigned to the Firewall.
inbound_rules Sequence[GetFirewallInboundRule]
outbound_rules Sequence[GetFirewallOutboundRule]
tags Sequence[str]
The names of the Tags assigned to the Firewall.
firewallId This property is required. String
The ID of the firewall to retrieve information about.
dropletIds List<Number>
The list of the IDs of the Droplets assigned to the Firewall.
inboundRules List<Property Map>
outboundRules List<Property Map>
tags List<String>
The names of the Tags assigned to the Firewall.

getFirewall Result

The following output properties are available:

CreatedAt string
A time value given in ISO8601 combined date and time format that represents when the Firewall was created.
DropletIds List<int>
The list of the IDs of the Droplets assigned to the Firewall.
FirewallId string
Id string
The provider-assigned unique ID for this managed resource.
InboundRules List<Pulumi.DigitalOcean.Outputs.GetFirewallInboundRule>
Name string
The name of the Firewall.
OutboundRules List<Pulumi.DigitalOcean.Outputs.GetFirewallOutboundRule>
PendingChanges List<Pulumi.DigitalOcean.Outputs.GetFirewallPendingChange>
A set of object containing the fields, droplet_id, removing, and status. It is provided to detail exactly which Droplets are having their security policies updated. When empty, all changes have been successfully applied.
Status string
A status string indicating the current state of the Firewall. This can be "waiting", "succeeded", or "failed".
Tags List<string>
The names of the Tags assigned to the Firewall.
CreatedAt string
A time value given in ISO8601 combined date and time format that represents when the Firewall was created.
DropletIds []int
The list of the IDs of the Droplets assigned to the Firewall.
FirewallId string
Id string
The provider-assigned unique ID for this managed resource.
InboundRules []GetFirewallInboundRule
Name string
The name of the Firewall.
OutboundRules []GetFirewallOutboundRule
PendingChanges []GetFirewallPendingChange
A set of object containing the fields, droplet_id, removing, and status. It is provided to detail exactly which Droplets are having their security policies updated. When empty, all changes have been successfully applied.
Status string
A status string indicating the current state of the Firewall. This can be "waiting", "succeeded", or "failed".
Tags []string
The names of the Tags assigned to the Firewall.
createdAt String
A time value given in ISO8601 combined date and time format that represents when the Firewall was created.
dropletIds List<Integer>
The list of the IDs of the Droplets assigned to the Firewall.
firewallId String
id String
The provider-assigned unique ID for this managed resource.
inboundRules List<GetFirewallInboundRule>
name String
The name of the Firewall.
outboundRules List<GetFirewallOutboundRule>
pendingChanges List<GetFirewallPendingChange>
A set of object containing the fields, droplet_id, removing, and status. It is provided to detail exactly which Droplets are having their security policies updated. When empty, all changes have been successfully applied.
status String
A status string indicating the current state of the Firewall. This can be "waiting", "succeeded", or "failed".
tags List<String>
The names of the Tags assigned to the Firewall.
createdAt string
A time value given in ISO8601 combined date and time format that represents when the Firewall was created.
dropletIds number[]
The list of the IDs of the Droplets assigned to the Firewall.
firewallId string
id string
The provider-assigned unique ID for this managed resource.
inboundRules GetFirewallInboundRule[]
name string
The name of the Firewall.
outboundRules GetFirewallOutboundRule[]
pendingChanges GetFirewallPendingChange[]
A set of object containing the fields, droplet_id, removing, and status. It is provided to detail exactly which Droplets are having their security policies updated. When empty, all changes have been successfully applied.
status string
A status string indicating the current state of the Firewall. This can be "waiting", "succeeded", or "failed".
tags string[]
The names of the Tags assigned to the Firewall.
created_at str
A time value given in ISO8601 combined date and time format that represents when the Firewall was created.
droplet_ids Sequence[int]
The list of the IDs of the Droplets assigned to the Firewall.
firewall_id str
id str
The provider-assigned unique ID for this managed resource.
inbound_rules Sequence[GetFirewallInboundRule]
name str
The name of the Firewall.
outbound_rules Sequence[GetFirewallOutboundRule]
pending_changes Sequence[GetFirewallPendingChange]
A set of object containing the fields, droplet_id, removing, and status. It is provided to detail exactly which Droplets are having their security policies updated. When empty, all changes have been successfully applied.
status str
A status string indicating the current state of the Firewall. This can be "waiting", "succeeded", or "failed".
tags Sequence[str]
The names of the Tags assigned to the Firewall.
createdAt String
A time value given in ISO8601 combined date and time format that represents when the Firewall was created.
dropletIds List<Number>
The list of the IDs of the Droplets assigned to the Firewall.
firewallId String
id String
The provider-assigned unique ID for this managed resource.
inboundRules List<Property Map>
name String
The name of the Firewall.
outboundRules List<Property Map>
pendingChanges List<Property Map>
A set of object containing the fields, droplet_id, removing, and status. It is provided to detail exactly which Droplets are having their security policies updated. When empty, all changes have been successfully applied.
status String
A status string indicating the current state of the Firewall. This can be "waiting", "succeeded", or "failed".
tags List<String>
The names of the Tags assigned to the Firewall.

Supporting Types

GetFirewallInboundRule

Protocol This property is required. string
The type of traffic to be allowed. This may be one of "tcp", "udp", or "icmp".
PortRange string
The ports on which traffic will be allowed specified as a string containing a single port, a range (e.g. "8000-9000"), or "1-65535" to open all ports for a protocol. Required for when protocol is tcp or udp.
SourceAddresses List<string>
An array of strings containing the IPv4 addresses, IPv6 addresses, IPv4 CIDRs, and/or IPv6 CIDRs from which the inbound traffic will be accepted.
SourceDropletIds List<int>
An array containing the IDs of the Droplets from which the inbound traffic will be accepted.
SourceKubernetesIds List<string>
SourceLoadBalancerUids List<string>
An array containing the IDs of the Load Balancers from which the inbound traffic will be accepted.
SourceTags List<string>
A set of names of Tags corresponding to group of Droplets from which the inbound traffic will be accepted.
Protocol This property is required. string
The type of traffic to be allowed. This may be one of "tcp", "udp", or "icmp".
PortRange string
The ports on which traffic will be allowed specified as a string containing a single port, a range (e.g. "8000-9000"), or "1-65535" to open all ports for a protocol. Required for when protocol is tcp or udp.
SourceAddresses []string
An array of strings containing the IPv4 addresses, IPv6 addresses, IPv4 CIDRs, and/or IPv6 CIDRs from which the inbound traffic will be accepted.
SourceDropletIds []int
An array containing the IDs of the Droplets from which the inbound traffic will be accepted.
SourceKubernetesIds []string
SourceLoadBalancerUids []string
An array containing the IDs of the Load Balancers from which the inbound traffic will be accepted.
SourceTags []string
A set of names of Tags corresponding to group of Droplets from which the inbound traffic will be accepted.
protocol This property is required. String
The type of traffic to be allowed. This may be one of "tcp", "udp", or "icmp".
portRange String
The ports on which traffic will be allowed specified as a string containing a single port, a range (e.g. "8000-9000"), or "1-65535" to open all ports for a protocol. Required for when protocol is tcp or udp.
sourceAddresses List<String>
An array of strings containing the IPv4 addresses, IPv6 addresses, IPv4 CIDRs, and/or IPv6 CIDRs from which the inbound traffic will be accepted.
sourceDropletIds List<Integer>
An array containing the IDs of the Droplets from which the inbound traffic will be accepted.
sourceKubernetesIds List<String>
sourceLoadBalancerUids List<String>
An array containing the IDs of the Load Balancers from which the inbound traffic will be accepted.
sourceTags List<String>
A set of names of Tags corresponding to group of Droplets from which the inbound traffic will be accepted.
protocol This property is required. string
The type of traffic to be allowed. This may be one of "tcp", "udp", or "icmp".
portRange string
The ports on which traffic will be allowed specified as a string containing a single port, a range (e.g. "8000-9000"), or "1-65535" to open all ports for a protocol. Required for when protocol is tcp or udp.
sourceAddresses string[]
An array of strings containing the IPv4 addresses, IPv6 addresses, IPv4 CIDRs, and/or IPv6 CIDRs from which the inbound traffic will be accepted.
sourceDropletIds number[]
An array containing the IDs of the Droplets from which the inbound traffic will be accepted.
sourceKubernetesIds string[]
sourceLoadBalancerUids string[]
An array containing the IDs of the Load Balancers from which the inbound traffic will be accepted.
sourceTags string[]
A set of names of Tags corresponding to group of Droplets from which the inbound traffic will be accepted.
protocol This property is required. str
The type of traffic to be allowed. This may be one of "tcp", "udp", or "icmp".
port_range str
The ports on which traffic will be allowed specified as a string containing a single port, a range (e.g. "8000-9000"), or "1-65535" to open all ports for a protocol. Required for when protocol is tcp or udp.
source_addresses Sequence[str]
An array of strings containing the IPv4 addresses, IPv6 addresses, IPv4 CIDRs, and/or IPv6 CIDRs from which the inbound traffic will be accepted.
source_droplet_ids Sequence[int]
An array containing the IDs of the Droplets from which the inbound traffic will be accepted.
source_kubernetes_ids Sequence[str]
source_load_balancer_uids Sequence[str]
An array containing the IDs of the Load Balancers from which the inbound traffic will be accepted.
source_tags Sequence[str]
A set of names of Tags corresponding to group of Droplets from which the inbound traffic will be accepted.
protocol This property is required. String
The type of traffic to be allowed. This may be one of "tcp", "udp", or "icmp".
portRange String
The ports on which traffic will be allowed specified as a string containing a single port, a range (e.g. "8000-9000"), or "1-65535" to open all ports for a protocol. Required for when protocol is tcp or udp.
sourceAddresses List<String>
An array of strings containing the IPv4 addresses, IPv6 addresses, IPv4 CIDRs, and/or IPv6 CIDRs from which the inbound traffic will be accepted.
sourceDropletIds List<Number>
An array containing the IDs of the Droplets from which the inbound traffic will be accepted.
sourceKubernetesIds List<String>
sourceLoadBalancerUids List<String>
An array containing the IDs of the Load Balancers from which the inbound traffic will be accepted.
sourceTags List<String>
A set of names of Tags corresponding to group of Droplets from which the inbound traffic will be accepted.

GetFirewallOutboundRule

Protocol This property is required. string
The type of traffic to be allowed. This may be one of "tcp", "udp", or "icmp".
DestinationAddresses List<string>
An array of strings containing the IPv4 addresses, IPv6 addresses, IPv4 CIDRs, and/or IPv6 CIDRs to which the outbound traffic will be allowed.
DestinationDropletIds List<int>
An array containing the IDs of the Droplets to which the outbound traffic will be allowed.
DestinationKubernetesIds List<string>
DestinationLoadBalancerUids List<string>
An array containing the IDs of the Load Balancers to which the outbound traffic will be allowed.
DestinationTags List<string>
An array containing the names of Tags corresponding to groups of Droplets to which the outbound traffic will be allowed. traffic.
PortRange string
The ports on which traffic will be allowed specified as a string containing a single port, a range (e.g. "8000-9000"), or "1-65535" to open all ports for a protocol. Required for when protocol is tcp or udp.
Protocol This property is required. string
The type of traffic to be allowed. This may be one of "tcp", "udp", or "icmp".
DestinationAddresses []string
An array of strings containing the IPv4 addresses, IPv6 addresses, IPv4 CIDRs, and/or IPv6 CIDRs to which the outbound traffic will be allowed.
DestinationDropletIds []int
An array containing the IDs of the Droplets to which the outbound traffic will be allowed.
DestinationKubernetesIds []string
DestinationLoadBalancerUids []string
An array containing the IDs of the Load Balancers to which the outbound traffic will be allowed.
DestinationTags []string
An array containing the names of Tags corresponding to groups of Droplets to which the outbound traffic will be allowed. traffic.
PortRange string
The ports on which traffic will be allowed specified as a string containing a single port, a range (e.g. "8000-9000"), or "1-65535" to open all ports for a protocol. Required for when protocol is tcp or udp.
protocol This property is required. String
The type of traffic to be allowed. This may be one of "tcp", "udp", or "icmp".
destinationAddresses List<String>
An array of strings containing the IPv4 addresses, IPv6 addresses, IPv4 CIDRs, and/or IPv6 CIDRs to which the outbound traffic will be allowed.
destinationDropletIds List<Integer>
An array containing the IDs of the Droplets to which the outbound traffic will be allowed.
destinationKubernetesIds List<String>
destinationLoadBalancerUids List<String>
An array containing the IDs of the Load Balancers to which the outbound traffic will be allowed.
destinationTags List<String>
An array containing the names of Tags corresponding to groups of Droplets to which the outbound traffic will be allowed. traffic.
portRange String
The ports on which traffic will be allowed specified as a string containing a single port, a range (e.g. "8000-9000"), or "1-65535" to open all ports for a protocol. Required for when protocol is tcp or udp.
protocol This property is required. string
The type of traffic to be allowed. This may be one of "tcp", "udp", or "icmp".
destinationAddresses string[]
An array of strings containing the IPv4 addresses, IPv6 addresses, IPv4 CIDRs, and/or IPv6 CIDRs to which the outbound traffic will be allowed.
destinationDropletIds number[]
An array containing the IDs of the Droplets to which the outbound traffic will be allowed.
destinationKubernetesIds string[]
destinationLoadBalancerUids string[]
An array containing the IDs of the Load Balancers to which the outbound traffic will be allowed.
destinationTags string[]
An array containing the names of Tags corresponding to groups of Droplets to which the outbound traffic will be allowed. traffic.
portRange string
The ports on which traffic will be allowed specified as a string containing a single port, a range (e.g. "8000-9000"), or "1-65535" to open all ports for a protocol. Required for when protocol is tcp or udp.
protocol This property is required. str
The type of traffic to be allowed. This may be one of "tcp", "udp", or "icmp".
destination_addresses Sequence[str]
An array of strings containing the IPv4 addresses, IPv6 addresses, IPv4 CIDRs, and/or IPv6 CIDRs to which the outbound traffic will be allowed.
destination_droplet_ids Sequence[int]
An array containing the IDs of the Droplets to which the outbound traffic will be allowed.
destination_kubernetes_ids Sequence[str]
destination_load_balancer_uids Sequence[str]
An array containing the IDs of the Load Balancers to which the outbound traffic will be allowed.
destination_tags Sequence[str]
An array containing the names of Tags corresponding to groups of Droplets to which the outbound traffic will be allowed. traffic.
port_range str
The ports on which traffic will be allowed specified as a string containing a single port, a range (e.g. "8000-9000"), or "1-65535" to open all ports for a protocol. Required for when protocol is tcp or udp.
protocol This property is required. String
The type of traffic to be allowed. This may be one of "tcp", "udp", or "icmp".
destinationAddresses List<String>
An array of strings containing the IPv4 addresses, IPv6 addresses, IPv4 CIDRs, and/or IPv6 CIDRs to which the outbound traffic will be allowed.
destinationDropletIds List<Number>
An array containing the IDs of the Droplets to which the outbound traffic will be allowed.
destinationKubernetesIds List<String>
destinationLoadBalancerUids List<String>
An array containing the IDs of the Load Balancers to which the outbound traffic will be allowed.
destinationTags List<String>
An array containing the names of Tags corresponding to groups of Droplets to which the outbound traffic will be allowed. traffic.
portRange String
The ports on which traffic will be allowed specified as a string containing a single port, a range (e.g. "8000-9000"), or "1-65535" to open all ports for a protocol. Required for when protocol is tcp or udp.

GetFirewallPendingChange

DropletId int
Removing bool
Status string
A status string indicating the current state of the Firewall. This can be "waiting", "succeeded", or "failed".
DropletId int
Removing bool
Status string
A status string indicating the current state of the Firewall. This can be "waiting", "succeeded", or "failed".
dropletId Integer
removing Boolean
status String
A status string indicating the current state of the Firewall. This can be "waiting", "succeeded", or "failed".
dropletId number
removing boolean
status string
A status string indicating the current state of the Firewall. This can be "waiting", "succeeded", or "failed".
droplet_id int
removing bool
status str
A status string indicating the current state of the Firewall. This can be "waiting", "succeeded", or "failed".
dropletId Number
removing Boolean
status String
A status string indicating the current state of the Firewall. This can be "waiting", "succeeded", or "failed".

Package Details

Repository
DigitalOcean pulumi/pulumi-digitalocean
License
Apache-2.0
Notes
This Pulumi package is based on the digitalocean Terraform Provider.
DigitalOcean v4.41.0 published on Wednesday, Mar 26, 2025 by Pulumi