forked from GoogleCloudPlatform/magic-modules
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Network and Subnet resources for edgenetwork (GoogleCloudPlatform…
…#8905) * Add Network and Subnet resources for edgenetwork * Fix lint * Added labels field to acceptance tests; Removed send_empty_value:false from vlan_id field in Subnet * Skip edgenetwork acceptance tests
- Loading branch information
Showing
7 changed files
with
333 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
# Copyright 2023 Google Inc. | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
--- !ruby/object:Api::Resource | ||
name: 'Network' | ||
description: | | ||
A Distributed Cloud Edge network, which provides L3 isolation within a zone. | ||
references: !ruby/object:Api::Resource::ReferenceLinks | ||
api: 'https://cloud.google.com/distributed-cloud/edge/latest/docs/reference/network/rest/v1/projects.locations.zones.networks' | ||
guides: | ||
'Create and manage networks': 'https://cloud.google.com/distributed-cloud/edge/latest/docs/networks#api' | ||
base_url: 'projects/{{project}}/locations/{{location}}/zones/{{zone}}/networks' | ||
self_link: 'projects/{{project}}/locations/{{location}}/zones/{{zone}}/networks/{{network_id}}' | ||
create_url: 'projects/{{project}}/locations/{{location}}/zones/{{zone}}/networks?networkId={{network_id}}' | ||
immutable: true | ||
autogen_async: true | ||
timeouts: !ruby/object:Api::Timeouts | ||
delete_minutes: 30 | ||
import_format: ['projects/{{project}}/locations/{{location}}/zones/{{zone}}/networks/{{network_id}}', '{{name}}'] | ||
examples: | ||
- !ruby/object:Provider::Terraform::Examples | ||
name: 'edgenetwork_network' | ||
primary_resource_id: 'example_network' | ||
skip_test: true | ||
vars: | ||
edgenetwork_network_id: 'example-network' | ||
test_env_vars: | ||
location: :REGION | ||
zone: :ZONE | ||
parameters: | ||
- !ruby/object:Api::Type::String | ||
name: 'location' | ||
required: true | ||
immutable: true | ||
url_param_only: true | ||
description: | | ||
The Google Cloud region to which the target Distributed Cloud Edge zone belongs. | ||
- !ruby/object:Api::Type::String | ||
name: 'zone' | ||
required: true | ||
immutable: true | ||
url_param_only: true | ||
description: | | ||
The name of the target Distributed Cloud Edge zone. | ||
- !ruby/object:Api::Type::String | ||
name: 'network_id' | ||
required: true | ||
immutable: true | ||
url_param_only: true | ||
description: | | ||
A unique ID that identifies this network. | ||
properties: | ||
- !ruby/object:Api::Type::String | ||
name: 'name' | ||
output: true | ||
description: | | ||
The canonical name of this resource, with format | ||
`projects/{{project}}/locations/{{location}}/zones/{{zone}}/networks/{{network_id}}` | ||
- !ruby/object:Api::Type::KeyValuePairs | ||
name: 'labels' | ||
required: false | ||
description: | | ||
Labels associated with this resource. | ||
- !ruby/object:Api::Type::String | ||
name: 'description' | ||
required: false | ||
description: | | ||
A free-text description of the resource. Max length 1024 characters. | ||
- !ruby/object:Api::Type::String | ||
name: 'createTime' | ||
output: true | ||
description: | | ||
The time when the subnet was created. | ||
A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine | ||
fractional digits. Examples: `2014-10-02T15:01:23Z` and `2014-10-02T15:01:23.045123456Z`. | ||
- !ruby/object:Api::Type::String | ||
name: 'updateTime' | ||
output: true | ||
description: | | ||
The time when the subnet was last updated. | ||
A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine | ||
fractional digits. Examples: `2014-10-02T15:01:23Z` and `2014-10-02T15:01:23.045123456Z`. | ||
- !ruby/object:Api::Type::Integer | ||
name: 'mtu' | ||
default_value: 1500 | ||
description: | | ||
IP (L3) MTU value of the network. Default value is `1500`. Possible values are: `1500`, `9000`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
# Copyright 2023 Google Inc. | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
--- !ruby/object:Api::Resource | ||
name: 'Subnet' | ||
description: | | ||
A Distributed Cloud Edge subnet, which provides L2 isolation within a network. | ||
references: !ruby/object:Api::Resource::ReferenceLinks | ||
api: 'https://cloud.google.com/distributed-cloud/edge/latest/docs/reference/network/rest/v1/projects.locations.zones.subnets' | ||
guides: | ||
'Create and manage subnetworks': 'https://cloud.google.com/distributed-cloud/edge/latest/docs/subnetworks#api' | ||
base_url: 'projects/{{project}}/locations/{{location}}/zones/{{zone}}/subnets' | ||
self_link: 'projects/{{project}}/locations/{{location}}/zones/{{zone}}/subnets/{{subnet_id}}' | ||
create_url: 'projects/{{project}}/locations/{{location}}/zones/{{zone}}/subnets?subnetId={{subnet_id}}' | ||
immutable: true | ||
autogen_async: true | ||
timeouts: !ruby/object:Api::Timeouts | ||
delete_minutes: 30 | ||
import_format: ['projects/{{project}}/locations/{{location}}/zones/{{zone}}/subnets/{{subnet_id}}', '{{name}}'] | ||
examples: | ||
- !ruby/object:Provider::Terraform::Examples | ||
name: 'edgenetwork_subnet' | ||
primary_resource_id: 'example_subnet' | ||
skip_test: true | ||
vars: | ||
edgenetwork_subnet_id: 'example-subnet' | ||
edgenetwork_network_id: 'example-network' | ||
test_env_vars: | ||
location: :REGION | ||
zone: :ZONE | ||
- !ruby/object:Provider::Terraform::Examples | ||
name: 'edgenetwork_subnet_with_vlan_id' | ||
primary_resource_id: 'example_subnet_with_vlan_id' | ||
skip_test: true | ||
vars: | ||
edgenetwork_subnet_id: 'example-subnet-with-vlan-id' | ||
edgenetwork_network_id: 'example-network' | ||
test_env_vars: | ||
location: :REGION | ||
zone: :ZONE | ||
parameters: | ||
- !ruby/object:Api::Type::String | ||
name: 'location' | ||
required: true | ||
immutable: true | ||
url_param_only: true | ||
description: | | ||
The Google Cloud region to which the target Distributed Cloud Edge zone belongs. | ||
- !ruby/object:Api::Type::String | ||
name: 'zone' | ||
required: true | ||
immutable: true | ||
url_param_only: true | ||
description: | | ||
The name of the target Distributed Cloud Edge zone. | ||
- !ruby/object:Api::Type::String | ||
name: 'subnet_id' | ||
required: true | ||
immutable: true | ||
url_param_only: true | ||
description: | | ||
A unique ID that identifies this subnet. | ||
properties: | ||
- !ruby/object:Api::Type::String | ||
name: 'name' | ||
output: true | ||
description: | | ||
The canonical name of this resource, with format | ||
`projects/{{project}}/locations/{{location}}/zones/{{zone}}/subnets/{{subnet_id}}` | ||
- !ruby/object:Api::Type::KeyValuePairs | ||
name: 'labels' | ||
required: false | ||
description: | | ||
Labels associated with this resource. | ||
- !ruby/object:Api::Type::String | ||
name: 'description' | ||
required: false | ||
description: | | ||
A free-text description of the resource. Max length 1024 characters. | ||
- !ruby/object:Api::Type::String | ||
name: 'createTime' | ||
output: true | ||
description: | | ||
The time when the subnet was created. | ||
A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine | ||
fractional digits. Examples: `2014-10-02T15:01:23Z` and `2014-10-02T15:01:23.045123456Z`. | ||
- !ruby/object:Api::Type::String | ||
name: 'updateTime' | ||
output: true | ||
description: | | ||
The time when the subnet was last updated. | ||
A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine | ||
fractional digits. Examples: `2014-10-02T15:01:23Z` and `2014-10-02T15:01:23.045123456Z`. | ||
- !ruby/object:Api::Type::ResourceRef | ||
name: 'network' | ||
resource: 'Network' | ||
imports: 'name' | ||
required: true | ||
custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' | ||
description: | | ||
The ID of the network to which this router belongs. | ||
Must be of the form: `projects/{{project}}/locations/{{location}}/zones/{{zone}}/networks/{{network_id}}` | ||
- !ruby/object:Api::Type::Array | ||
name: 'ipv4Cidr' | ||
item_type: Api::Type::String | ||
description: | | ||
The ranges of ipv4 addresses that are owned by this subnetwork, in CIDR format. | ||
- !ruby/object:Api::Type::Array | ||
name: 'ipv6Cidr' | ||
item_type: Api::Type::String | ||
description: | | ||
The ranges of ipv6 addresses that are owned by this subnetwork, in CIDR format. | ||
- !ruby/object:Api::Type::Integer | ||
name: 'vlanId' | ||
default_from_api: true | ||
description: | | ||
VLAN ID for this subnetwork. If not specified, one is assigned automatically. | ||
- !ruby/object:Api::Type::Enum | ||
name: 'state' | ||
output: true | ||
values: | ||
- :STATE_PENDING | ||
- :STATE_PROVISIONING | ||
- :STATE_RUNNING | ||
- :STATE_SUSPENDED | ||
- :STATE_DELETING | ||
description: | | ||
Current stage of the resource to the device by config push. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Copyright 2023 Google Inc. | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
--- !ruby/object:Api::Product | ||
name: Edgenetwork | ||
display_name: Distributed Cloud Edge Network | ||
versions: | ||
- !ruby/object:Api::Product::Version | ||
name: ga | ||
base_url: https://edgenetwork.googleapis.com/v1/ | ||
scopes: | ||
- https://www.googleapis.com/auth/cloud-platform | ||
apis_required: | ||
- !ruby/object:Api::Product::ApiReference | ||
name: Distributed Cloud Edge Network API | ||
url: https://console.cloud.google.com/apis/library/edgenetwork.googleapis.com | ||
async: !ruby/object:Api::OpAsync | ||
operation: !ruby/object:Api::OpAsync::Operation | ||
path: 'name' | ||
base_url: '{{op_id}}' | ||
wait_ms: 1000 | ||
result: !ruby/object:Api::OpAsync::Result | ||
path: 'response' | ||
status: !ruby/object:Api::OpAsync::Status | ||
path: 'done' | ||
complete: true | ||
allowed: | ||
- true | ||
- false | ||
error: !ruby/object:Api::OpAsync::Error | ||
path: 'error' | ||
message: 'message' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
mmv1/templates/terraform/examples/edgenetwork_network.tf.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
resource "google_edgenetwork_network" "<%= ctx[:primary_resource_id] %>" { | ||
network_id = "<%= ctx[:vars]['edgenetwork_network_id'] %>" | ||
location = "<%= ctx[:test_env_vars]['location'] %>" | ||
zone = "<%= ctx[:test_env_vars]['zone'] %>" | ||
description = "Example network." | ||
mtu = 9000 | ||
labels = { | ||
"environment" : "dev" | ||
} | ||
} | ||
|
||
|
20 changes: 20 additions & 0 deletions
20
mmv1/templates/terraform/examples/edgenetwork_subnet.tf.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
|
||
resource "google_edgenetwork_subnet" "<%= ctx[:primary_resource_id] %>" { | ||
subnet_id = "<%= ctx[:vars]['edgenetwork_subnet_id'] %>" | ||
location = "<%= ctx[:test_env_vars]['location'] %>" | ||
zone = "<%= ctx[:test_env_vars]['zone'] %>" | ||
description = "Example subnet." | ||
network = google_edgenetwork_network.example_network.id | ||
ipv4_cidr = ["4.4.4.1/24"] | ||
labels = { | ||
"environment" : "dev" | ||
} | ||
} | ||
|
||
resource "google_edgenetwork_network" "example_network" { | ||
network_id = "<%= ctx[:vars]['edgenetwork_network_id'] %>" | ||
location = "<%= ctx[:test_env_vars]['location'] %>" | ||
zone = "<%= ctx[:test_env_vars]['zone'] %>" | ||
description = "Example network." | ||
mtu = 9000 | ||
} |
22 changes: 22 additions & 0 deletions
22
mmv1/templates/terraform/examples/edgenetwork_subnet_with_vlan_id.tf.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
|
||
resource "google_edgenetwork_subnet" "<%= ctx[:primary_resource_id] %>" { | ||
subnet_id = "<%= ctx[:vars]['edgenetwork_subnet_id'] %>" | ||
location = "<%= ctx[:test_env_vars]['location'] %>" | ||
zone = "<%= ctx[:test_env_vars]['zone'] %>" | ||
description = "Example subnet with VLAN ID." | ||
network = google_edgenetwork_network.example_network.id | ||
ipv6_cidr = ["4444:4444:4444:4444::1/64"] | ||
vlan_id = 44 | ||
labels = { | ||
"environment" : "dev" | ||
} | ||
} | ||
|
||
resource "google_edgenetwork_network" "example_network" { | ||
network_id = "<%= ctx[:vars]['edgenetwork_network_id'] %>" | ||
location = "<%= ctx[:test_env_vars]['location'] %>" | ||
zone = "<%= ctx[:test_env_vars]['zone'] %>" | ||
description = "Example network." | ||
mtu = 9000 | ||
} | ||
|