Terraform Provider for Vultr ==================
- Quickstart Guide: How to Provision a Vultr Cloud Server with Terraform and Cloud-Init
- Vultr Website: https://www.vultr.com
- Terraform Website: https://www.terraform.io
Requirements ------------
Building The Provider ---------------------Clone repository to: $GOPATH/src/github.com/vultr/terraform-provider-vultr
`` sh
$ mkdir -p $GOPATH/src/github.com/vultr; cd $GOPATH/src/github.com/vultr
$ git clone [email protected]:vultr/terraform-provider-vultr.git
sh
$ cd $GOPATH/src/github.com/vultr/terraform-provider-vultr
$ make build
Enter the provider directory and build the providerUsing the provider
----------------------
See the Vultr Provider documentation to get started using the Vultr provider.
Please read about V2 changes from V1 for a list of new changes made to the Vultr Terraform Provider
Installation
In your terraform config, define vultr/vultr in your required_providers and set your API key: hcl
terraform {
required_providers {
vultr = {
source = "vultr/vultr"
version = "2.22.1"
}
}
}
provider "vultr" { api_key = "..." }
sh export VERSION=2.22.1 OS=linux ARCH=amd64 mkdir -p ~/.terraform.d/plugins/local/vultr/vultr/${VERSION}/${OS}_${ARCH}/'After, runterraform initto install the provider.Manual Installation
If you don't have internet access on the target machine or prefer to install the provider locally follow the steps for the relevant operating system and architecture.1) Download and extract the binary for your system and architecture
2) Make the local plugins directory:
On linux
On mac sh
export VERSION=2.22.1 OS=darwin ARCH=arm64
mkdir -p ~/.terraform.d/plugins/local/vultr/vultr/${VERSION}/${OS}_${ARCH}/'
3) Rename and copy the binary into the local plugins directory: sh
mv terraform-provider-vultr_v${VERSION} ~/.terraform.d/plugins/local/vultr/vultr/${VERSION}/${OS}_${ARCH}/terraform-provider-vultr_v${VERSION}
hcl terraform { required_providers { vultr = { source = "local/vultr/vultr" version = "2.22.1" } } }4) Add the local provider to your terraformmain.tfconfig:
provider "vultr" { api_key = "..." }
sh $ make build ... $ $GOPATH/bin/terraform-provider-vultr ...5) Test everything by runningterraform initin that same directory.$GOPATH/binDeveloping the Provider ---------------------------
If you wish to work on the provider, you'll first need Go installed on your machine (version 1.11+ is required). You'll also need to correctly setup a GOPATH, as well as adding
to your$PATH.make buildTo compile the provider, run
. This will build the provider and put the provider binary in the$GOPATH/bindirectory.
sh $ make testIn order to test the provider, you can simply runmake test.
sh $ make testaccIn order to run the full suite of acceptance tests, runmake testacc.Note: Acceptance tests create real resources, and often cost money to run.
sh $ make testacc TESTARGS='-run=TestAccVultrUser_base' ``In order to run a specific acceptance test, use theTESTARGSenvironment variable. For example, the following command will runTestAccVultrUser_baseacceptance test only: