terraform-provider-google/website/docs/r/compute_firewall.html.markdown
Riley Karson 2d0d8bdcc0 Add Beta support & Beta feature deny to google_compute_firewall (#282)
* Add versioned Beta support to google_compute_firewall.

* Add Beta support for deny to google_compute_firewall.

* remove extra line:

* make fmt

* Add missing ForceNew fields.

* Respond to review comments testing functionality + reducing network GET to v1
2017-08-07 13:14:35 -07:00

97 lines
2.4 KiB
Markdown

---
layout: "google"
page_title: "Google: google_compute_firewall"
sidebar_current: "docs-google-compute-firewall"
description: |-
Manages a firewall resource within GCE.
---
# google\_compute\_firewall
Manages a firewall resource within GCE. For more information see
[the official documentation](https://cloud.google.com/compute/docs/vpc/firewalls)
and
[API](https://cloud.google.com/compute/docs/reference/latest/firewalls).
## Example Usage
```hcl
resource "google_compute_firewall" "default" {
name = "test-firewall"
network = "${google_compute_network.other.name}"
allow {
protocol = "icmp"
}
allow {
protocol = "tcp"
ports = ["80", "8080", "1000-2000"]
}
source_tags = ["web"]
}
```
## Argument Reference
The following arguments are supported:
* `name` - (Required) A unique name for the resource, required by GCE.
Changing this forces a new resource to be created.
* `network` - (Required) The name of the network to attach this firewall to.
* `allow` - (Required) Can be specified multiple times for each allow
rule. Each allow block supports fields documented below.
- - -
* `description` - (Optional) Textual description field.
* `project` - (Optional) The project in which the resource belongs. If it
is not provided, the provider project is used.
* `source_ranges` - (Optional) A list of source CIDR ranges that this
firewall applies to.
* `source_tags` - (Optional) A list of source tags for this firewall.
* `target_tags` - (Optional) A list of target tags for this firewall.
- - -
* `deny` - (Optional, Beta) Can be specified multiple times for each deny
rule. Each deny block supports fields documented below. Can be specified
instead of allow.
The `allow` block supports:
* `protocol` - (Required) The name of the protocol to allow.
* `ports` - (Optional) List of ports and/or port ranges to allow. This can
only be specified if the protocol is TCP or UDP.
The `deny` block supports:
* `protocol` - (Required) The name of the protocol to allow.
* `ports` - (Optional) List of ports and/or port ranges to allow. This can
only be specified if the protocol is TCP or UDP.
## Attributes Reference
In addition to the arguments listed above, the following computed attributes are
exported:
* `self_link` - The URI of the created resource.
## Import
Firewalls can be imported using the `name`, e.g.
```
$ terraform import google_compute_firewall.default test-firewall
```