Skip to content

Commit

Permalink
docs: markdown linting
Browse files Browse the repository at this point in the history
Addressed markdownlint issues for documentation.

Signed-off-by: Ryan Johnson <[email protected]>
  • Loading branch information
tenthirtyam committed Jun 17, 2024
1 parent 69ec14e commit bc7d78c
Show file tree
Hide file tree
Showing 42 changed files with 569 additions and 396 deletions.
5 changes: 5 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<!--- Please leave a helpful description of the pull request here. --->

### Acceptance tests

- [ ] Have you added an acceptance test for the functionality being added?
- [ ] Have you run the acceptance tests on this branch?

Expand All @@ -13,21 +14,25 @@ Replace TestAccXXX with a pattern that matches the tests affected by this PR.
For more information on the `-run` flag, see the `go test` documentation at https://tip.golang.org/cmd/go/#hdr-Testing_flags.
-->

```
$ make testacc TESTARGS='-run=TestAccXXX'
...
```

### Release Note

Release note for [CHANGELOG](https://github.com/hashicorp/terraform-provider-vsphere/blob/main/CHANGELOG.md):

<!--
If change is not user facing, just write "NONE" in the release-note block below.
-->

```release-note
...
```

### References

<!---
Expand Down
74 changes: 40 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,71 +8,77 @@
[![GitHub tag (latest SemVer)](https://img.shields.io/github/v/tag/hashicorp/terraform-provider-vsphere?label=release&style=for-the-badge)](https://github.com/hashicorp/terraform-provider-vsphere/releases/latest)
[![License](https://img.shields.io/github/license/hashicorp/terraform-provider-vsphere.svg?style=for-the-badge)](LICENSE)

The Terraform Provider for VMware vSphere is a plugin for Terraform that allows you to interact with
VMware vSphere, notably [vCenter Server][vmware-vcenter] and [ESXi][vmware-esxi]. This provider can
be used to manage a VMware vSphere environment, including virtual machines, host and cluster
management, inventory, networking, storage, datastores, content libraries, and more.
The Terraform Provider for VMware vSphere is a plugin for Terraform that allows
you to interact with VMware vSphere, notably [vCenter Server][vmware-vcenter]
and [ESXi][vmware-esxi]. This provider can be used to manage a VMware vSphere
environment, including virtual machines, host and cluster management, inventory,
networking, storage, datastores, content libraries, and more.

Learn more:

* Read the provider [documentation][provider-documentation].
- Read the provider [documentation][provider-documentation].

* Join the community [discussions][provider-discussions].
- Join the community [discussions][provider-discussions].

## Requirements

* [Terraform 0.13+][terraform-install]
- [Terraform 0.13+][terraform-install]

For general information about Terraform, visit [developer.hashicorp.com][terraform-install] and
[the project][terraform-github] on GitHub.
For general information about Terraform, visit
[developer.hashicorp.com][terraform-install] and
[the project][terraform-github] on GitHub.

* [Go 1.22][golang-install]
- [Go 1.22][golang-install]

Required if building the provider.
Required if building the provider.

* [VMware vSphere][vmware-vsphere-documenation]
- [VMware vSphere][vmware-vsphere-documenation]

The plugin supports versions in accordance with the
[Broadcom Product Lifecycle][product-lifecycle].
The plugin supports versions in accordance with the
[Broadcom Product Lifecycle][product-lifecycle].

## Using the Provider

The Terraform Provider for VMware vSphere is an official provider. Official providers are maintained
by the Terraform team at [HashiCorp][hashicorp] and are listed on the
[Terraform Registry][terraform-registry].
The Terraform Provider for VMware vSphere is an official provider. Official
providers are maintained by the Terraform team at [HashiCorp][hashicorp] and are
listed on the [Terraform Registry][terraform-registry].

To use a released version of the Terraform provider in your environment, run `terraform init` and
Terraform will automatically install the provider from the Terraform Registry.
To use a released version of the Terraform provider in your environment, run
`terraform init` and Terraform will automatically install the provider from the
Terraform Registry.

Unless you are contributing to the provider or require a pre-release bugfix or feature, use an
**officially** released version of the provider.
Unless you are contributing to the provider or require a pre-release bugfix or
feature, use an **officially** released version of the provider.

See [Installing the Terraform Provider for VMware vSphere][provider-install] for additional
instructions on automated and manual installation methods and how to control the provider version.
See [Installing the Terraform Provider for VMware vSphere][provider-install] for
additional instructions on automated and manual installation methods and how to
control the provider version.

For either installation method, documentation about the provider configuration, resources, and data
sources can be found on the Terraform Registry.
For either installation method, documentation about the provider configuration,
resources, and data sources can be found on the Terraform Registry.

## Upgrading the Provider

The provider does not upgrade automatically. After each new release, you can run the following
command to upgrade the provider:
The provider does not upgrade automatically. After each new release, you can run
the following command to upgrade the provider:

```shell
terraform init -upgrade
```

## Contributing

The Terraform Provider for VMware vSphere is the work of many contributors and the project team
appreciates your help!
The Terraform Provider for VMware vSphere is the work of many contributors and
the project team appreciates your help!

If you discover a bug or would like to suggest an enhancement, submit [an issue][provider-issues].
Once submitted, your issue will follow the [lifecycle][provider-issue-lifecycke] process.
If you discover a bug or would like to suggest an enhancement, submit
[an issue][provider-issues]. Once submitted, your issue will follow the
[lifecycle][provider-issue-lifecycke] process.

If you would like to submit a pull request, please read the
[contribution guidelines][provider-contributing] to get started. In case of enhancement or feature
contribution, we kindly ask you to open an issue to discuss it beforehand.
[contribution guidelines][provider-contributing] to get started. In case of
enhancement or feature contribution, we kindly ask you to open an issue to
discuss it beforehand.

Learn more in the [Frequently Asked Questions][provider-faq].

Expand All @@ -94,7 +100,7 @@ The Terraform Provider for VMware vSphere is available under the
[terraform-install]: https://developer.hashicorp.com/terraform/install
[terraform-github]: https://github.com/hashicorp/terraform
[terraform-registry]: https://registry.terraform.io
[vmware-esxi]: https://www.vmware.com/content/vmware/vmware-published-sites/us/products/esxi-and-esx.html
[vmware-esxi]: https://www.vmware.com/products/esxi-and-esx.html.html
[product-lifecycle]: https://support.broadcom.com/group/ecx/productlifecycle
[vmware-vcenter]: https://www.vmware.com/products/vcenter.html
[vmware-vsphere-documenation]: https://docs.vmware.com/en/VMware-vSphere/index.html
46 changes: 32 additions & 14 deletions acctests/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# Acceptance Tests

Acceptance testing is undergoing revamping and streamlining. The current process recommends hosting on Equinix Metal and currently is only meant to test vSphere 7 running on an ESXi 7 host (with nested ESXi 7 hosts).

## Download

1. Log in to VMware Customer Connect.
2. Navigate to Products and Accounts > All Products.
3. Find VMware vSphere and click View Download Components.
Expand All @@ -10,17 +12,21 @@ Acceptance testing is undergoing revamping and streamlining. The current process
6. Download the vCenter Server appliance ISO image.

## Extract

Next you need to mount and extract the contents of the iso to a location on your disk.

### macOS Users

During the Equinix provisioning, macOS users may get security issues when ovftool is attempting to run, to prevent this issue run the following command:

```
$ sudo xattr -r -d com.apple.quarantine {extract_location}/vcsa/ovftool/mac/ovftool
sudo xattr -r -d com.apple.quarantine {extract_location}/vcsa/ovftool/mac/ovftool
```

## Prepare Environment Variable

Set the following environment variables

```
# the prefix is only required to prevent collisions with other users in your equinix project
export TF_VAR_LAB_PREFIX="your prefix"
Expand All @@ -35,35 +41,39 @@ export TF_VAR_VCSA_DEPLOY_PATH="{extract_location}/vcsa-cli-installer/mac/vcsa-d
```

## Provision Equinix Infrastructure

Terraform needs to be run in a few stages. The first, to provision the Equinix infrastructure and deploy the main ESXi host.

```
$ cd acctests/equinix
$ terraform init
$ terraform apply
cd acctests/equinix
terraform init
terraform apply
```

This process will take approximately 1.5h depending on network speeds. Once complete please source the `devrc` containing several key environment variables.

```
$ source devrc
source devrc
```

## Provision vSphere

The vSphere infrastructure is provisioned in 2 steps, base and testrun. The base resources provision some basic cluster, networking and datastores, and adds the physical ESXi host into inventory.

### Base Step

Prior to applying, visit the physical ESXi web UI and find the unused boot disk, it will have a very long name like t10.ATA___XXX (assuming the use of Equinix c3.medium), and set `TF_VAR_VSPHERE_ESXI1_BOOT_DISK1` to this name and `TF_VAR_VSPHERE_ESXI1_BOOT_DISK1_SIZE` in GB (about half the overall disk size should be plenty, the nested ESXis will also need to use this datastore).

```
$ cd ../vsphere/base
$ terraform init
$ terraform apply
cd ../vsphere/base
terraform init
terraform apply
```

This will create another `devrc` file to source.

```
$ source devrc
source devrc
```

A few manual steps need to be taken to privately network the nested ESXis setup in the testrun phase.
Expand All @@ -77,36 +87,41 @@ A few manual steps need to be taken to privately network the nested ESXis setup
7. OPTIONAL: vCenter ships with a 60 day evaluation license. You could take this opportunity to add a permanent license into inventory, and right click the top-level vCenter instance and assign the license.

### TestRun Step

This config can be destroyed between full test runs of the provider. It should cover cleaning up of things like the nested ESXis running in the wrong cluster, and cleaning up any leftover files in the NFS. Any lingering resources outside of those may need manual cleanup.

```
$ cd ../vsphere/testrun
$ terraform init
$ terraform apply
cd ../vsphere/testrun
terraform init
terraform apply
```

This will create a final `devrc` file to source.

```
$ source devrc
source devrc
```

## Running tests

Now that you have all the required environment variables set, tests can be ran via regexp pattern. It is generally advisable to run them individually or by resource type. It's common practice to have resource tests contain an underscore in their name to make the whole suite of tests for the resource run.

```
$ make testacc TESTARGS="-run=TestAccResourceVSphereVirtualMachine_ -count=1"
make testacc TESTARGS="-run=TestAccResourceVSphereVirtualMachine_ -count=1"
```

`count=1` is just a Golang trick to bust the testcache.

# Nightly GitHub Action

The full suite of acceptance tests run rightly on GH Actions against ESXi/vSphere stood up on Equinix Metal. The `acctests/equinix` and `acctests/vsphere/base` should be long-lived, while `acctests/vsphere/testrun` is brought up and torn down between CI runs.

## Setup

From a local machine, please follow the instructions seen above up until `acctests/vsphere/base` is successfully applied. Through the GitHub UI, visit the repo settings and visit the "Environments" tab on the left. There should be an existing environment called `acctests` which is restricted to the `main` branch.

Configure the following as Environment variables:

```
TF_VAR_VSPHERE_CLUSTER
TF_VAR_VSPHERE_DATACENTER
Expand All @@ -118,6 +133,7 @@ VSPHERE_ALLOW_UNVERIFIED_SSL
```

Configure the following as Environment **secrets**:

```
TF_VAR_VSPHERE_ESXI1
TF_VAR_VSPHERE_ESXI1_PW
Expand All @@ -139,11 +155,13 @@ With these set, the nightly acceptances tests should run, normally the results o
* Sometimes the API seems to lockup/crash or lockout the CI client resulting in widespread error 503s.

### PLEASE NOTE

The current VCSA deployment seen in `acctests/equinix/vcsa_deploy.json` is set to thin provision the primary datastore `datastore1`. It seems that over time the VCSA VM will continue to expand until the datastore is full. There is probably a way to properly configure this in `acctests/equinix/vcsa_deploy.json`. Without this being corrected, or a bare metal server with more primary disk space being chosen, the CI probably needs to be rebuilt from scratch every 45 days.

vSphere vCenter comes with a 60 day evaluation license. Until the space issue is resolved it is not essential that a permanent vCenter license be added. Longterm it would be nice if the entire infrastructure could be brought up and torn down daily, meaning neither issue would need to be addressed.

# Local Testing

The tests and required infrastructure have been heavily streamlined (believe it or not...) however its still expected they run Equinix for now, but it should be theoretically possible to run tests against local hardware (or perhaps totally virtualized). The main requirement is ESXi 7 with the following:

* A lot of memory (20GB or more), ESXi/vCenter will need a lot, and then there will be a few VMs at play for now that probably all need 0.5 to 1GB each.
Expand Down
5 changes: 3 additions & 2 deletions docs/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Code of Conduct

The [HashiCorp Community Guidelines][hashicorp-community-guidelines] apply to you when interacting with the community here on GitHub and contributing code.
The [HashiCorp Community Guidelines][hashicorp-community-guidelines] apply to
you when interacting with the community here on GitHub and contributing code.

[hashicorp-community-guidelines]: https://www.hashicorp.com/community-guidelines
[hashicorp-community-guidelines]: https://www.hashicorp.com/community-guidelines
Loading

0 comments on commit bc7d78c

Please sign in to comment.