Skip to content

Commit fd64ac5

Browse files
authored
Multicast domain group (#15671)
1 parent 0a8a6bc commit fd64ac5

File tree

3 files changed

+244
-0
lines changed

3 files changed

+244
-0
lines changed
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
# Copyright 2025 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: MulticastDomainGroup
16+
description: Create a multicast domain group in the current project.
17+
base_url: projects/{{project}}/locations/{{location}}/multicastDomainGroups
18+
update_mask: true
19+
self_link:
20+
projects/{{project}}/locations/{{location}}/multicastDomainGroups/{{multicast_domain_group_id}}
21+
create_url:
22+
projects/{{project}}/locations/{{location}}/multicastDomainGroups?multicastDomainGroupId={{multicast_domain_group_id}}
23+
update_verb: PATCH
24+
id_format:
25+
projects/{{project}}/locations/{{location}}/multicastDomainGroups/{{multicast_domain_group_id}}
26+
import_format:
27+
- projects/{{project}}/locations/{{location}}/multicastDomainGroups/{{multicast_domain_group_id}}
28+
examples:
29+
- name: network_services_multicast_domain_group_basic
30+
primary_resource_id: mdg_test
31+
vars:
32+
domain_group_name: test-mdg-resource
33+
network_name: test-mdg-network
34+
domain_a_name: test-mdg-domain-a
35+
domain_b_name: test-mdg-domain-b
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: TXVsdGljYXN0RG9tYWluR3JvdXA=
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: multicastDomainGroupId
63+
type: String
64+
description: |-
65+
A unique name for the multicast domain group.
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: createTime
74+
type: String
75+
description: '[Output only] The timestamp when the multicast domain group was created.'
76+
output: true
77+
- name: description
78+
type: String
79+
description: An optional text description of the multicast domain group.
80+
- name: labels
81+
type: KeyValueLabels
82+
description: Labels as key-value pairs.
83+
- name: multicastDomains
84+
type: Array
85+
description: |-
86+
[Output only] Multicast domains associated with the group.
87+
There can be at most 2 multicast domains in a group.
88+
output: true
89+
item_type:
90+
type: String
91+
- name: name
92+
type: String
93+
description: |-
94+
Identifier. The resource name of the multicast domain group.
95+
Use the following format:
96+
`projects/*/locations/global/multicastDomainGroups/*`
97+
output: true
98+
- name: state
99+
type: NestedObject
100+
description: The multicast resource's state.
101+
output: true
102+
properties:
103+
- name: state
104+
type: String
105+
description: |-
106+
The state of the multicast resource.
107+
Possible values:
108+
CREATING
109+
ACTIVE
110+
DELETING
111+
DELETE_FAILED
112+
UPDATING
113+
UPDATE_FAILED
114+
INACTIVE
115+
- name: uniqueId
116+
type: String
117+
description: |-
118+
[Output only] The Google-generated UUID for the resource. This value is
119+
unique across all multicast domain group resources. If a domain is deleted
120+
and another with the same name is created, the new domain is assigned a
121+
different unique_id.
122+
output: true
123+
- name: updateTime
124+
type: String
125+
description: |-
126+
[Output only] The timestamp when the multicast domain group was most
127+
recently updated.
128+
output: true
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
resource "google_network_services_multicast_domain_group" "{{$.PrimaryResourceId}}"{
2+
multicast_domain_group_id = "{{index $.Vars "domain_group_name"}}"
3+
location = "global"
4+
description = "my description"
5+
labels = {
6+
fake_label = "label123"
7+
}
8+
}
9+
10+
resource "google_compute_network" "network" {
11+
name = "{{index $.Vars "network_name"}}"
12+
auto_create_subnetworks = false
13+
}
14+
15+
resource "google_network_services_multicast_domain" "multicast_domain_a" {
16+
multicast_domain_id = "{{index $.Vars "domain_a_name"}}"
17+
location = "global"
18+
admin_network = google_compute_network.network.id
19+
connection_config { connection_type="SAME_VPC"}
20+
multicast_domain_group = google_network_services_multicast_domain_group.{{$.PrimaryResourceId}}.id
21+
depends_on = [google_compute_network.network]
22+
}
23+
24+
resource "google_network_services_multicast_domain" "multicast_domain_b" {
25+
multicast_domain_id = "{{index $.Vars "domain_b_name"}}"
26+
location = "global"
27+
admin_network = google_compute_network.network.id
28+
connection_config { connection_type="SAME_VPC"}
29+
multicast_domain_group = google_network_services_multicast_domain_group.{{$.PrimaryResourceId}}.id
30+
depends_on = [google_compute_network.network]
31+
}
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
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 TestAccNetworkServicesMulticastDomainGroup_networkServicesMulticastDomainGroupUpdateExample(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: testAccCheckNetworkServicesMulticastDomainGroupDestroyProducer(t),
38+
Steps: []resource.TestStep{
39+
{
40+
Config: testAccNetworkServicesMulticastDomainGroup_networkServicesMulticastDomainGroupUpdateExample_full(context),
41+
},
42+
{
43+
ResourceName: "google_network_services_multicast_domain_group.mdg_test",
44+
ImportState: true,
45+
ImportStateVerify: true,
46+
ImportStateVerifyIgnore: []string{"labels", "location", "multicast_domain_group_id", "terraform_labels"},
47+
},
48+
{
49+
Config: testAccNetworkServicesMulticastDomainGroup_networkServicesMulticastDomainGroupUpdateExample_update(context),
50+
ConfigPlanChecks: resource.ConfigPlanChecks{
51+
PreApply: []plancheck.PlanCheck{
52+
plancheck.ExpectResourceAction("google_network_services_multicast_domain_group.mdg_test", plancheck.ResourceActionUpdate),
53+
},
54+
},
55+
},
56+
{
57+
ResourceName: "google_network_services_multicast_domain_group.mdg_test",
58+
ImportState: true,
59+
ImportStateVerify: true,
60+
ImportStateVerifyIgnore: []string{"labels", "location", "multicast_domain_group_id", "terraform_labels"},
61+
},
62+
},
63+
})
64+
}
65+
66+
func testAccNetworkServicesMulticastDomainGroup_networkServicesMulticastDomainGroupUpdateExample_full(context map[string]interface{}) string {
67+
return acctest.Nprintf(`
68+
resource "google_network_services_multicast_domain_group" "mdg_test"{
69+
multicast_domain_group_id = "tf-test-test-mdg-resource%{random_suffix}"
70+
location = "global"
71+
}
72+
`, context)
73+
}
74+
func testAccNetworkServicesMulticastDomainGroup_networkServicesMulticastDomainGroupUpdateExample_update(context map[string]interface{}) string {
75+
return acctest.Nprintf(`
76+
resource "google_network_services_multicast_domain_group" "mdg_test"{
77+
multicast_domain_group_id = "tf-test-test-mdg-resource%{random_suffix}"
78+
location = "global"
79+
description = "Updated description"
80+
labels = {
81+
"test" = "value-updated"
82+
}
83+
}
84+
`, context)
85+
}

0 commit comments

Comments
 (0)