|
1 |
| -# Installing the vRA Terraform provider |
| 1 | +# Installing the Terraform Provider for VMware vRealize Automation |
2 | 2 |
|
3 |
| -The provider is currently considered to be a third-party provider and thus won't be automatically downloaded by ```terraform```, which means you have to either install or build it yourself. The provider is made available in a pre-built binary version via the GitHub repository in the form of releases. This document will walk you through installing a released version of the provider. (The following snippets will use v0.3.5, but you will need to update the version as necessary) |
| 3 | + |
4 | 4 |
|
5 |
| -## Downloading the provider |
| 5 | +This document assumes the use of Terraform 0.13 or later. |
6 | 6 |
|
7 |
| - The most recent version of the provider can be found at https://github.com/vmware/terraform-provider-vra/releases/latest |
| 7 | +## Automated Installation (Recommended) |
8 | 8 |
|
9 |
| - |
| 9 | +The Terraform Provider for VMware vRealize Automation is a verified provider. Verified providers are owned and maintained by members of the HashiCorp Technology Partner Program. HashiCorp verifies the authenticity of the publisher and the providers are listed on the [Terraform Registry](https://registry.terraform.io) with a verified tier label. |
10 | 10 |
|
11 |
| -You can download the appropriate version of the provider for your OS via either your browser or the commandline using a tool like curl or wget. |
| 11 | +### Configure the Terraform Configuration Files |
12 | 12 |
|
13 |
| -### Linux |
| 13 | +Providers listed on the Terraform Registry can be automatically downloaded when initializing a working directory with `terraform init`. The Terraform configuration block is used to configure some behaviors of Terraform itself, such as the Terraform version and the required providers and versions. |
14 | 14 |
|
15 |
| -Create a terraform plugins directory with your hardware platform subdirectory. Typically for 64bit Linux this will be in ```~/.terraform.d/plugins/linux_amd64``` on non-Windows platforms. |
| 15 | +**Example**: A Terraform configuration block. |
16 | 16 |
|
17 |
| -```bash |
18 |
| -mkdir -p ~/.terraform.d/plugins/linux_amd64 |
| 17 | +```hcl |
| 18 | +terraform { |
| 19 | + required_providers { |
| 20 | + vra = { |
| 21 | + source = "vmware/vra" |
| 22 | + version = ">= 0.4.0" |
| 23 | + } |
| 24 | + } |
| 25 | + required_version = ">= 0.13" |
| 26 | +} |
19 | 27 | ```
|
| 28 | +### Verify Terraform Initialization Using the Terraform Registry |
20 | 29 |
|
21 |
| -Download the plugin (via a browser or command line) |
22 |
| - |
23 |
| - ```bash |
24 |
| - RELEASE=0.3.5 |
25 |
| - wget -q https://github.com/vmware/terraform-provider-vra/releases/download/v${RELEASE}/terraform-provider-vra-linux_amd64-v${RELEASE}.tgz |
26 |
| - ``` |
| 30 | +To verify the initialization, navigate to the working directory for your Terraform configuration and run `terraform init`. You should see a message indicating that Terraform has been successfully initialized and downloaded the Terraform Provider for vRealize Automation from the Terraform Registry is installed. |
27 | 31 |
|
28 |
| -Untar/unzip the plugin |
| 32 | +**Example**: Initialize and Download the Provider. |
29 | 33 |
|
30 |
| -```shell |
31 |
| -tar xvf terraform-provider-vra-linux_amd64-v${RELEASE}.tgz |
32 | 34 | ```
|
| 35 | +$ ./terraform init |
33 | 36 |
|
34 |
| -If you already have an existing version of provider, either remove the existing provider file from the terraform plugins directory or update all configuration files to include latest version |
| 37 | +Initializing the backend... |
35 | 38 |
|
36 |
| -```shell |
37 |
| -rm ~/.terraform.d/plugins/terraform-provider-vra* |
38 |
| -``` |
| 39 | +Initializing provider plugins... |
| 40 | +- Finding vmware/vra versions matching ">= 0.4.0"... |
| 41 | +- Installing vmware/vra v0.4.0... |
| 42 | +- Installed vmware/vra v0.4.0 (signed by a HashiCorp partner, key ID *************) |
39 | 43 |
|
40 |
| -Move the extracted plugin to the terraform plugins directory |
| 44 | +... |
41 | 45 |
|
42 |
| -```shell |
43 |
| -mv terraform-provider-vra_v${RELEASE} ~/.terraform.d/plugins/ |
| 46 | +Terraform has been successfully initialized! |
44 | 47 | ```
|
45 | 48 |
|
46 |
| -#### Linux Example |
| 49 | +## Manual Installation |
| 50 | + |
| 51 | +The [latest](https://github.com/vmware/terraform-provider-vra/releases/latest) release of the provider can be found on [the GitHub repository releases](https://github.com/vmware/terraform-provider-vra/releases). You can download the appropriate version of the provider for your operating system using a command line shell or a browser. |
| 52 | + |
| 53 | +This can be useful in environments that do not allow direct access to the Internet. |
| 54 | + |
| 55 | +### Linux |
| 56 | + |
| 57 | +The following examples use Bash on Linux (x64). |
| 58 | + |
| 59 | +1. On an a Linux operating system with Internet access, download the plugin from GitHub using the shell. |
| 60 | + |
| 61 | + ```bash |
| 62 | + RELEASE=0.4.0 |
| 63 | + wget -q https://github.com/vmware/terraform-provider-vra/releases/download/v${RELEASE}/terraform-provider-vra_${RELEASE}_linux_amd64.zip |
| 64 | + ``` |
| 65 | + |
| 66 | +2. Extract the plugin. |
| 67 | + |
| 68 | + ```bash |
| 69 | + tar xvf terraform-provider-vra_${RELEASE}_linux_amd64.zip |
| 70 | + ``` |
| 71 | + |
| 72 | +3. Copy the extracted plugin to a target system and move to the Terraform plugins directory. |
| 73 | + |
| 74 | + >**Note**: The directory directory hierarchy that Terraform use to precisely determine the source of each provider it finds locally.<br/> |
| 75 | + > `$PLUGIN_DIRECTORY/$SOURCEHOSTNAME/$SOURCENAMESPACE/$NAME/$VERSION/$OS_$ARCH/` |
| 76 | + |
| 77 | + ```bash |
| 78 | + mv terraform-provider-vra_v${RELEASE} ~/.terraform.d/plugins/local/vmware/vra/${RELEASE}/linux_amd64 |
| 79 | + ``` |
| 80 | + |
| 81 | +4. Verify the presence of the plugin in the Terraform plugins directory. |
| 82 | + |
| 83 | + ```bash |
| 84 | + cd ~/.terraform.d/plugins/local/vmware/vra/${RELEASE}/linux_amd64 |
| 85 | + ls |
| 86 | + ``` |
| 87 | + |
| 88 | +### macOS |
| 89 | + |
| 90 | +The following example uses Bash (default) on macOS (Intel). |
| 91 | + |
| 92 | +1. On a macOS operating system with Internet access, install wget with [Homebrew](https://brew.sh). |
| 93 | + |
| 94 | + ```bash |
| 95 | + brew install wget |
| 96 | + ``` |
| 97 | + |
| 98 | +2. Download the plugin from GitHub using the shell. |
| 99 | + |
| 100 | + ```bash |
| 101 | + RELEASE=0.4.0 |
| 102 | + wget -q https://github.com/vmware/terraform-provider-vra/releases/download/v${RELEASE}/terraform-provider-vra_${RELEASE}_darwin_amd64.zip |
| 103 | + ``` |
| 104 | + |
| 105 | +3. Extract the plugin. |
47 | 106 |
|
48 |
| - |
| 107 | + ```bash |
| 108 | + tar xvf terraform-provider-vra_${RELEASE}_darwin_amd64.zip |
| 109 | + ``` |
| 110 | + |
| 111 | +5. Copy the extracted plugin to a target system and move to the Terraform plugins directory. |
| 112 | + |
| 113 | + >**Note**: The directory directory hierarchy that Terraform use to precisely determine the source of each provider it finds locally.<br/> |
| 114 | + > `$PLUGIN_DIRECTORY/$SOURCEHOSTNAME/$SOURCENAMESPACE/$NAME/$VERSION/$OS_$ARCH/` |
| 115 | + |
| 116 | + ```bash |
| 117 | + mv terraform-provider-vra_v${RELEASE} ~/.terraform.d/plugins/local/vmware/vra/${RELEASE}/darwin_amd64 |
| 118 | + ``` |
| 119 | + |
| 120 | +6. Verify the presence of the plugin in the Terraform plugins directory. |
| 121 | + |
| 122 | + ```bash |
| 123 | + cd ~/.terraform.d/plugins/local/vmware/vra/${RELEASE}/darwin_amd64 |
| 124 | + ls |
| 125 | + ``` |
49 | 126 |
|
50 | 127 | ### Windows
|
51 | 128 |
|
52 |
| -Create a terraform plugins directory typically this will be in ```%APPDATA%\terraform.d\plugins```. |
| 129 | +The following examples use PowerShell on Windows (x64). |
53 | 130 |
|
54 |
| -```powershell |
55 |
| - #powershell |
56 |
| - mkdir $ENV:APPDATA\terraform.d\plugins |
57 |
| -``` |
| 131 | +1. On a Windows operating system with Internet access, download the plugin using the PowerShell. |
58 | 132 |
|
59 |
| -```cmd |
60 |
| -#CMD |
61 |
| -mkdir %APPDATA%\terraform.d\plugins |
62 |
| -``` |
| 133 | + ```powershell |
| 134 | + $RELEASE="0.4.0" |
| 135 | + Invoke-WebRequest https://github.com/vmware/terraform-provider-vra/releases/download/v${RELEASE}/terraform-provider-vra_${RELEASE}_windows_amd64.zip -outfile terraform-provider-vra_${RELEASE}_windows_amd64.zip |
| 136 | + ``` |
63 | 137 |
|
64 |
| -Download the plugin (via a browser or command line) |
| 138 | +2. Extract the plugin. |
65 | 139 |
|
66 |
| - ```powershell |
67 |
| - $RELEASE="0.3.5" |
68 |
| - wget https://github.com/vmware/terraform-provider-vra/releases/download/v${RELEASE}/terraform-provider-vra-windows_amd64-v${RELEASE}.tgz -outfile terraform-provider-vra-windows_amd64-v${RELEASE}.tgz |
69 |
| - ``` |
| 140 | + ```powershell |
| 141 | + Expand-Archive terraform-provider-vra_${RELEASE}_windows_amd64.zip |
70 | 142 |
|
71 |
| -Untar/unzip the plugin (Depending on your setup this may require two steps) |
| 143 | + cd terraform-provider-vra_${RELEASE}_windows_amd64 |
| 144 | + ``` |
72 | 145 |
|
73 |
| -```powershell |
74 |
| -#using 7zip to unzip |
75 |
| -7z x .\terraform-provider-vra-windows_amd64-v${RELEASE}.tgz |
| 146 | +4. Copy the extracted plugin to a target system and move to the Terraform plugins directory. |
76 | 147 |
|
77 |
| -# then untar resulting file |
78 |
| -tar xvf terraform-provider-vra-windows_amd64-v${RELEASE}.tar |
79 |
| -``` |
| 148 | + >**Note**: The directory directory hierarchy that Terraform use to precisely determine the source of each provider it finds locally.<br/> |
| 149 | + > `$PLUGIN_DIRECTORY/$SOURCEHOSTNAME/$SOURCENAMESPACE/$NAME/$VERSION/$OS_$ARCH/` |
| 150 | + |
| 151 | + ```powershell |
| 152 | + New-Item $ENV:APPDATA\terraform.d\plugins\local\vmware\vra\${RELEASE}\ -Name "windows_amd64" -ItemType "directory" |
| 153 | +
|
| 154 | + Move-Item terraform-provider-vra_v${RELEASE}.exe $ENV:APPDATA\terraform.d\plugins\local\vmware\vra\${RELEASE}\windows_amd64\terraform-provider-vra_v${RELEASE}.exe |
| 155 | + ``` |
| 156 | + |
| 157 | +5. Verify the presence of the plugin in the Terraform plugins directory. |
| 158 | + |
| 159 | + ```powershell |
| 160 | + cd $ENV:APPDATA\terraform.d\plugins\local\vmware\vra\${RELEASE}\windows_amd64 |
| 161 | + dir |
| 162 | + ``` |
80 | 163 |
|
81 |
| -Move the extracted plugin to the terraform plugins directory |
| 164 | +### Configure the Terraform Configuration Files |
82 | 165 |
|
83 |
| -```powershell |
84 |
| -#Powershell |
85 |
| -move terraform-provider-vra_v${RELEASE}.exe $ENV:APPDATA\terraform.d\plugins |
| 166 | + A working directory can be initialized with providers that are installed locally on a system by using `terraform init`. The Terraform configuration block is used to configure some behaviors of Terraform itself, such as the Terraform version and the required providers source and version. |
| 167 | + |
| 168 | +**Example**: A Terraform configuration block. |
| 169 | + |
| 170 | +```hcl |
| 171 | +terraform { |
| 172 | + required_providers { |
| 173 | + vra = { |
| 174 | + source = "local/vmware/vra" |
| 175 | + version = ">= 0.4.0" |
| 176 | + } |
| 177 | + } |
| 178 | + required_version = ">= 1.0.0" |
| 179 | +} |
86 | 180 | ```
|
87 | 181 |
|
88 |
| -```cmd |
89 |
| -#CMD |
90 |
| -move terraform-provider-vra_v%RELEASE%.exe %APPDATA%\terraform.d\plugins |
| 182 | +### Verify the Terraform Initialization of a Manually Installed Provider |
| 183 | + |
| 184 | +To verify the initialization, navigate to the working directory for your Terraform configuration and run `terraform init`. You should see a message indicating that Terraform has been successfully initialized and the installed version of the Terraform Provider for vRealize Automation. |
| 185 | + |
| 186 | +**Example**: Initialize and Use a Manually Installed Provider |
| 187 | + |
91 | 188 | ```
|
| 189 | +$ ./terraform init |
92 | 190 |
|
93 |
| -#### Windows Example |
| 191 | +Initializing the backend... |
94 | 192 |
|
95 |
| - |
| 193 | +Initializing provider plugins... |
| 194 | +- Finding local/vmware/vra versions matching ">= 0.4.0"... |
| 195 | +- Installing local/vmware/vra v0.4.0... |
| 196 | +- Installed local/vmware/vra v0.4.0 (unauthenticated) |
| 197 | +... |
96 | 198 |
|
97 |
| -## Validating the install |
| 199 | +Terraform has been successfully initialized! |
| 200 | +``` |
98 | 201 |
|
99 |
| -To validate the installation you can simply change to the location where your terraform configuration is located and run ```terraform init```. You should see a message indicating that terraform has been successfully initialized. |
| 202 | +## Get the Provider Version |
| 203 | +To find the provider version, navigate to the working directory of your Terraform configuration and run `terraform version`. You should see a message indicating the provider version. |
100 | 204 |
|
101 |
| - |
| 205 | +**Example**: Terraform Provider Version from the Terraform Registry |
102 | 206 |
|
103 |
| -## Get Provider version |
104 |
| -To find the provider version, you can simply change to the location where your terraform configuration is located and run ```terraform -version```. You should see a message indicating the provider version. |
| 207 | +``` |
| 208 | +$ ./terraform version |
| 209 | +Terraform v1.0.0 |
| 210 | +on linux_amd64 |
| 211 | ++ provider registry.terraform.io/vmware/vra v0.4.0 |
| 212 | +``` |
| 213 | +**Example**: Terraform Provider Version for a Manually Installed Provider |
| 214 | +
|
| 215 | +``` |
| 216 | +$ ./terraform version |
| 217 | +Terraform v1.0.0 |
| 218 | +on linux_amd64 |
| 219 | ++ provider local/vmware/vra v0.4.0 |
| 220 | +``` |
0 commit comments