Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add dynamic data source #1103

Merged
merged 4 commits into from
Jun 11, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions vsphere/data_source_vsphere_dynamic.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ func dataSourceVSphereDynamicRead(d *schema.ResourceData, meta interface{}) erro
}
switch {
case len(filtered) < 1:
return fmt.Errorf("no matches resources found")
return fmt.Errorf("no matcheing resources found")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return fmt.Errorf("no matcheing resources found")
return fmt.Errorf("no matching resources found")

case len(filtered) > 1:
log.Printf("dataSourceVSphereDynamic: Multiple matches found: %v", filtered)
return fmt.Errorf("multiple object match the supplied criteria")
return fmt.Errorf("multiple objecst match the supplied criteria")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return fmt.Errorf("multiple objecst match the supplied criteria")
return fmt.Errorf("multiple objects match the supplied criteria")

}
d.SetId(filtered[0])
log.Printf("[DEBUG] dataSourceDynamic: Read complete. Resource located: %s", filtered[0])
Expand Down
6 changes: 3 additions & 3 deletions vsphere/data_source_vsphere_vmfs_disks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ output "found" {
value = "${length(data.vsphere_vmfs_disks.available.disks) >= 1 ? "true" : "false" }"
}
`,
os.Getenv("TF_VAR_VSPHERE_DATACENTER"),
os.Getenv("TF_VAR_VSPHERE_ESXI1"),
os.Getenv("TF_VAR_VSPHERE_DATACENTER"),
os.Getenv("TF_VAR_VSPHERE_ESXI1"),
)
}
}
2 changes: 1 addition & 1 deletion vsphere/resource_vsphere_compute_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -916,4 +916,4 @@ resource "vsphere_compute_cluster" "compute_cluster" {
`,
os.Getenv("TF_VAR_VSPHERE_DATACENTER"),
)
}
}
12 changes: 6 additions & 6 deletions vsphere/resource_vsphere_host_port_group_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,9 @@ resource "vsphere_host_port_group" "pg" {
host_system_id = "${data.vsphere_host.esxi_host.id}"
virtual_switch_name = "${vsphere_host_virtual_switch.switch.name}"
}
`, os.Getenv("TF_VAR_VSPHERE_ESXI_TRUNK_NIC"),
os.Getenv("TF_VAR_VSPHERE_DATACENTER"),
os.Getenv("TF_VAR_VSPHERE_ESXI1"))
`, os.Getenv("TF_VAR_VSPHERE_ESXI_TRUNK_NIC"),
os.Getenv("TF_VAR_VSPHERE_DATACENTER"),
os.Getenv("TF_VAR_VSPHERE_ESXI1"))
}

func testAccResourceVSphereHostPortGroupConfigWithOverrides() string {
Expand Down Expand Up @@ -241,7 +241,7 @@ resource "vsphere_host_port_group" "pg" {
standby_nics = ["${var.host_nic1}"]
allow_promiscuous = true
}
`, os.Getenv("TF_VAR_VSPHERE_ESXI_TRUNK_NIC"),
os.Getenv("TF_VAR_VSPHERE_DATACENTER"),
os.Getenv("TF_VAR_VSPHERE_ESXI1"))
`, os.Getenv("TF_VAR_VSPHERE_ESXI_TRUNK_NIC"),
os.Getenv("TF_VAR_VSPHERE_DATACENTER"),
os.Getenv("TF_VAR_VSPHERE_ESXI1"))
}
12 changes: 6 additions & 6 deletions vsphere/resource_vsphere_host_virtual_switch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ resource "vsphere_host_virtual_switch" "switch" {
active_nics = ["${var.host_nic0}"]
standby_nics = []
}
`, os.Getenv("TF_VAR_VSPHERE_ESXI_TRUNK_NIC"),
`, os.Getenv("TF_VAR_VSPHERE_ESXI_TRUNK_NIC"),
os.Getenv("TF_VAR_VSPHERE_DATACENTER"),
os.Getenv("TF_VAR_VSPHERE_ESXI1"))
}
Expand Down Expand Up @@ -288,7 +288,7 @@ resource "vsphere_host_virtual_switch" "switch" {
active_nics = ["${var.host_nic0}"]
standby_nics = []
}
`, os.Getenv("TF_VAR_VSPHERE_ESXI_TRUNK_NIC"),
`, os.Getenv("TF_VAR_VSPHERE_ESXI_TRUNK_NIC"),
os.Getenv("TF_VAR_VSPHERE_DATACENTER"),
os.Getenv("TF_VAR_VSPHERE_ESXI1"))
}
Expand Down Expand Up @@ -317,7 +317,7 @@ resource "vsphere_host_virtual_switch" "switch" {
active_nics = []
standby_nics = []
}
`, os.Getenv("TF_VAR_VSPHERE_ESXI_TRUNK_NIC"),
`, os.Getenv("TF_VAR_VSPHERE_ESXI_TRUNK_NIC"),
os.Getenv("TF_VAR_VSPHERE_DATACENTER"),
os.Getenv("TF_VAR_VSPHERE_ESXI1"))
}
Expand Down Expand Up @@ -346,7 +346,7 @@ resource "vsphere_host_virtual_switch" "switch" {
active_nics = ["${var.host_nic0}"]
standby_nics = []
}
`, os.Getenv("TF_VAR_VSPHERE_ESXI_TRUNK_NIC"),
`, os.Getenv("TF_VAR_VSPHERE_ESXI_TRUNK_NIC"),
os.Getenv("TF_VAR_VSPHERE_DATACENTER"),
os.Getenv("TF_VAR_VSPHERE_ESXI1"))
}
Expand Down Expand Up @@ -375,7 +375,7 @@ resource "vsphere_host_virtual_switch" "switch" {
active_nics = []
standby_nics = ["${var.host_nic0}"]
}
`, os.Getenv("TF_VAR_VSPHERE_ESXI_TRUNK_NIC"),
`, os.Getenv("TF_VAR_VSPHERE_ESXI_TRUNK_NIC"),
os.Getenv("TF_VAR_VSPHERE_DATACENTER"),
os.Getenv("TF_VAR_VSPHERE_ESXI1"))
}
}