Skip to content

Commit f857431

Browse files
committed
docs: add install, build, and test docs
Adds seperate documenation for the installation, buiild, and testing of the provider to be linked to an updated `README.md`. Signed-off-by: Ryan Johnson <ryan.johnson@broadcom.com>
1 parent 2d94ca6 commit f857431

File tree

5 files changed

+527
-195
lines changed

5 files changed

+527
-195
lines changed

README.md

+60-195
Original file line numberDiff line numberDiff line change
@@ -1,230 +1,95 @@
1-
# Terraform VMware Tanzu Mission Control Provider
1+
<!--
2+
© Broadcom. All Rights Reserved.
3+
The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
4+
SPDX-License-Identifier: MPL-2.0
5+
-->
26

3-
This is the repository for the Terraform Tanzu Mission Control Provider and can be used with
4-
[VMware Tanzu Mission Control][vmware-tanzu-mission-control].
7+
<!-- markdownlint-disable first-line-h1 no-inline-html -->
58

6-
For general information about Terraform, visit the [official website][hashicorp-terraform] and the [GitHub project page.][terraform-github]
9+
<img src="docs/images/icon-color.svg" alt="VMware Tanzu Mission Control" width="150">
710

8-
[vmware-tanzu-mission-control]: https://tanzu.vmware.com/mission-control
9-
[hashicorp-terraform]: https://www.terraform.io
10-
[terraform-github]: https://github.com/hashicorp/terraform
11-
12-
# Using the Provider
13-
14-
The latest version of this provider requires Terraform v0.12 or higher to run.
15-
16-
Note that you need to run `terraform init` to fetch the provider before
17-
deploying.
18-
19-
### Controlling the provider version
11+
# Terraform Provider for VMware Tanzu Mission Control
2012

