The unifi.firewall.Zone resource manages firewall zones in the UniFi controller.
Firewall zones allow you to group networks together for firewall rule application. This resource allows you to create, update, and delete firewall zones.
!> This is experimental feature, that requires UniFi OS 9.0.0 or later and Zone Based Firewall feature enabled. Check official documentation how to migate to Zone-Based firewalls.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as unifi from "@pulumiverse/unifi";
const network = new unifi.Network("network", {
name: "my-network",
purpose: "corporate",
subnet: "10.0.10.0/24",
vlanId: 400,
});
const zone = new unifi.firewall.Zone("zone", {
name: "my-zone",
networks: [network.id],
});
import pulumi
import pulumiverse_unifi as unifi
network = unifi.Network("network",
name="my-network",
purpose="corporate",
subnet="10.0.10.0/24",
vlan_id=400)
zone = unifi.firewall.Zone("zone",
name="my-zone",
networks=[network.id])
package main
import (
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumiverse/pulumi-unifi/sdk/go/unifi"
"github.com/pulumiverse/pulumi-unifi/sdk/go/unifi/firewall"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
network, err := unifi.NewNetwork(ctx, "network", &unifi.NetworkArgs{
Name: pulumi.String("my-network"),
Purpose: pulumi.String("corporate"),
Subnet: pulumi.String("10.0.10.0/24"),
VlanId: pulumi.Int(400),
})
if err != nil {
return err
}
_, err = firewall.NewZone(ctx, "zone", &firewall.ZoneArgs{
Name: pulumi.String("my-zone"),
Networks: pulumi.StringArray{
network.ID(),
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Unifi = Pulumiverse.Unifi;
return await Deployment.RunAsync(() =>
{
var network = new Unifi.Network("network", new()
{
Name = "my-network",
Purpose = "corporate",
Subnet = "10.0.10.0/24",
VlanId = 400,
});
var zone = new Unifi.Firewall.Zone("zone", new()
{
Name = "my-zone",
Networks = new[]
{
network.Id,
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumiverse.unifi.Network;
import com.pulumiverse.unifi.NetworkArgs;
import com.pulumiverse.unifi.firewall.Zone;
import com.pulumiverse.unifi.firewall.ZoneArgs;
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 network = new Network("network", NetworkArgs.builder()
.name("my-network")
.purpose("corporate")
.subnet("10.0.10.0/24")
.vlanId(400)
.build());
var zone = new Zone("zone", ZoneArgs.builder()
.name("my-zone")
.networks(network.id())
.build());
}
}
resources:
network:
type: unifi:Network
properties:
name: my-network
purpose: corporate
subnet: 10.0.10.0/24
vlanId: '400'
zone:
type: unifi:firewall:Zone
properties:
name: my-zone
networks:
- ${network.id}
Create Zone Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Zone(name: string, args?: ZoneArgs, opts?: CustomResourceOptions);@overload
def Zone(resource_name: str,
args: Optional[ZoneArgs] = None,
opts: Optional[ResourceOptions] = None)
@overload
def Zone(resource_name: str,
opts: Optional[ResourceOptions] = None,
name: Optional[str] = None,
networks: Optional[Sequence[str]] = None,
site: Optional[str] = None)func NewZone(ctx *Context, name string, args *ZoneArgs, opts ...ResourceOption) (*Zone, error)public Zone(string name, ZoneArgs? args = null, CustomResourceOptions? opts = null)type: unifi:firewall:Zone
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 ZoneArgs
- 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 ZoneArgs
- 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 ZoneArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args ZoneArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args ZoneArgs
- 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 zoneResource = new Unifi.Firewall.Zone("zoneResource", new()
{
Name = "string",
Networks = new[]
{
"string",
},
Site = "string",
});
example, err := firewall.NewZone(ctx, "zoneResource", &firewall.ZoneArgs{
Name: pulumi.String("string"),
Networks: pulumi.StringArray{
pulumi.String("string"),
},
Site: pulumi.String("string"),
})
var zoneResource = new Zone("zoneResource", ZoneArgs.builder()
.name("string")
.networks("string")
.site("string")
.build());
zone_resource = unifi.firewall.Zone("zoneResource",
name="string",
networks=["string"],
site="string")
const zoneResource = new unifi.firewall.Zone("zoneResource", {
name: "string",
networks: ["string"],
site: "string",
});
type: unifi:firewall:Zone
properties:
name: string
networks:
- string
site: string
Zone 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 Zone resource accepts the following input properties:
Outputs
All input properties are implicitly available as output properties. Additionally, the Zone 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 Zone Resource
Get an existing Zone 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?: ZoneState, opts?: CustomResourceOptions): Zone@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
name: Optional[str] = None,
networks: Optional[Sequence[str]] = None,
site: Optional[str] = None) -> Zonefunc GetZone(ctx *Context, name string, id IDInput, state *ZoneState, opts ...ResourceOption) (*Zone, error)public static Zone Get(string name, Input<string> id, ZoneState? state, CustomResourceOptions? opts = null)public static Zone get(String name, Output<String> id, ZoneState state, CustomResourceOptions options)resources: _: type: unifi:firewall:Zone get: id: ${id}- 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.
Import
import from provider configured site
$ pulumi import unifi:firewall/zone:Zone myzone 5dc28e5e9106d105bdc87217
import from another site
$ pulumi import unifi:firewall/zone:Zone myzone another-site:5dc28e5e9106d105bdc87217
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- unifi pulumiverse/pulumi-unifi
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
unifiTerraform Provider.
