Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate google_compute_firewall_policy resource from DCL to MMv1 #21235

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/11357.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
compute: `google_compute_firewall_policy` now uses MMv1 engine instead of DCL.
```
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ resource "google_folder" "folder" {
resource "google_compute_firewall_policy" "fw_policy" {
parent = google_folder.folder.id
short_name = "tf-test-policy-%{random_suffix}"
description = "Description Update"
description = "Resource created for Terraform acceptance testing"
}

resource "google_network_security_address_group" "address_group" {
Expand Down
89 changes: 57 additions & 32 deletions website/docs/r/compute_firewall_policy.html.markdown
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
---
# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** Type: DCL ***
# *** AUTO GENERATED CODE *** Type: MMv1 ***
#
# ----------------------------------------------------------------------------
#
# This file is managed by Magic Modules (https:#github.com/GoogleCloudPlatform/magic-modules)
# and is based on the DCL (https:#github.com/GoogleCloudPlatform/declarative-resource-client-library).
# Changes will need to be made to the DCL or Magic Modules instead of here.
# This file is automatically generated by Magic Modules and manual
# changes will be clobbered when the file is regenerated.
#
# We are not currently able to accept contributions to this file. If changes
# are required, please file an issue at https:#github.com/hashicorp/terraform-provider-google/issues/new/choose
# Please read more about how to change this file in
# .github/CONTRIBUTING.md.
#
# ----------------------------------------------------------------------------
subcategory: "Compute Engine"
description: |-
Creates a hierarchical firewall policy
Hierarchical firewall policy rules let you create and enforce a consistent firewall policy across your organization.
---

# google_compute_firewall_policy
Expand All @@ -26,11 +25,21 @@ This resource should be generally be used with `google_compute_firewall_policy_a

For more information see the [official documentation](https://cloud.google.com/vpc/docs/firewall-policies)

## Example Usage
~> **Warning:** This resource is in beta, and should be used with the terraform-provider-google-beta provider.
See [Provider Versions](https://terraform.io/docs/providers/google/guides/provider_versions.html) for more details on beta resources.

To get more information about FirewallPolicy, see:

* [API documentation](https://cloud.google.com/compute/docs/reference/rest/v1/firewallPolicies)

## Example Usage - Firewall Policy


```hcl
resource "google_compute_firewall_policy" "default" {
parent = "organizations/12345"
provider = google-beta

parent = "organizations/123456789"
short_name = "my-policy"
description = "Example Resource"
}
Expand All @@ -40,22 +49,24 @@ resource "google_compute_firewall_policy" "default" {

The following arguments are supported:


* `short_name` -
(Required)
User-provided name of the Organization firewall policy. The name should be unique in the organization in which the firewall policy is created.
This field is not applicable to network firewall policies. This name must be set on creation and cannot be changed. The name must be 1-63 characters long, and comply with RFC1035.
Specifically, the name must be 1-63 characters long and match the regular expression [a-z]([-a-z0-9]*[a-z0-9])? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.

* `parent` -
(Required)
The parent of the firewall policy.

* `short_name` -
(Required)
User-provided name of the Organization firewall policy. The name should be unique in the organization in which the firewall policy is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression [a-z]([-a-z0-9]*[a-z0-9])? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.



- - -


* `description` -
(Optional)
An optional description of this resource. Provide this property when you create the resource.



## Attributes Reference
Expand All @@ -66,42 +77,56 @@ In addition to the arguments listed above, the following computed attributes are

* `creation_timestamp` -
Creation timestamp in RFC3339 text format.

* `fingerprint` -
Fingerprint of the resource. This field is used internally during updates of this resource.

* `id` -
The unique identifier for the resource. This identifier is defined by the server.


* `name` -
Name of the resource. It is a numeric ID allocated by GCP which uniquely identifies the Firewall Policy.

* `rule_tuple_count` -
Total count of all firewall policy rule tuples. A firewall policy can not exceed a set number of tuples.


* `firewall_policy_id` -
The unique identifier for the resource. This identifier is defined by the server.

* `fingerprint` -
Fingerprint of the resource. This field is used internally during updates of this resource.

* `self_link` -
Server-defined URL for the resource.

* `self_link_with_id` -
Server-defined URL for this resource with the resource id.


* `rule_tuple_count` -
Total count of all firewall policy rule tuples. A firewall policy can not exceed a set number of tuples.


## Timeouts

This resource provides the following
[Timeouts](https://developer.hashicorp.com/terraform/plugin/sdkv2/resources/retries-and-customizable-timeouts) configuration options: configuration options:
[Timeouts](https://developer.hashicorp.com/terraform/plugin/sdkv2/resources/retries-and-customizable-timeouts) configuration options:

- `create` - Default is 20 minutes.
- `update` - Default is 20 minutes.
- `delete` - Default is 20 minutes.

## Import


FirewallPolicy can be imported using any of these accepted formats:

* `locations/global/firewallPolicies/{{name}}`
* `{{name}}`


In Terraform v1.5.0 and later, use an [`import` block](https://developer.hashicorp.com/terraform/language/import) to import FirewallPolicy using one of the formats above. For example:

```tf
import {
id = "locations/global/firewallPolicies/{{name}}"
to = google_compute_firewall_policy.default
}
```

When using the [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import), FirewallPolicy can be imported using one of the formats above. For example:

```
$ terraform import google_compute_firewall_policy.default locations/global/firewallPolicies/{{name}}
$ terraform import google_compute_firewall_policy.default {{name}}
```