Skip to content

Commit 429abd0

Browse files
authored
Multicast domain activation (#15670)
1 parent b05db3d commit 429abd0

File tree

3 files changed

+285
-0
lines changed

3 files changed

+285
-0
lines changed
Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
# Copyright 2024 Google Inc.
2+
# Licensed under the Apache License, Version 2.0 (the "License");
3+
# you may not use this file except in compliance with the License.
4+
# You may obtain a copy of the License at
5+
#
6+
# http://www.apache.org/licenses/LICENSE-2.0
7+
#
8+
# Unless required by applicable law or agreed to in writing, software
9+
# distributed under the License is distributed on an "AS IS" BASIS,
10+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
# See the License for the specific language governing permissions and
12+
# limitations under the License.
13+
14+
---
15+
name: MulticastDomainActivation
16+
description: Create a multicast domain activation in the specified location of
17+
the current project.
18+
base_url: projects/{{project}}/locations/{{location}}/multicastDomainActivations
19+
update_mask: true
20+
self_link:
21+
projects/{{project}}/locations/{{location}}/multicastDomainActivations/{{multicast_domain_activation_id}}
22+
create_url:
23+
projects/{{project}}/locations/{{location}}/multicastDomainActivations?multicastDomainActivationId={{multicast_domain_activation_id}}
24+
update_verb: PATCH
25+
id_format:
26+
projects/{{project}}/locations/{{location}}/multicastDomainActivations/{{multicast_domain_activation_id}}
27+
import_format:
28+
- projects/{{project}}/locations/{{location}}/multicastDomainActivations/{{multicast_domain_activation_id}}
29+
examples:
30+
- name: network_services_multicast_domain_activation_basic
31+
primary_resource_id: mda_test
32+
vars:
33+
network_name: test-network-mda
34+
domain_name: test-domain-mda
35+
domain_activation_name: test-domain-activation-mda
36+
autogen_async: true
37+
async:
38+
operation:
39+
timeouts:
40+
insert_minutes: 20
41+
update_minutes: 20
42+
delete_minutes: 20
43+
base_url: '{{op_id}}'
44+
actions:
45+
- create
46+
- delete
47+
- update
48+
type: OpAsync
49+
result:
50+
resource_inside_response: true
51+
include_project: false
52+
autogen_status: TXVsdGljYXN0RG9tYWluQWN0aXZhdGlvbg==
53+
parameters:
54+
- name: location
55+
type: String
56+
description: Resource ID segment making up resource `name`. It identifies the
57+
resource within its parent collection as described in
58+
https://google.aip.dev/122.
59+
immutable: true
60+
url_param_only: true
61+
required: true
62+
- name: multicastDomainActivationId
63+
type: String
64+
description: |-
65+
A unique name for the multicast domain activation.
66+
The name is restricted to letters, numbers, and hyphen, with the first
67+
character a letter, and the last a letter or a number. The name must not
68+
exceed 48 characters.
69+
immutable: true
70+
url_param_only: true
71+
required: true
72+
properties:
73+
- name: adminNetwork
74+
type: String
75+
description: '[Output only] The URL of the admin network.'
76+
output: true
77+
- name: createTime
78+
type: String
79+
description: |-
80+
[Output only] The timestamp when the multicast domain activation was
81+
created.
82+
output: true
83+
- name: description
84+
type: String
85+
description: An optional text description of the multicast domain activation.
86+
- name: labels
87+
type: KeyValueLabels
88+
description: Labels as key-value pairs
89+
- name: multicastDomain
90+
type: String
91+
description: |-
92+
The resource name of the multicast domain to activate.
93+
Use the following format:
94+
`projects/*/locations/global/multicastDomains/*`.
95+
immutable: true
96+
- name: name
97+
type: String
98+
description: |-
99+
Identifier. The resource name of the multicast domain activation.
100+
Use the following format:
101+
`projects/*/locations/*/multicastDomainActivations/*`.
102+
output: true
103+
- name: trafficSpec
104+
type: NestedObject
105+
description: |-
106+
Specifies the traffic volume and multicast group scale parameters that are
107+
used to set up multicast infrastructure for a multicast domain in a zone.
108+
properties:
109+
- name: aggrEgressPps
110+
type: String
111+
description: |-
112+
Aggregated egress Packet-Per-Second for all multicast groups in the domain
113+
in this zone.
114+
- name: aggrIngressPps
115+
type: String
116+
description: |-
117+
Aggregated ingress Packet-Per-Second for all multicast groups in the domain
118+
in this zone. Default to (aggregated_egress_pps /
119+
max_per_group_subscribers) * 2.
120+
- name: avgPacketSize
121+
type: Integer
122+
description: Average packet size (Default to 512 bytes).
123+
- name: maxPerGroupIngressPps
124+
type: String
125+
description: |-
126+
Maximum ingress Packet-Per-Second for a single multicast group in this
127+
zone. Default to aggregated_ingress_pps / 2.
128+
- name: maxPerGroupSubscribers
129+
type: String
130+
description: |-
131+
Maximum number of subscribers for a single multicast group in this zone.
132+
Default to max(50, aggregated_egress_pps / aggregated_ingress_pps).
133+
- name: uniqueId
134+
type: String
135+
description: |-
136+
[Output only] The Google-generated UUID for the resource. This value is
137+
unique across all multicast domain activation resources. If a domain
138+
activation is deleted and another with the same name is created, the new
139+
domain activation is assigned a different unique_id.
140+
output: true
141+
- name: updateTime
142+
type: String
143+
description: |-
144+
[Output only] The timestamp when the multicast domain activation was most
145+
recently updated.
146+
output: true
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
resource "google_compute_network" "network" {
2+
name = "{{index $.Vars "network_name"}}"
3+
auto_create_subnetworks = false
4+
}
5+
6+
resource "google_network_services_multicast_domain" "multicast_domain" {
7+
multicast_domain_id = "{{index $.Vars "domain_name"}}"
8+
location = "global"
9+
admin_network = google_compute_network.network.id
10+
connection_config { connection_type="SAME_VPC"}
11+
depends_on = [google_compute_network.network]
12+
}
13+
14+
resource "google_network_services_multicast_domain_activation" {{$.PrimaryResourceId}} {
15+
multicast_domain_activation_id = "{{index $.Vars "domain_activation_name"}}"
16+
location = "us-central1-b"
17+
multicast_domain = google_network_services_multicast_domain.multicast_domain.id
18+
}
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
// Copyright (c) HashiCorp, Inc.
2+
// SPDX-License-Identifier: MPL-2.0
3+
4+
// ----------------------------------------------------------------------------
5+
//
6+
// *** AUTO GENERATED CODE *** Type: MMv1 ***
7+
//
8+
// ----------------------------------------------------------------------------
9+
//
10+
// This file is automatically generated by Magic Modules and manual
11+
// changes will be clobbered when the file is regenerated.
12+
//
13+
// Please read more about how to change this file in
14+
// .github/CONTRIBUTING.md.
15+
//
16+
// ----------------------------------------------------------------------------
17+
18+
package networkservices_test
19+
20+
import (
21+
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
22+
"github.com/hashicorp/terraform-plugin-testing/plancheck"
23+
"github.com/hashicorp/terraform-provider-google/google/acctest"
24+
"testing"
25+
)
26+
27+
func TestAccNetworkServicesMulticastDomainActivation_networkServicesMulticastDomainActivationUpdateExample(t *testing.T) {
28+
t.Parallel()
29+
30+
context := map[string]interface{}{
31+
"random_suffix": acctest.RandString(t, 10),
32+
}
33+
34+
acctest.VcrTest(t, resource.TestCase{
35+
PreCheck: func() { acctest.AccTestPreCheck(t) },
36+
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
37+
CheckDestroy: testAccCheckNetworkServicesMulticastDomainActivationDestroyProducer(t),
38+
Steps: []resource.TestStep{
39+
{
40+
Config: testAccNetworkServicesMulticastDomainActivation_networkServicesMulticastDomainActivationBasicExample_full(context),
41+
},
42+
{
43+
ResourceName: "google_network_services_multicast_domain_activation.mda_test",
44+
ImportState: true,
45+
ImportStateVerify: true,
46+
ImportStateVerifyIgnore: []string{"labels", "location", "multicast_domain_activation_id", "terraform_labels"},
47+
},
48+
{
49+
Config: testAccNetworkServicesMulticastDomainActivation_networkServicesMulticastDomainActivationBasicExample_update(context),
50+
ConfigPlanChecks: resource.ConfigPlanChecks{
51+
PreApply: []plancheck.PlanCheck{
52+
plancheck.ExpectResourceAction("google_network_services_multicast_domain_activation.mda_test", plancheck.ResourceActionUpdate),
53+
},
54+
},
55+
},
56+
{
57+
ResourceName: "google_network_services_multicast_domain_activation.mda_test",
58+
ImportState: true,
59+
ImportStateVerify: true,
60+
ImportStateVerifyIgnore: []string{"labels", "location", "multicast_domain_activation_id", "terraform_labels"},
61+
},
62+
},
63+
})
64+
}
65+
66+
func testAccNetworkServicesMulticastDomainActivation_networkServicesMulticastDomainActivationBasicExample_full(context map[string]interface{}) string {
67+
return acctest.Nprintf(`
68+
resource "google_compute_network" "network" {
69+
name = "tf-test-test-network-mda%{random_suffix}"
70+
auto_create_subnetworks = false
71+
}
72+
73+
resource "google_network_services_multicast_domain" "multicast_domain" {
74+
multicast_domain_id = "tf-test-test-domain-mda%{random_suffix}"
75+
location = "global"
76+
admin_network = google_compute_network.network.id
77+
connection_config { connection_type="SAME_VPC"}
78+
depends_on = [google_compute_network.network]
79+
}
80+
81+
resource "google_network_services_multicast_domain_activation" mda_test {
82+
multicast_domain_activation_id = "tf-test-test-domain-activation-mda%{random_suffix}"
83+
location = "us-central1-b"
84+
multicast_domain = google_network_services_multicast_domain.multicast_domain.id
85+
}
86+
`, context)
87+
}
88+
89+
func testAccNetworkServicesMulticastDomainActivation_networkServicesMulticastDomainActivationBasicExample_update(context map[string]interface{}) string {
90+
return acctest.Nprintf(`
91+
resource "google_compute_network" "network" {
92+
name = "tf-test-test-network-mda%{random_suffix}"
93+
auto_create_subnetworks = false
94+
}
95+
96+
resource "google_network_services_multicast_domain" "multicast_domain" {
97+
multicast_domain_id = "tf-test-test-domain-mda%{random_suffix}"
98+
location = "global"
99+
admin_network = google_compute_network.network.id
100+
connection_config { connection_type="SAME_VPC"}
101+
depends_on = [google_compute_network.network]
102+
}
103+
104+
resource "google_network_services_multicast_domain_activation" mda_test {
105+
multicast_domain_activation_id = "tf-test-test-domain-activation-mda%{random_suffix}"
106+
location = "us-central1-b"
107+
multicast_domain = google_network_services_multicast_domain.multicast_domain.id
108+
description = "my description"
109+
labels = {
110+
fake_label = "label123"
111+
}
112+
traffic_spec {
113+
aggr_egress_pps = "1000"
114+
aggr_ingress_pps = "500"
115+
avg_packet_size = 100
116+
max_per_group_ingress_pps = "100"
117+
max_per_group_subscribers = "1"
118+
}
119+
}
120+
`, context)
121+
}

0 commit comments

Comments
 (0)