Skip to content

Commit 9f33eb2

Browse files
Change the snake_case name of the WireGroup
resource to camelCase in the Terraform template and test file. Add Changes to test-file.
1 parent 9f6b851 commit 9f33eb2

File tree

3 files changed

+75
-38
lines changed

3 files changed

+75
-38
lines changed

mmv1/products/compute/WireGroup.yaml

Lines changed: 47 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ id_format: 'projects/{{project}}/global/crossSiteNetworks/{{cross_site_network}}
2727
base_url: 'projects/{{project}}/global/crossSiteNetworks/{{cross_site_network}}/wireGroups'
2828
self_link: 'projects/{{project}}/global/crossSiteNetworks/{{cross_site_network}}/wireGroups/{{name}}'
2929
update_verb: 'PATCH'
30+
update_mask: true
3031
import_format:
3132
- 'projects/{{project}}/global/crossSiteNetworks/{{cross_site_network}}/wireGroups/{{name}}'
3233
timeouts:
@@ -40,6 +41,8 @@ async:
4041
base_url: '{{op_id}}'
4142
result:
4243
resource_inside_response: false
44+
custom_code:
45+
test_check_destroy: 'templates/terraform/custom_check_destroy/wire_group.go.tmpl'
4346
examples:
4447
- name: 'compute_wire_group_basic'
4548
primary_resource_id: 'example-test-wire-group'
@@ -61,6 +64,7 @@ parameters:
6164
imports: 'name'
6265
diff_suppress_func: 'tpgresource.CompareResourceNames'
6366
custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.tmpl'
67+
min_version: beta
6468
properties:
6569
- name: 'description'
6670
type: String
@@ -80,7 +84,6 @@ properties:
8084
character must be a lowercase letter, and all following characters must be a dash,
8185
lowercase letter, or digit, except the last character, which cannot be a dash.
8286
required: true
83-
immutable:
8487
validation:
8588
regex: '^[a-z]([-a-z0-9]*[a-z0-9])?$'
8689
- name: endpoints
@@ -101,11 +104,11 @@ properties:
101104
VLAN tags for the interconnect.
102105
item_type:
103106
type: integer
104-
- name: admin_enabled
107+
- name: adminEnabled
105108
type: boolean
106109
description: |
107110
Indicates whether the wire group is administratively enabled.
108-
- name: wire_group_properties
111+
- name: wireGroupProperties
109112
type: NestedObject
110113
description: |
111114
Properties specific to the wire group.
@@ -121,16 +124,16 @@ properties:
121124
- 'WIRE'
122125
- 'REDUNDANT'
123126
- 'BOX_AND_CROSS'
124-
- name: wire_properties
127+
- name: wireProperties
125128
type: NestedObject
126129
description: |
127130
Default properties for wires within the group.
128131
properties:
129-
- name: bandwidth_unmetered
132+
- name: bandwidthUnmetered
130133
type: Integer
131134
description: |
132135
The unmetered bandwidth setting.
133-
- name: fault_response
136+
- name: faultResponse
134137
type: enum
135138
description: |
136139
Response when a fault is detected in a pseudowire:
@@ -140,45 +143,51 @@ properties:
140143
- 'NONE'
141144
- 'DISABLE_PORT'
142145
- name: wires
143-
type: NestedObject
146+
type: Array
144147
description: |
145148
The single/redundant wire(s) managed by the wire group.
146149
output: true
147-
properties:
148-
- name: label
149-
type: string
150-
- name: endpoints
151-
type: NestedObject
152-
description: |
153-
'Wire endpoints are specific Interconnect connections.'
154-
properties:
155-
- name: interconnect
156-
type: string
157-
- name: vlan_tag
158-
type: integer
159-
- name: wire_properties
160-
type: NestedObject
161-
output: true
162-
properties:
163-
- name: bandwidth_unmetered
164-
type: Integer
165-
- name: fault_response
166-
type: enum
167-
enum_values:
168-
- 'NONE'
169-
- 'DISABLE_PORT'
170-
- name: admin_enabled
171-
type: boolean
150+
item_type:
151+
type: NestedObject
152+
properties:
153+
- name: label
154+
type: string
155+
- name: endpoints
156+
type: Array
157+
description: |
158+
'Wire endpoints are specific Interconnect connections.'
159+
item_type:
160+
type: NestedObject
161+
properties:
162+
- name: interconnect
163+
type: string
164+
- name: vlanTag
165+
type: integer
166+
- name: wireProperties
167+
type: NestedObject
168+
output: true # This is redundant if the parent 'wires' is output: true, but harmless
169+
properties:
170+
- name: bandwidthUnmetered
171+
type: Integer
172+
- name: faultResponse
173+
type: enum
174+
enum_values:
175+
- 'NONE'
176+
- 'DISABLE_PORT'
177+
- name: adminEnabled
178+
type: boolean
172179
- name: topology
173180
type: NestedObject
174181
description: |
175182
Topology details for the wire group configuration.
176183
output: true
177184
properties:
178185
- name: endpoints
179-
type: NestedObject
180-
properties:
181-
- name: label
182-
type: string
183-
- name: city
184-
type: string
186+
type: Array
187+
item_type:
188+
type: NestedObject
189+
properties:
190+
- name: label
191+
type: string
192+
- name: city
193+
type: string
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
config := acctest.GoogleProviderConfig(t)
2+
url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{"{{"}}ComputeBasePath{{"}}"}}projects/{{"{{"}}project{{"}}"}}/global/crossSiteNetworks/{{"{{"}}cross_site_network{{"}}"}}/wireGroups/{{"{{"}}name{{"}}"}}")
3+
if err != nil {
4+
return err
5+
}
6+
7+
billingProject := ""
8+
9+
if config.BillingProject != "" {
10+
billingProject = config.BillingProject
11+
}
12+
13+
_, err = transport_tpg.SendRequest(transport_tpg.SendRequestOptions{
14+
Config: config,
15+
Method: "GET",
16+
Project: billingProject,
17+
RawURL: url,
18+
UserAgent: config.UserAgent,
19+
})
20+
if err == nil {
21+
return fmt.Errorf("ComputeWireGroup still exists at %s", url)
22+
}

mmv1/third_party/terraform/services/compute/resource_compute_wire_group_test.go.tmpl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"testing"
55

66
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
7+
"github.com/hashicorp/terraform-plugin-testing/plancheck"
78

89
"github.com/hashicorp/terraform-provider-google/google/acctest"
910
"github.com/hashicorp/terraform-provider-google/google/envvar"
@@ -33,6 +34,11 @@ func TestAccComputeWireGroup_update(t *testing.T) {
3334
},
3435
{
3536
Config: testAccComputeWireGroup_update(context),
37+
ConfigPlanChecks: resource.ConfigPlanChecks{
38+
PreApply: []plancheck.PlanCheck{
39+
plancheck.ExpectResourceAction("google_compute_wire_group.example-test-wire-group", plancheck.ResourceActionUpdate),
40+
},
41+
},
3642
Check: resource.ComposeTestCheckFunc(
3743
resource.TestCheckResourceAttr("google_compute_wire_group.example-test-wire-group", "description", "Example Wire Group Updated"+context["random_suffix"].(string)),
3844
),

0 commit comments

Comments
 (0)