This is the repository for the Terraform provider for VMware Cloud Foundation, which one can use with Terraform to work with VMware Cloud Foundation.
The instructions outlined below are specific to macOS or Linux OS only.
If you wish to work on the provider, you'll first need Go installed on your machine (please check the requirements before proceeding).
First, you will want to clone the repository to : $GOPATH/src/github.com/vmware/terraform-provider-vcf
mkdir -p $GOPATH/src/github.com/vmware
cd $GOPATH/src/github.com/vmware
git clone git@github.com:vmware/terraform-provider-vcf.git
After the clone is complete, you can enter the provider directory and build the provider.
cd $GOPATH/src/github.com/vmware/terraform-provider-vcf
go get
go build -o terraform-provider-vcf
After the build is complete, if your terraform running folder does not match your GOPATH environment, you need to copy the terraform-provider-vcf
executable to your running folder and re-run terraform init
to make terraform aware of your local provider executable.
To use a released provider in your Terraform environment, run terraform init
and Terraform will automatically install the provider. To specify a particular provider version when installing released providers, see the Terraform documentation on provider versioning.
To instead use a custom-built provider in your Terraform environment (e.g. the provider binary from the build instructions above), follow the instructions to install it as a plugin. After placing the custom-built provider into your plugins directory, run terraform init
to initialize it.
NOTE: The provider does not support VMware Cloud Foundation on VxRail
Note that you can also control the provider version. This requires the use of a
provider
block in your Terraform configuration if you have not added one
already.
The syntax is as follows:
provider "vcf" {
version = "~> 1.0"
...
}
Version locking uses a pessimistic operator, so this version lock would mean anything within the 1.x namespace, including or after 1.0.0. Read more on provider version control.
Download and initialization of Terraform providers is with the “terraform init” command. This applies to the VCF provider as well. Once the provider block for the VCF provider is specified in your .tf file, “terraform init” will detect a need for the provider and download it to your environment. You can list versions of providers installed in your environment by running “terraform version” command:
$ terraform version
Terraform v1.4.5
+ provider.vcf (unversioned)
NOTE: Unless you are developing or require a pre-release bugfix or feature, you will want to use the officially released version of the provider (see the section above).
NOTE: Note that if the provider is manually copied to your running folder (rather than fetched with the “terraform init” based on provider block), Terraform is not aware of the version of the provider you’re running. It will appear as “unversioned”:
$ terraform version
Terraform v1.4.5
+ provider.vcf (unversioned)
Since Terraform has no indication of version, it cannot upgrade in a native way, based on the “version” attribute in provider block. In addition, this may cause difficulties in housekeeping and issue reporting.
NOTE: Before you start work on a feature, please make sure to check the issue tracker and existing pull requests to ensure that work is not being duplicated. For further clarification, you can also ask in a new issue.
See the section above for details on building the provider.
Copyright 2023 Broadcom. All Rights Reserved.
The Terraform provider for VMware Cloud Foundation is available under MPL2.0 license.