generated from hashicorp/packer-plugin-scaffolding
-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Made minor changes to documentation. - Standard `errors` and `fmt` were used for custom errors. - field `Node` was renamed to `Host`. - field `VmTags` was renamed to `Tags` - package `virtual_machine` was renamed to `virtualmachine` - `driver` and `testing` were moved to `common` location
- Loading branch information
1 parent
08527f1
commit 0bca530
Showing
24 changed files
with
618 additions
and
587 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
155 changes: 0 additions & 155 deletions
155
.web-docs/components/data-source/virtual_machine/README.md
This file was deleted.
Oops, something went wrong.
160 changes: 160 additions & 0 deletions
160
.web-docs/components/data-source/virtualmachine/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,160 @@ | ||
Type: `vsphere-virtualmachine` | ||
Artifact BuilderId: `vsphere.virtualmachine` | ||
|
||
This data source retrieves information about existing virtual machines from vSphere | ||
and return name of one virtual machine that matches all specified filters. This virtual | ||
machine can be used in the vSphere Clone builder to select a template. | ||
|
||
## Configuration Reference | ||
|
||
### Filters Configuration | ||
|
||
**Optional:** | ||
|
||
<!-- Code generated from the comments of the Config struct in datasource/virtualmachine/data.go; DO NOT EDIT MANUALLY --> | ||
|
||
- `name` (string) - Basic filter with glob support (e.g. `ubuntu_basic*`). Defaults to `*`. | ||
Using strict globs will not reduce execution time because vSphere API | ||
returns the full inventory. But can be used for better readability over | ||
regular expressions. | ||
|
||
- `name_regex` (string) - Extended name filter with regular expressions support | ||
(e.g. `ubuntu[-_]basic[0-9]*`). Default is empty. The match of the | ||
regular expression is checked by substring. Use `^` and `$` to define a | ||
full string. For example, the `^[^_]+$` filter will search names | ||
without any underscores. The expression must use | ||
[Go Regex Syntax](https://pkg.go.dev/regexp/syntax). | ||
|
||
- `template` (bool) - Filter to return only objects that are virtual machine templates. | ||
Defaults to `false` and returns all virtual machines. | ||
|
||
- `host` (string) - Filter to search virtual machines only on the specified ESX host. | ||
|
||
- `tags` ([]Tag) - Filter to return only that virtual machines that have attached all | ||
specifies tags. Specify one or more `tags` blocks to define list of tags | ||
for the filter. | ||
|
||
- `latest` (bool) - This filter determines how to handle multiple machines that were | ||
matched with all previous filters. Machine creation time is being used | ||
to find latest. By default, multiple matching machines results in an | ||
error. | ||
|
||
<!-- End of code generated from the comments of the Config struct in datasource/virtualmachine/data.go; --> | ||
|
||
|
||
### Tags Filter Configuration | ||
|
||
<!-- Code generated from the comments of the Tag struct in datasource/virtualmachine/data.go; DO NOT EDIT MANUALLY --> | ||
|
||
HCL Example: | ||
|
||
```hcl | ||
tags { | ||
category = "team" | ||
name = "operations" | ||
} | ||
tags { | ||
category = "sla" | ||
name = "gold" | ||
} | ||
``` | ||
|
||
<!-- End of code generated from the comments of the Tag struct in datasource/virtualmachine/data.go; --> | ||
|
||
|
||
**Required:** | ||
|
||
<!-- Code generated from the comments of the Tag struct in datasource/virtualmachine/data.go; DO NOT EDIT MANUALLY --> | ||
|
||
- `name` (string) - Name of the tag added to virtual machine which must pass the `tags` | ||
filter. | ||
|
||
- `category` (string) - Name of the tag category that contains the tag. | ||
|
||
-> **Note:** Both `name` and `category` must be specified in the `tags` | ||
filter. | ||
|
||
<!-- End of code generated from the comments of the Tag struct in datasource/virtualmachine/data.go; --> | ||
|
||
|
||
### Connection Configuration | ||
|
||
**Optional:** | ||
|
||
<!-- Code generated from the comments of the ConnectConfig struct in builder/vsphere/common/step_connect.go; DO NOT EDIT MANUALLY --> | ||
|
||
- `vcenter_server` (string) - The fully qualified domain name or IP address of the vCenter Server | ||
instance. | ||
|
||
- `username` (string) - The username to authenticate with the vCenter Server instance. | ||
|
||
- `password` (string) - The password to authenticate with the vCenter Server instance. | ||
|
||
- `insecure_connection` (bool) - Do not validate the certificate of the vCenter Server instance. | ||
Defaults to `false`. | ||
|
||
-> **Note:** This option is beneficial in scenarios where the certificate | ||
is self-signed or does not meet standard validation criteria. | ||
|
||
- `datacenter` (string) - The name of the datacenter object in the vSphere inventory. | ||
|
||
-> **Note:** Required if more than one datacenter object exists in the | ||
vSphere inventory. | ||
|
||
<!-- End of code generated from the comments of the ConnectConfig struct in builder/vsphere/common/step_connect.go; --> | ||
|
||
|
||
## Output | ||
|
||
<!-- Code generated from the comments of the DatasourceOutput struct in datasource/virtualmachine/data.go; DO NOT EDIT MANUALLY --> | ||
|
||
- `vm_name` (string) - Name of the found virtual machine. | ||
|
||
<!-- End of code generated from the comments of the DatasourceOutput struct in datasource/virtualmachine/data.go; --> | ||
|
||
|
||
## Example Usage | ||
|
||
This example demonstrates how to connect to vSphere cluster and search for the latest virtual machine | ||
that matches the filters. The name of the machine is then output to the console as an output variable. | ||
```hcl | ||
data "vsphere-virtualmachine" "default" { | ||
vcenter_server = "vcenter.example.com" | ||
insecure_connection = true | ||
username = "[email protected]" | ||
password = "VMware1!" | ||
datacenter = "dc-01" | ||
latest = true | ||
tags { | ||
category = "team" | ||
name = "operations" | ||
} | ||
tags { | ||
category = "sla" | ||
name = "gold" | ||
} | ||
} | ||
locals { | ||
vm_name = data.vsphere-virtualmachine.default.vm_name | ||
} | ||
source "null" "example" { | ||
communicator = "none" | ||
} | ||
build { | ||
sources = [ | ||
"source.null.example" | ||
] | ||
provisioner "shell-local" { | ||
inline = [ | ||
"echo vm_name: ${local.vm_name}", | ||
] | ||
} | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.