Skip to content

Commit 4799d72

Browse files
Create network edge security services and region security policy (#7979) (#14971)
Signed-off-by: Modular Magician <[email protected]> Co-authored-by: diogoEsteves <[email protected]>
1 parent 5acfdf3 commit 4799d72

5 files changed

+299
-0
lines changed

.changelog/7979.txt

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
```release-note:new-resource
2+
`google_compute_region_security_policy` (beta)
3+
````
4+
```release-note:new-resource
5+
`google_compute_network_edge_security_service` (beta)
6+
```
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// Copyright (c) HashiCorp, Inc.
2+
// SPDX-License-Identifier: MPL-2.0
3+
package google
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// Copyright (c) HashiCorp, Inc.
2+
// SPDX-License-Identifier: MPL-2.0
3+
package google
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
---
2+
# ----------------------------------------------------------------------------
3+
#
4+
# *** AUTO GENERATED CODE *** Type: MMv1 ***
5+
#
6+
# ----------------------------------------------------------------------------
7+
#
8+
# This file is automatically generated by Magic Modules and manual
9+
# changes will be clobbered when the file is regenerated.
10+
#
11+
# Please read more about how to change this file in
12+
# .github/CONTRIBUTING.md.
13+
#
14+
# ----------------------------------------------------------------------------
15+
subcategory: "Compute Engine"
16+
description: |-
17+
Google Cloud Armor network edge security service resource.
18+
---
19+
20+
# google\_compute\_network\_edge\_security\_service
21+
22+
Google Cloud Armor network edge security service resource.
23+
24+
~> **Warning:** This resource is in beta, and should be used with the terraform-provider-google-beta provider.
25+
See [Provider Versions](https://terraform.io/docs/providers/google/guides/provider_versions.html) for more details on beta resources.
26+
27+
To get more information about NetworkEdgeSecurityService, see:
28+
29+
* [API documentation](https://cloud.google.com/compute/docs/reference/rest/v1/networkEdgeSecurityServices)
30+
* How-to Guides
31+
* [Official Documentation](https://cloud.google.com/armor/docs/advanced-network-ddos?hl=pt-br#activate_advanced_network_ddos_protection)
32+
33+
## Example Usage - Compute Network Edge Security Service Basic
34+
35+
36+
```hcl
37+
resource "google_compute_network_edge_security_service" "default" {
38+
provider = google-beta
39+
40+
name = "my-edge-security-service"
41+
region = "asia-southeast1"
42+
description = "My basic resource"
43+
}
44+
```
45+
46+
## Argument Reference
47+
48+
The following arguments are supported:
49+
50+
51+
* `name` -
52+
(Required)
53+
Name of the resource. Provided by the client when the resource is created.
54+
55+
56+
- - -
57+
58+
59+
* `description` -
60+
(Optional)
61+
Free-text description of the resource.
62+
63+
* `security_policy` -
64+
(Optional)
65+
The resource URL for the network edge security service associated with this network edge security service.
66+
67+
* `region` -
68+
(Optional)
69+
The region of the gateway security policy.
70+
71+
* `project` - (Optional) The ID of the project in which the resource belongs.
72+
If it is not provided, the provider project is used.
73+
74+
75+
## Attributes Reference
76+
77+
In addition to the arguments listed above, the following computed attributes are exported:
78+
79+
* `id` - an identifier for the resource with format `projects/{{project}}/regions/{{region}}/networkEdgeSecurityServices/{{name}}`
80+
81+
* `service_id` -
82+
The unique identifier for the resource. This identifier is defined by the server.
83+
84+
* `creation_timestamp` -
85+
Creation timestamp in RFC3339 text format.
86+
87+
* `self_link` -
88+
Server-defined URL for the resource.
89+
90+
* `self_link_with_service_id` -
91+
Server-defined URL for this resource with the resource id.
92+
93+
* `fingerprint` -
94+
Fingerprint of this resource. A hash of the contents stored in this object. This field is used in optimistic locking. This field will be ignored when inserting a NetworkEdgeSecurityService.
95+
An up-to-date fingerprint must be provided in order to update the NetworkEdgeSecurityService, otherwise the request will fail with error 412 conditionNotMet.
96+
97+
98+
## Timeouts
99+
100+
This resource provides the following
101+
[Timeouts](https://developer.hashicorp.com/terraform/plugin/sdkv2/resources/retries-and-customizable-timeouts) configuration options:
102+
103+
- `create` - Default is 20 minutes.
104+
- `update` - Default is 20 minutes.
105+
- `delete` - Default is 20 minutes.
106+
107+
## Import
108+
109+
110+
NetworkEdgeSecurityService can be imported using any of these accepted formats:
111+
112+
```
113+
$ terraform import google_compute_network_edge_security_service.default projects/{{project}}/regions/{{region}}/networkEdgeSecurityServices/{{name}}
114+
$ terraform import google_compute_network_edge_security_service.default {{project}}/{{region}}/{{name}}
115+
$ terraform import google_compute_network_edge_security_service.default {{region}}/{{name}}
116+
$ terraform import google_compute_network_edge_security_service.default {{name}}
117+
```
118+
119+
## User Project Overrides
120+
121+
This resource supports [User Project Overrides](https://registry.terraform.io/providers/hashicorp/google/latest/docs/guides/provider_reference#user_project_override).
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
---
2+
# ----------------------------------------------------------------------------
3+
#
4+
# *** AUTO GENERATED CODE *** Type: MMv1 ***
5+
#
6+
# ----------------------------------------------------------------------------
7+
#
8+
# This file is automatically generated by Magic Modules and manual
9+
# changes will be clobbered when the file is regenerated.
10+
#
11+
# Please read more about how to change this file in
12+
# .github/CONTRIBUTING.md.
13+
#
14+
# ----------------------------------------------------------------------------
15+
subcategory: "Compute Engine"
16+
description: |-
17+
Represents a Region Cloud Armor Security Policy resource.
18+
---
19+
20+
# google\_compute\_region\_security\_policy
21+
22+
Represents a Region Cloud Armor Security Policy resource.
23+
24+
~> **Warning:** This resource is in beta, and should be used with the terraform-provider-google-beta provider.
25+
See [Provider Versions](https://terraform.io/docs/providers/google/guides/provider_versions.html) for more details on beta resources.
26+
27+
To get more information about RegionSecurityPolicy, see:
28+
29+
* [API documentation](https://cloud.google.com/compute/docs/reference/rest/v1/regionSecurityPolicies)
30+
* How-to Guides
31+
* [Official Documentation](https://cloud.google.com/armor/docs/security-policy-concepts)
32+
33+
<div class = "oics-button" style="float: right; margin: 0 0 -15px">
34+
<a href="https://console.cloud.google.com/cloudshell/open?cloudshell_git_repo=https%3A%2F%2Fgithub.jpy.wang%2Fterraform-google-modules%2Fdocs-examples.git&cloudshell_working_dir=region_security_policy_basic&cloudshell_image=gcr.io%2Fgraphite-cloud-shell-images%2Fterraform%3Alatest&open_in_editor=main.tf&cloudshell_print=.%2Fmotd&cloudshell_tutorial=.%2Ftutorial.md" target="_blank">
35+
<img alt="Open in Cloud Shell" src="//gstatic.com/cloudssh/images/open-btn.svg" style="max-height: 44px; margin: 32px auto; max-width: 100%;">
36+
</a>
37+
</div>
38+
## Example Usage - Region Security Policy Basic
39+
40+
41+
```hcl
42+
resource "google_compute_region_security_policy" "region-sec-policy-basic" {
43+
provider = google-beta
44+
45+
name = "my-sec-policy-basic"
46+
description = "basic region security policy"
47+
type = "CLOUD_ARMOR"
48+
}
49+
```
50+
<div class = "oics-button" style="float: right; margin: 0 0 -15px">
51+
<a href="https://console.cloud.google.com/cloudshell/open?cloudshell_git_repo=https%3A%2F%2Fgithub.jpy.wang%2Fterraform-google-modules%2Fdocs-examples.git&cloudshell_working_dir=region_security_policy_with_ddos_protection_config&cloudshell_image=gcr.io%2Fgraphite-cloud-shell-images%2Fterraform%3Alatest&open_in_editor=main.tf&cloudshell_print=.%2Fmotd&cloudshell_tutorial=.%2Ftutorial.md" target="_blank">
52+
<img alt="Open in Cloud Shell" src="//gstatic.com/cloudssh/images/open-btn.svg" style="max-height: 44px; margin: 32px auto; max-width: 100%;">
53+
</a>
54+
</div>
55+
## Example Usage - Region Security Policy With Ddos Protection Config
56+
57+
58+
```hcl
59+
resource "google_compute_region_security_policy" "region-sec-policy-ddos-protection" {
60+
provider = google-beta
61+
62+
name = "my-sec-policy-ddos-protection"
63+
description = "with ddos protection config"
64+
type = "CLOUD_ARMOR_NETWORK"
65+
66+
ddos_protection_config {
67+
ddos_protection = "ADVANCED_PREVIEW"
68+
}
69+
}
70+
```
71+
72+
## Argument Reference
73+
74+
The following arguments are supported:
75+
76+
77+
* `name` -
78+
(Required)
79+
Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035.
80+
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.
81+
82+
83+
- - -
84+
85+
86+
* `description` -
87+
(Optional)
88+
An optional description of this resource. Provide this property when you create the resource.
89+
90+
* `type` -
91+
(Optional)
92+
The type indicates the intended use of the security policy.
93+
- CLOUD_ARMOR: Cloud Armor backend security policies can be configured to filter incoming HTTP requests targeting backend services. They filter requests before they hit the origin servers.
94+
- CLOUD_ARMOR_EDGE: Cloud Armor edge security policies can be configured to filter incoming HTTP requests targeting backend services (including Cloud CDN-enabled) as well as backend buckets (Cloud Storage). They filter requests before the request is served from Google's cache.
95+
- CLOUD_ARMOR_NETWORK: Cloud Armor network policies can be configured to filter packets targeting network load balancing resources such as backend services, target pools, target instances, and instances with external IPs. They filter requests before the request is served from the application.
96+
This field can be set only at resource creation time.
97+
Possible values are: `CLOUD_ARMOR`, `CLOUD_ARMOR_EDGE`, `CLOUD_ARMOR_NETWORK`.
98+
99+
* `ddos_protection_config` -
100+
(Optional)
101+
Configuration for Google Cloud Armor DDOS Proctection Config.
102+
Structure is [documented below](#nested_ddos_protection_config).
103+
104+
* `region` -
105+
(Optional)
106+
The Region in which the created Region Security Policy should reside.
107+
If it is not provided, the provider region is used.
108+
109+
* `project` - (Optional) The ID of the project in which the resource belongs.
110+
If it is not provided, the provider project is used.
111+
112+
113+
<a name="nested_ddos_protection_config"></a>The `ddos_protection_config` block supports:
114+
115+
* `ddos_protection` -
116+
(Required)
117+
Google Cloud Armor offers the following options to help protect systems against DDoS attacks:
118+
- STANDARD: basic always-on protection for network load balancers, protocol forwarding, or VMs with public IP addresses.
119+
- ADVANCED: additional protections for Managed Protection Plus subscribers who use network load balancers, protocol forwarding, or VMs with public IP addresses.
120+
- ADVANCED_PREVIEW: flag to enable the security policy in preview mode.
121+
Possible values are: `ADVANCED`, `ADVANCED_PREVIEW`, `STANDARD`.
122+
123+
## Attributes Reference
124+
125+
In addition to the arguments listed above, the following computed attributes are exported:
126+
127+
* `id` - an identifier for the resource with format `projects/{{project}}/regions/{{region}}/securityPolicies/{{name}}`
128+
129+
* `policy_id` -
130+
The unique identifier for the resource. This identifier is defined by the server.
131+
132+
* `fingerprint` -
133+
Fingerprint of this resource. This field is used internally during
134+
updates of this resource.
135+
136+
* `self_link` -
137+
Server-defined URL for the resource.
138+
139+
* `self_link_with_policy_id` -
140+
Server-defined URL for this resource with the resource id.
141+
142+
143+
## Timeouts
144+
145+
This resource provides the following
146+
[Timeouts](https://developer.hashicorp.com/terraform/plugin/sdkv2/resources/retries-and-customizable-timeouts) configuration options:
147+
148+
- `create` - Default is 20 minutes.
149+
- `update` - Default is 20 minutes.
150+
- `delete` - Default is 20 minutes.
151+
152+
## Import
153+
154+
155+
RegionSecurityPolicy can be imported using any of these accepted formats:
156+
157+
```
158+
$ terraform import google_compute_region_security_policy.default projects/{{project}}/regions/{{region}}/securityPolicies/{{name}}
159+
$ terraform import google_compute_region_security_policy.default {{project}}/{{region}}/{{name}}
160+
$ terraform import google_compute_region_security_policy.default {{region}}/{{name}}
161+
$ terraform import google_compute_region_security_policy.default {{name}}
162+
```
163+
164+
## User Project Overrides
165+
166+
This resource supports [User Project Overrides](https://registry.terraform.io/providers/hashicorp/google/latest/docs/guides/provider_reference#user_project_override).

0 commit comments

Comments
 (0)