Skip to content

Commit 79c1c67

Browse files
ScottSuarezamanMahendroo
authored andcommitted
add server-side id for a few resources (GoogleCloudPlatform#12351)
1 parent ccbd4b2 commit 79c1c67

14 files changed

+74
-2
lines changed

mmv1/products/compute/GlobalForwardingRule.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,12 @@ properties:
215215
description: |
216216
An optional description of this resource. Provide this property when
217217
you create the resource.
218+
- name: 'forwardingRuleId'
219+
type: Integer
220+
description: |
221+
The unique identifier number for the resource. This identifier is defined by the server.
222+
api_name: id
223+
output: true
218224
# This is a multi-resource resource reference (Address, GlobalAddress)
219225
- name: 'IPAddress'
220226
type: String

mmv1/products/compute/InstanceGroupManager.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,12 @@ properties:
6565
hyphen and a random four-character string to the base instance name.
6666
The base instance name must comply with RFC1035.
6767
required: true
68+
- name: 'instanceGroupManagerId'
69+
type: Integer
70+
description: |
71+
The unique identifier number for the resource. This identifier is defined by the server.
72+
api_name: id
73+
output: true
6874
- name: 'creationTimestamp'
6975
type: Time
7076
description: |

mmv1/products/compute/RegionHealthCheck.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,12 @@ properties:
141141
An optional description of this resource. Provide this property when
142142
you create the resource.
143143
send_empty_value: true
144+
- name: 'healthCheckId'
145+
type: Integer
146+
description: |
147+
The unique identifier number for the resource. This identifier is defined by the server.
148+
api_name: id
149+
output: true
144150
- name: 'healthyThreshold'
145151
type: Integer
146152
description: |

mmv1/products/compute/RegionInstanceGroupManager.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,12 @@ properties:
6464
hyphen and a random four-character string to the base instance name.
6565
The base instance name must comply with RFC1035.
6666
required: true
67+
- name: 'instanceGroupManagerId'
68+
type: Integer
69+
description: |
70+
The unique identifier number for the resource. This identifier is defined by the server.
71+
api_name: id
72+
output: true
6773
- name: 'creationTimestamp'
6874
type: Time
6975
description: |

mmv1/products/compute/RegionNetworkEndpoint.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,12 @@ properties:
128128
IPv4 address external endpoint.
129129
130130
This can only be specified when network_endpoint_type of the NEG is INTERNET_IP_PORT.
131+
- name: 'networkEndpointId'
132+
type: Integer
133+
description: |
134+
The unique identifier number for the resource. This identifier is defined by the server.
135+
api_name: id
136+
output: true
131137
- name: 'fqdn'
132138
type: String
133139
description: |

mmv1/products/compute/Subnetwork.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,12 @@ properties:
153153
An optional description of this resource. Provide this property when
154154
you create the resource. This field can be set only at resource
155155
creation time.
156+
- name: 'subnetworkId'
157+
type: Integer
158+
description: |
159+
The unique identifier number for the resource. This identifier is defined by the server.
160+
api_name: id
161+
output: true
156162
- name: 'gatewayAddress'
157163
type: String
158164
description: |

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ func TestAccComputeGlobalForwardingRule_updateTarget(t *testing.T) {
3030
Check: resource.ComposeTestCheckFunc(
3131
resource.TestMatchResourceAttr(
3232
"google_compute_global_forwarding_rule.forwarding_rule", "target", regexp.MustCompile(proxy + "$")),
33-
),
33+
resource.TestCheckResourceAttrSet(
34+
"google_compute_global_forwarding_rule.forwarding_rule", "forwarding_rule_id")),
3435
},
3536
{
3637
ResourceName: "google_compute_global_forwarding_rule.forwarding_rule",

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

+11
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,12 @@ func ResourceComputeInstanceGroupManager() *schema.Resource {
119119
Description: `An optional textual description of the instance group manager.`,
120120
},
121121

122+
"instance_group_manager_id": {
123+
Type: schema.TypeInt,
124+
Computed: true,
125+
Description: `The unique identifier number for the resource. This identifier is defined by the server.`,
126+
},
127+
122128
"fingerprint": {
123129
Type: schema.TypeString,
124130
Computed: true,
@@ -839,6 +845,11 @@ func resourceComputeInstanceGroupManagerRead(d *schema.ResourceData, meta interf
839845
if err := d.Set("description", manager.Description); err != nil {
840846
return fmt.Errorf("Error setting description: %s", err)
841847
}
848+
849+
if err := d.Set("instance_group_manager_id", manager.Id); err != nil {
850+
return fmt.Errorf("Error setting description: %s", err)
851+
}
852+
842853
if err := d.Set("project", project); err != nil {
843854
return fmt.Errorf("Error setting project: %s", err)
844855
}

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

+3
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ func TestAccInstanceGroupManager_basic(t *testing.T) {
2727
Steps: []resource.TestStep{
2828
{
2929
Config: testAccInstanceGroupManager_basic(template, target, igm1, igm2),
30+
Check: resource.ComposeTestCheckFunc(
31+
resource.TestCheckResourceAttrSet(
32+
"google_compute_instance_group_manager.igm-no-tp", "instance_group_manager_id")),
3033
},
3134
{
3235
ResourceName: "google_compute_instance_group_manager.igm-basic",

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

+4
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ func TestAccComputeRegionHealthCheck_tcp_update(t *testing.T) {
2121
Steps: []resource.TestStep{
2222
{
2323
Config: testAccComputeRegionHealthCheck_tcp(hckName),
24+
Check: resource.ComposeTestCheckFunc(
25+
resource.TestCheckResourceAttrSet(
26+
"google_compute_region_health_check.foobar", "health_check_id"),
27+
),
2428
},
2529
{
2630
ResourceName: "google_compute_region_health_check.foobar",

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

+9
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,12 @@ func ResourceComputeRegionInstanceGroupManager() *schema.Resource {
162162
Description: `An optional textual description of the instance group manager.`,
163163
},
164164

165+
"instance_group_manager_id": {
166+
Type: schema.TypeInt,
167+
Computed: true,
168+
Description: `The unique identifier number for the resource. This identifier is defined by the server.`,
169+
},
170+
165171
"fingerprint": {
166172
Type: schema.TypeString,
167173
Computed: true,
@@ -826,6 +832,9 @@ func resourceComputeRegionInstanceGroupManagerRead(d *schema.ResourceData, meta
826832
if err := d.Set("description", manager.Description); err != nil {
827833
return fmt.Errorf("Error setting description: %s", err)
828834
}
835+
if err := d.Set("instance_group_manager_id", manager.Id); err != nil {
836+
return fmt.Errorf("Error setting description: %s", err)
837+
}
829838
if err := d.Set("project", project); err != nil {
830839
return fmt.Errorf("Error setting project: %s", err)
831840
}

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

+3
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ func TestAccRegionInstanceGroupManager_basic(t *testing.T) {
2828
Steps: []resource.TestStep{
2929
{
3030
Config: testAccRegionInstanceGroupManager_basic(template, target, igm1, igm2),
31+
Check: resource.ComposeTestCheckFunc(
32+
resource.TestCheckResourceAttrSet(
33+
"google_compute_region_instance_group_manager.igm-basic", "instance_group_manager_id")),
3134
},
3235
{
3336
ResourceName: "google_compute_region_instance_group_manager.igm-basic",

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

+4
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ func TestAccComputeRegionNetworkEndpoint_regionNetworkEndpointBasic(t *testing.T
3131
{
3232
// Create one endpoint
3333
Config: testAccComputeRegionNetworkEndpoint_regionNetworkEndpointBasic(context),
34+
Check: resource.ComposeTestCheckFunc(
35+
resource.TestCheckResourceAttrSet(
36+
"google_compute_region_network_endpoint.default", "network_endpoint_id"),
37+
),
3438
},
3539
{
3640
ResourceName: "google_compute_region_network_endpoint.default",

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ func TestAccComputeSubnetwork_basic(t *testing.T) {
7878
t, "google_compute_subnetwork.network-ref-by-url", &subnetwork1),
7979
testAccCheckComputeSubnetworkExists(
8080
t, "google_compute_subnetwork.network-ref-by-name", &subnetwork2),
81-
),
81+
resource.TestCheckResourceAttrSet(
82+
"google_compute_subnetwork.network-ref-by-name", "subnetwork_id"), ),
8283
},
8384
{
8485
ResourceName: "google_compute_subnetwork.network-ref-by-url",

0 commit comments

Comments
 (0)