21-
Note that you can also control the provider version. This requires the use of a
22-
`provider` block in your Terraform configuration if you have not added one
23-
already.
13+
[![Latest Release](https://img.shields.io/github/v/tag/vmware/terraform-provider-tanzu-mission-control?label=latest%20release&style=for-the-badge)](https://github.com/vmware/terraform-provider-tanzu-mission-control/releases/latest) [![License](https://img.shields.io/github/license/vmware/terraform-provider-tanzu-mission-control.svg?style=for-the-badge)](LICENSE)
2414

25-
The syntax is as follows:
15+
The Terraform Provider for [VMware Tanzu Mission Control][product-documentation] is a plugin for
16+
Terraform that allows you to interact with VMware Tanzu Mission Control.
2617

27-
```hcl
28-
terraform {
29-
required_providers {
30-
tanzu-mission-control = {
31-
source = "vmware/tanzu-mission-control"
32-
version = "1.0.0"
33-
}
34-
}
35-
}
18+
Learn more:
3619

37-
provider "tanzu-mission-control" {
38-
# Configuration options
39-
}
40-
```
41-
42-
Version locking uses a pessimistic operator, so this version lock would mean anything within the 1.x namespace, including or after 1.0.0.
43-
[Read more][provider-vc] on provider version control.
20+
* Read the provider [documentation][provider-documentation].
4421

45-
[provider-vc]: https://docs.vmware.com/en/VMware-Tanzu-Mission-Control/index.html
22+
* Join the community [discussions][provider-discussions].
4623

47-
# Manual Installation
24+
## Requirements
4825

49-
## Cloning the Project
26+
* [Terraform 0.12+][terraform-install]
5027

51-
First, you will want to clone the repository to
52-
`github.com/vmware/terraform-provider-tanzu-mission-control`:
28+
For general information about Terraform, visit [HashiCorp Developer][terraform-install] and
29+
[the project][terraform-github] on GitHub.
5330

54-
```sh
55-
mkdir -p $GOPATH/src/github.com/vmware/terraform-provider-tanzu-mission-control
56-
cd $GOPATH/src/github.com/vmware/terraform-provider-tanzu-mission-control
57-
git clone git@github.com:vmware/terraform-provider-tanzu-mission-control.git
58-
```
31+
* [Go 1.19][golang-install]
5932

60-
## Building and Installing the Provider
33+
Required, if [building][provider-build] and [testing][provider-test].
6134

62-
Recommended golang version is go1.14 onwards.
63-
After the clone has been completed, you can enter the provider directory and build the provider.
64-
65-
```sh
66-
cd github.com/vmware/terraform-provider-tanzu-mission-control
67-
make
68-
```
35+
## Using the Provider
6936

70-
After the build is complete, copy the provider executable `terraform-provider-tanzu` into location specified in your provider installation configuration. Make sure to delete provider lock files that might exist in your working directory due to prior provider usage. Run `terraform init`.
71-
For developing, consider using [dev overrides configuration][dev-overrides]. Please note that `terraform init` should not be used with dev overrides.
37+
The Terraform Provider for VMware Tanzu Mission Control is a Partner tier provider.
7238

73-
[dev-overrides]: https://www.terraform.io/docs/cli/config/config-file.html#development-overrides-for-provider-developers
39+
Partner tier providers are owned and maintained by a partner in the HashiCorp Technology Partner
40+
Program. HashiCorp verifies the authenticity of the publisher and the provider is listed on the
41+
[Terraform Registry][terraform-registry] with a Partner tier label.
7442

75-
# Developing the Provider
43+
To use a released version of the Terraform provider in your environment, run `terraform init` and
44+
Terraform will automatically install the provider from the Terraform Registry.
7645

77-
**NOTE:** Before you start work on a feature, please make sure to check the
78-
[issue tracker][gh-issues] and existing [pull requests][gh-prs] to ensure that
79-
work is not being duplicated. For further clarification, you can also ask in a
80-
new issue.
46+
Unless you are contributing to the provider or require a pre-release bugfix or feature, use a
47+
released version of the provider.
8148

82-
[gh-issues]: https://github.com/vmware/terraform-provider-tanzu-mission-control/issues
83-
[gh-prs]: https://github.com/vmware/terraform-provider-tanzu-mission-control/pulls
49+
See [Installing the Terraform Provider for VMware Tanzu Mission Control][provider-install] for
50+
additional instructions on automated and manual installation methods and how to control the provider
51+
version.
8452

85-
If you wish to work on the provider, you'll first need [Go][go-website]
86-
installed on your machine (version 1.14+ is recommended). You'll also need to
87-
correctly setup a [GOPATH][gopath], as well as adding `$GOPATH/bin` to your
88-
`$PATH`.
53+
For either installation method, documentation about the provider configuration, resources, and data
54+
sources can be found on the Terraform Registry.
8955

90-
[go-website]: https://golang.org/
91-
[gopath]: http://golang.org/doc/code.html#GOPATH
56+
## Upgrading the Provider
9257

93-
See [Manual Installation](#manual-installation) for details on building the
94-
provider.
95-
96-
# Testing the Provider
97-
98-
## Flattening and Helper Tests
99-
Run the command:
100-
```sh
101-
$ make test
102-
```
103-
104-
## Acceptance Tests
105-
**NOTE:** This block is applicable only for Tanzu Mission Control SaaS offering.
106-
### Configuring Environment Variables:
107-
Set the environment variables in your IDE configurations or Terminal.
108-
Environment variables that are required to be set universally are `TMC_ENDPOINT`, `VMW_CLOUD_ENDPOINT` and `VMW_CLOUD_API_TOKEN`.
109-
110-
Example:
58+
The provider does not upgrade automatically. After each new release, you can run the following command to upgrade the provider:
11159

11260
```shell
113-
$ export TMC_ENDPOINT = my-org.tmc.cloud.vmware.com
114-
$ export VMW_CLOUD_ENDPOINT = console.tanzu.broadcom.com
61+
terraform init -upgrade
11562
```
11663

117-
Environment variables specific to particular resources:
64+
## Contributing
11865

119-
- **Attach Cluster with Kubeconfig and Namespace Resource** - `KUBECONFIG`
120-
- **Tanzu Kubernetes Grid Service for vSphere workload cluster** - `MANAGEMENT_CLUSTER`, `PROVISIONER_NAME`, `VERSION` and `STORAGE_CLASS`.
121-
- **Tanzu Kubernetes Grid workload cluster** - `MANAGEMENT_CLUSTER` and `CONTROL_PLANE_ENDPOINT`.
66+
The Terraform Provider for VMware Tanzu Mission Control is the work of many contributors and the project team appreciates your help!
12267

123-
### Running the Test:
124-
Run the command:
125-
```sh
126-
$ make acc-test
127-
```
68+
If you discover a bug or would like to suggest an enhancement, submit [an issue][provider-issues].
12869

129-
To run the acceptance test specific to a resource make use of the build-tags.
130-
Build tag name is equivalent to the corresponding resource name.
70+
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.
13171

132-
`
133-
Running acceptance test without explicitly setting `BUILD_TAGS` runs all the acceptance test by default.
134-
To specifically run acceptances test of a resouces, set `BUILD_TAGS` value to correponding resource name.
135-
`
72+
## Support
13673

137-
For instance to run acceptance test for cluster-group and namespace resource
138-
```sh
139-
$ export BUILD_TAGS = "clustergroup namespace"
140-
$ make acc-test
141-
```
74+
The Terraform Provider for VMware Tanzu Mission Control is supported by Broadcom and the provider community. For bugs and enhancement requests please open a GitHub [issue][provider-issues] or contact Broadcom support.
14275

143-
### Test provider changes locally
144-
Please make use of a unique path as provided in the `Makefile` while building the provider with changes
145-
and kindly use the same path in the source while using the provider to test the local changes.
76+
## License
14677

147-
```shell
148-
terraform {
149-
required_providers {
150-
tanzu-mission-control = {
151-
source = "vmware/dev/tanzu-mission-control"
152-
}
153-
}
154-
}
155-
156-
provider "tanzu-mission-control" {
157-
# Configuration options
158-
}
159-
```
78+
© Broadcom. All Rights Reserved.
79+
The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
16080

161-
[here]: https://www.terraform.io/internals/debugging
162-
## Debugging Provider
163-
Please set the environmental variable `TF_LOG` to one of the log levels `TRACE`, `DEBUG`, `INFO`, `WARN` or `ERROR` to capture the logs. More details in the link [here].
81+
The Terraform Provider for VMware Tanzu Mission Control is available under the [Mozilla Public License, version 2.0][provider-license] license.
16482

165-
Set the environmental variable `TMC_MODE` to `DEV` to capture more granular logs.
166-
167-
## Connect the VSCode debugger
168-
1. Create `./.vscode/launch.json`
169-
```json5
170-
{
171-
"version": "0.2.0",
172-
"configurations": [
173-
{
174-
"name": "Debug Terraform Provider",
175-
"type": "go",
176-
"request": "launch",
177-
"mode": "debug",
178-
// this assumes your workspace is the root of the repo
179-
"program": "${workspaceFolder}",
180-
"env": {},
181-
"args": [
182-
"-debug",
183-
]
184-
}
185-
]
186-
}
187-
```
188-
2. Click on **"Run and Debug"** option in VSCode, This will open a panel on the left side of the editor. Here, you can see a list of configurations for debugging different languages and tools. Find the one that says **"Debug Terraform Provider"** and click on it. This will launch the debugger and attach it to your provider process. You can now set breakpoints, inspect variables, and step through your code as usual.
189-
3. Check the **"DEBUG CONSOLE"** tab, there you will find the value of `TF_REATTACH_PROVIDERS`, which is a special environment variable that tells Terraform how to connect to the provider's plugin process. You need to set this variable in your shell before running any Terraform commands. For example, you can use the export command as shown below:
190-
<br/>
191-
```sh
192-
# Set TF_REATTACH_PROVIDERS as environment variable.
193-
export TF_REATTACH_PROVIDERS='{"vmware/dev/tanzu-mission-control":{"Protocol":"grpc","ProtocolVersion":5,"Pid":1338,"Test":true,"Addr":{"Network":"unix","String":"/var/folders/r9/h_0mgps9053g3tft7t8xh6rh0000gq/T/plugin2483048401"}}}'
194-
195-
# Run TF command
196-
terraform plan
197-
```
198-
199-
200-
> https://developer.hashicorp.com/terraform/plugin/debugging#visual-studio-code
201-
202-
## Provider Documentation
203-
204-
Tanzu Mission Control Terraform provider documentation is autogenerated using [tfplugindocs][tfplugindocs-link].
205-
206-
Use the tfplugindocs tool to generate documentation for your provider in the format required by the Terraform Registry.
207-
The plugin will read the descriptions and schema of each resource and data source in your provider and generate the relevant Markdown files for you.
208-
209-
[tfplugindocs-link]: https://github.com/hashicorp/terraform-plugin-docs
210-
## Using Tanzu Mission Control Provider
211-
212-
Please refer to `examples` folder to perform CRUD operations with Tanzu Mission Control provider for various resources
213-
214-
# Troubleshooting
215-
216-
## Executions of a different version of the provider
217-
Terraform will always look for the latest version of the provided and will use it even if you have just built a previous version.
218-
Terraform caches all known builds/versions in the cache folder located in ```~/.terraform.d``` folder.
219-
220-
Delete ```~/.terraform.d/plugins/vmware``` folder to remove all cached versions of the plugin
221-
222-
# Support
223-
224-
The Tanzu Mission Control Terraform provider is now VMware supported as well as community supported. For bugs and feature requests please open a Github Issue and label it appropriately or contact VMware support.
225-
226-
# License
227-
228-
Copyright © 2015-2022 VMware, Inc. All Rights Reserved.
229-
230-
The Tanzu Mission Control Terraform provider is available under [MPL2.0 license](https://github.com/vmware/terraform-provider-tanzu-mission-control/blob/main/LICENSE).
83+
[golang-install]: https://golang.org/doc/install
84+
[product-documentation]: https://techdocs.broadcom.com/us/en/vmware-tanzu/standalone-components/tanzu-mission-control/1-4/tanzu-mission-control-documentation/index-tmc-all.html
85+
[provider-contributing]: CONTRIBUTING.md
86+
[provider-discussions]: https://github.com/vmware/terraform-provider-tanzu-mission-control/discussions
87+
[provider-documentation]: https://registry.terraform.io/providers/vmware/tanzu-mission-control/latest/docs
88+
[provider-build]: docs/build.md
89+
[provider-install]: docs/install.md
90+
[provider-test]: docs/test.md
91+
[provider-issues]: https://github.com/vmware/terraform-provider-tanzu-mission-control/issues/new/choose
92+
[provider-license]: LICENSE
93+
[terraform-github]: https://github.com/hashicorp/terraform
94+
[terraform-install]: https://developer.hashicorp.com/terraform/install
95+
[terraform-registry]: https://registry.terraform.io

docs/build.md

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<!--
2+
© Broadcom. All Rights Reserved.
3+
The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries.
4+
SPDX-License-Identifier: MPL-2.0
5+
-->
6+
7+
<!-- markdownlint-disable first-line-h1 no-inline-html -->
8+
9+
<img src="images/icon-color.svg" alt="VMware Tanzu Mission Control" width="150">
10+
11+
# Building the Terraform Provider for VMware Tanzu Mission Control
12+
13+
The instructions outlined below are specific to macOS and Linux only.
14+
15+
If you wish to work on the provider, you'll first need [Go][golang-install] installed on your
16+
machine. Check the [requirements][requirements] before proceeding.
17+
18+
1. Clone the repository to: `$GOPATH/src/github.com/vmware/terraform-provider-tanzu-mission-control`
19+
20+
```sh
21+
mkdir -p $GOPATH/src/github.com/vmware
22+
cd $GOPATH/src/github.com/vmware
23+
git clone git@github.com:vmware/terraform-provider-tanzu-mission-control.git
24+
```
25+
26+
2. Enter the provider directory to build the provider.
27+
28+
```sh
29+
cd $GOPATH/src/github.com/vmware/terraform-provider-tanzu-mission-control
30+
go get
31+
go build -o terraform-provider-tanzu-mission-control
32+
```
33+
34+
3. Add the following to your `~/.terraformrc`:
35+
36+
```hcl
37+
provider_installation {
38+
dev_overrides {
39+
"vmware/tanzu-mission-control" = "/Users/rainpole/go/bin"
40+
}
41+
42+
direct {}
43+
}
44+
```
45+
46+
Where `/Users/rainpole/go/bin` is your `GOPATH/bin` path.
47+
48+
4. Run `go install` to install the development binary.
49+
50+
[golang-install]: https://golang.org/doc/install
51+
[requirements]: https://github.com/vmware/terraform-provider-tanzu-mission-control#requirements

docs/images/icon-color.svg

+32
Loading

0 commit comments

Comments
 (0)