Skip to content

Commit 51bf081

Browse files
lawliet89rileykarson
authored andcommitted
Fix incorrect arguments for google_compute_instance data source (#2874)
Fixes #2535
1 parent 6d3add7 commit 51bf081

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

google/data_source_google_compute_instance.go

+2-4
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,16 @@ package google
22

33
import (
44
"fmt"
5+
56
"github.com/hashicorp/terraform/helper/schema"
67
)
78

89
func dataSourceGoogleComputeInstance() *schema.Resource {
910
// Generate datasource schema from resource
1011
dsSchema := datasourceSchemaFromResourceSchema(resourceComputeInstance().Schema)
1112

12-
// Set 'Required' schema elements
13-
addRequiredFieldsToSchema(dsSchema, "name")
14-
1513
// Set 'Optional' schema elements
16-
addOptionalFieldsToSchema(dsSchema, "project", "zone")
14+
addOptionalFieldsToSchema(dsSchema, "name", "self_link", "project", "zone")
1715

1816
return &schema.Resource{
1917
Read: dataSourceGoogleComputeInstanceRead,

google/data_source_google_compute_instance_test.go

+4
Original file line numberDiff line numberDiff line change
@@ -129,5 +129,9 @@ data "google_compute_instance" "bar" {
129129
name = "${google_compute_instance.foo.name}"
130130
zone = "us-central1-a"
131131
}
132+
133+
data "google_compute_instance" "baz" {
134+
self_link = "${google_compute_instance.foo.self_link}"
135+
}
132136
`, instanceName)
133137
}

0 commit comments

Comments
 (0)