> ## Documentation Index
> Fetch the complete documentation index at: https://docs.aviatrix.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Creating Groups for Distributed Cloud Firewall

> A Distributed Cloud Firewall (DCF) SmartGroup contains one or more filters to identify cloud endpoints that map to an app domain. A filter specifies resource matching criteria.

## SmartGroups

A Distributed Cloud Firewall (DCF) SmartGroup contains one or more filters to
identify cloud endpoints that map to an app domain. A filter specifies resource
matching criteria. Matching criteria could be a cloud tag; a resource attribute
(such as account name or region); a list of IP prefixes; or a Site2Cloud
external connection. All conditions within the filter must be satisfied to be
matched. A tag or resource attribute-based filter must be associated with a
resource type (VPC/VNet, subnet, or VM).

> [tab] CoPilot UI
>
> For the steps to create SmartGroups in the CoPilot UI, see&#x20;
> [Creating SmartGroups](https://docs.aviatrix.com/docs/enterprise/9.0/reference/ui/groups/index.md#create-smartgroup)
> .

> [tab] Terraform
>
> Define a SmartGroup with the
> [aviatrix\_smart\_group](https://registry.terraform.io/providers/AviatrixSystems/aviatrix/latest/docs/resources/aviatrix_smart_group)
> resource. Each `match_expressions` block is a filter; add more than one
> block to match on multiple criteria such as account name, region, tags, or
> a CIDR range.
>
> **1. Add the SmartGroup resource**
>
> Add the following `aviatrix_smart_group` resource block to your Terraform configuration file:
>
> ```hcl theme={null}
> resource "aviatrix_smart_group" "protected_vpcs" {
>   name = "protected-vpcs"
>
>   selector {
>     match_expressions {
>       type         = "vpc"
>       account_name = "prod-account"
>       region       = "us-east-1"
>       tags = {
>         env = "production"
>       }
>     }
>
>     match_expressions {
>       cidr = "10.0.0.0/16"
>     }
>   }
> }
> ```
>
> **2. Verify and Apply the Configuration**
>
> Run `terraform plan`, review the planned changes, and run `terraform apply`.

***

## WebGroups

A DCF WebGroup contains one or more domain names or URLs that assists in
filtering (and providing security to) Internet-bound traffic.

> [tab] CoPilot UI
>
> For the steps to create WebGroups in the CoPilot UI, see&#x20;
> [Creating WebGroups](https://docs.aviatrix.com/docs/enterprise/9.0/reference/ui/groups/index.md#create-web-group)
> .

> [tab] Terraform
>
> Define a WebGroup with the
> [aviatrix\_web\_group](https://registry.terraform.io/providers/AviatrixSystems/aviatrix/latest/docs/resources/aviatrix_web_group)
> resource. Use `snifilter` to match on a domain name, or `urlfilter` to
> match on a specific URL path. A `match_expressions` block cannot combine
> both filters.
>
> **1. Add the WebGroup resource**
>
> Add the following `aviatrix_web_group` resource block to your Terraform configuration file:
>
> ```hcl theme={null}
> resource "aviatrix_web_group" "trusted_domains" {
>   name = "trusted-domains"
>
>   selector {
>     match_expressions {
>       snifilter = "aviatrix.com"
>     }
>   }
> }
> ```
>
> **2. Verify and Apply the Configuration**
>
> Run `terraform plan`, review the planned changes, and run `terraform apply`.

***

## ExternalGroups

An ExternalGroup can contain countries, threat feeds, and SaaS-based services
(Azure and GitHub).

> [tab] CoPilot UI
>
> For the steps to create ExternalGroups in the CoPilot UI, see&#x20;
> [Managing the Relationship Between Feeds and ExternalGroups](https://docs.aviatrix.com/docs/enterprise/9.0/reference/ui/groups/index.md#create-external-group)
> .

> [tab] Terraform
>
> ExternalGroups use the same
> [aviatrix\_smart\_group](https://registry.terraform.io/providers/AviatrixSystems/aviatrix/latest/docs/resources/aviatrix_smart_group)
> resource as SmartGroups, with an `external` match expression instead of a
> cloud-resource filter. Set `external` to `geo`, `threatiq`, `azureips`, or
> `githubips`, and use `ext_args` for feed-specific arguments.
>
> **1. Add the ExternalGroup resource**
>
> Add the following `aviatrix_smart_group` resource block to your Terraform configuration file:
>
> ```hcl theme={null}
> resource "aviatrix_smart_group" "blocked_countries" {
>   name = "blocked-countries"
>
>   selector {
>     match_expressions {
>       external = "geo"
>       ext_args = {
>         country_iso_code = "US"
>       }
>     }
>   }
> }
> ```
>
> **2. Verify and Apply the Configuration**
>
> Run `terraform plan`, review the planned changes, and run `terraform apply`.

***

## Related Resources

* [Aviatrix Terraform provider](https://registry.terraform.io/providers/AviatrixSystems/aviatrix/latest/docs)
* [aviatrix\_smart\_group resource](https://registry.terraform.io/providers/AviatrixSystems/aviatrix/latest/docs/resources/aviatrix_smart_group)
* [aviatrix\_web\_group resource](https://registry.terraform.io/providers/AviatrixSystems/aviatrix/latest/docs/resources/aviatrix_web_group)
* [Disabling the Distributed Cloud Firewall Feature](https://docs.aviatrix.com/docs/enterprise/9.0/guides/security/dcf/dcf-disable-feature.md)
* [Creating Distributed Cloud Firewall Rules](https://legacy.docs.aviatrix.com/documentation/latest/security/dcf-create-rules.html)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.