Skip to content

Commit 6884c99

Browse files
Create resource gateway (#7489) (#14057)
* creating gateway resource * creating gateway basic test * adding update test and shipping only to beta * adapting the network services gateway terraform examples and tests * setting location to global because dynamic one is not working * adding serverTlsPolicy field in gateway properties * removing useless comments * changing gateway scopes for each test scenario * fixing PR comments: updating attributes in properties spec * allowing the location to be parametrized Signed-off-by: Modular Magician <[email protected]>
1 parent 2f95bf2 commit 6884c99

File tree

3 files changed

+168
-0
lines changed

3 files changed

+168
-0
lines changed

.changelog/7489.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:enhancement
2+
networkservices: added resource `gateway`
3+
```
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
package google
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
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: "Network services"
16+
description: |-
17+
Gateway represents the configuration for a proxy, typically a load balancer.
18+
---
19+
20+
# google\_network\_services\_gateway
21+
22+
Gateway represents the configuration for a proxy, typically a load balancer.
23+
It captures the ip:port over which the services are exposed by the proxy,
24+
along with any policy configurations. Routes have reference to to Gateways
25+
to dictate how requests should be routed by this Gateway.
26+
27+
~> **Warning:** This resource is in beta, and should be used with the terraform-provider-google-beta provider.
28+
See [Provider Versions](https://terraform.io/docs/providers/google/guides/provider_versions.html) for more details on beta resources.
29+
30+
To get more information about Gateway, see:
31+
32+
* [API documentation](https://cloud.google.com/traffic-director/docs/reference/network-services/rest/v1beta1/projects.locations.gateways)
33+
34+
<div class = "oics-button" style="float: right; margin: 0 0 -15px">
35+
<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=network_services_gateway_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">
36+
<img alt="Open in Cloud Shell" src="//gstatic.com/cloudssh/images/open-btn.svg" style="max-height: 44px; margin: 32px auto; max-width: 100%;">
37+
</a>
38+
</div>
39+
## Example Usage - Network Services Gateway Basic
40+
41+
42+
```hcl
43+
resource "google_network_services_gateway" "default" {
44+
provider = google-beta
45+
name = "my-gateway"
46+
scope = "default-scope-basic"
47+
type = "OPEN_MESH"
48+
ports = [443]
49+
}
50+
```
51+
<div class = "oics-button" style="float: right; margin: 0 0 -15px">
52+
<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=network_services_gateway_advanced&cloudshell_image=gcr.io%2Fgraphite-cloud-shell-images%2Fterraform%3Alatest&open_in_editor=main.tf&cloudshell_print=.%2Fmotd&cloudshell_tutorial=.%2Ftutorial.md" target="_blank">
53+
<img alt="Open in Cloud Shell" src="//gstatic.com/cloudssh/images/open-btn.svg" style="max-height: 44px; margin: 32px auto; max-width: 100%;">
54+
</a>
55+
</div>
56+
## Example Usage - Network Services Gateway Advanced
57+
58+
59+
```hcl
60+
resource "google_network_services_gateway" "default" {
61+
provider = google-beta
62+
name = "my-gateway"
63+
labels = {
64+
foo = "bar"
65+
}
66+
description = "my description"
67+
type = "OPEN_MESH"
68+
ports = [443]
69+
scope = "default-scope-advance"
70+
}
71+
```
72+
73+
## Argument Reference
74+
75+
The following arguments are supported:
76+
77+
78+
* `type` -
79+
(Required)
80+
Immutable. The type of the customer-managed gateway. Possible values are: * OPEN_MESH * SECURE_WEB_GATEWAY.
81+
Possible values are `TYPE_UNSPECIFIED`, `OPEN_MESH`, and `SECURE_WEB_GATEWAY`.
82+
83+
* `ports` -
84+
(Required)
85+
One or more port numbers (1-65535), on which the Gateway will receive traffic.
86+
The proxy binds to the specified ports. Gateways of type 'SECURE_WEB_GATEWAY' are
87+
limited to 1 port. Gateways of type 'OPEN_MESH' listen on 0.0.0.0 and support multiple ports.
88+
89+
* `scope` -
90+
(Required)
91+
Immutable. Scope determines how configuration across multiple Gateway instances are merged.
92+
The configuration for multiple Gateway instances with the same scope will be merged as presented as
93+
a single coniguration to the proxy/load balancer.
94+
Max length 64 characters. Scope should start with a letter and can only have letters, numbers, hyphens.
95+
96+
* `name` -
97+
(Required)
98+
Short name of the Gateway resource to be created.
99+
100+
101+
- - -
102+
103+
104+
* `labels` -
105+
(Optional)
106+
Set of label tags associated with the Gateway resource.
107+
108+
* `description` -
109+
(Optional)
110+
A free-text description of the resource. Max length 1024 characters.
111+
112+
* `server_tls_policy` -
113+
(Optional)
114+
A fully-qualified ServerTLSPolicy URL reference. Specifies how TLS traffic is terminated.
115+
If empty, TLS termination is disabled.
116+
117+
* `location` -
118+
(Optional)
119+
The location of the gateway.
120+
The default value is `global`.
121+
122+
* `project` - (Optional) The ID of the project in which the resource belongs.
123+
If it is not provided, the provider project is used.
124+
125+
126+
## Attributes Reference
127+
128+
In addition to the arguments listed above, the following computed attributes are exported:
129+
130+
* `id` - an identifier for the resource with format `projects/{{project}}/locations/{{location}}/gateways/{{name}}`
131+
132+
* `self_link` -
133+
Server-defined URL of this resource.
134+
135+
* `create_time` -
136+
Time the AccessPolicy was created in UTC.
137+
138+
* `update_time` -
139+
Time the AccessPolicy was updated in UTC.
140+
141+
142+
## Timeouts
143+
144+
This resource provides the following
145+
[Timeouts](https://developer.hashicorp.com/terraform/plugin/sdkv2/resources/retries-and-customizable-timeouts) configuration options:
146+
147+
- `create` - Default is 30 minutes.
148+
- `update` - Default is 30 minutes.
149+
- `delete` - Default is 30 minutes.
150+
151+
## Import
152+
153+
154+
Gateway can be imported using any of these accepted formats:
155+
156+
```
157+
$ terraform import google_network_services_gateway.default projects/{{project}}/locations/{{location}}/gateways/{{name}}
158+
$ terraform import google_network_services_gateway.default {{project}}/{{location}}/{{name}}
159+
$ terraform import google_network_services_gateway.default {{location}}/{{name}}
160+
```
161+
162+
## User Project Overrides
163+
164+
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)