Commit f07c491
authored
Add -terraform-dir option to acceptance tests (#3497)
## Changes
This flag makes the download location of the Terraform CLI and providers
configurable instead of defaulting to acceptance/build.
## Why
DBR does not allow creating symlinks between the workspace file system
and the local file system mount on an serverless instance.
So in order to run acceptance tests on workspace file system, the
Databricks terraform provider must also live on the workspace file
system.
## Background
We configure file system mirrors in acceptance tests for Terraform
providers in order to only download the provider once:
```
provider_installation {
filesystem_mirror {
path = "/Users/shreyas.goenka/repos/cli/acceptance/build/darwin_arm64/tfplugins"
include = ["registry.terraform.io/databricks/databricks"]
}
}
```
Because the DBR CLI repo lives on the local file mount, but the tests
are run on the workspace file system, this file system mirror fails
because it cannot create the necessary symlinks during `terraform init`
(which is called during `bundle deploy`).
Making the Terraform installation directory configurable allows us to
install TF on the workspace file system, bypassing this limitation.
## Tests
Manually verified that:
1. The `install_terraform.py` script respects the—terraform-dir value,
and the Terraform CLI and provider are installed in the correct
directory.
2. The correct environment variables are set when the test is executed:
```
DATABRICKS_TF_CLI_CONFIG_FILE=/Users/shreyas.goenka/repos/cli/somecustomdir/.terraformrc
DATABRICKS_TF_EXEC_PATH=/Users/shreyas.goenka/repos/cli/somecustomdir/terraform
```1 parent 85537b5 commit f07c491
1 file changed
+17
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| 50 | + | |
50 | 51 | | |
51 | 52 | | |
52 | 53 | | |
| |||
72 | 73 | | |
73 | 74 | | |
74 | 75 | | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
75 | 81 | | |
76 | 82 | | |
77 | 83 | | |
| |||
148 | 154 | | |
149 | 155 | | |
150 | 156 | | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
151 | 164 | | |
152 | | - | |
153 | | - | |
| 165 | + | |
| 166 | + | |
154 | 167 | | |
155 | 168 | | |
156 | 169 | | |
| |||
226 | 239 | | |
227 | 240 | | |
228 | 241 | | |
229 | | - | |
| 242 | + | |
230 | 243 | | |
231 | 244 | | |
232 | 245 | | |
233 | 246 | | |
234 | | - | |
| 247 | + | |
235 | 248 | | |
236 | 249 | | |
237 | 250 | | |
| |||
0 commit comments