databricks-cli/bundle/deploy/terraform
Andrew Nester 473d2bf503
Improved error message when 'bricks bundle run' is executed before 'bricks bundle deploy' (#378)
## Changes
Improved error message when 'bricks bundle run' is executed before
'bricks bundle deploy'

The error happens when we attempt to load terraform state when it does
not exist.

The best way to check if terraform state actually exists is to call
`terraform show -json` and that's what already happens here

https://github.com/databricks/bricks/compare/main...error-before-deploy#diff-8c50f8c04e568397bc865b7e02d1f4ec5b18379d8d32daddfeb041035d804f5fL28

Absence of `state.Values` indicates that there is no state and likely
bundle was just never deployed.

## Tests
Ran `bricks bundle run test_job` on a new non-deployed bundle.

**Output:**

`Error: terraform show: No state. Did you forget to run 'bricks bundle
deploy'?`

Running `bricks bundle deploy && bricks bundle run test_job` succeeds.

---------

Co-authored-by: Pieter Noordhuis <pieter.noordhuis@databricks.com>
2023-05-10 11:02:25 +02:00
..
apply.go Log mutator messages using progress logger (#312) 2023-04-18 16:55:06 +02:00
convert.go Improved error message when 'bricks bundle run' is executed before 'bricks bundle deploy' (#378) 2023-05-10 11:02:25 +02:00
convert_test.go Update to Go SDK v0.8.0 (#351) 2023-04-21 10:30:20 +02:00
destroy.go Log mutator messages using progress logger (#312) 2023-04-18 16:55:06 +02:00
dir.go Automatically install Terraform if needed (#141) 2022-12-15 17:30:33 +01:00
init.go Pass through $HOME when invoking Terraform (#319) 2023-04-11 13:11:31 +02:00
init_test.go Pass through $HOME when invoking Terraform (#319) 2023-04-11 13:11:31 +02:00
interpolate.go Add resources for mlflow models and experiments (#263) 2023-03-20 21:28:43 +01:00
load.go Improved error message when 'bricks bundle run' is executed before 'bricks bundle deploy' (#378) 2023-05-10 11:02:25 +02:00
load_test.go Improved error message when 'bricks bundle run' is executed before 'bricks bundle deploy' (#378) 2023-05-10 11:02:25 +02:00
pkg.go Add mutators to pull and push Terraform state (#288) 2023-03-30 12:01:09 +02:00
plan.go Log mutator messages using progress logger (#312) 2023-04-18 16:55:06 +02:00
state_pull.go Make all workspace paths string fields (#327) 2023-04-12 16:54:36 +02:00
state_push.go Make all workspace paths string fields (#327) 2023-04-12 16:54:36 +02:00
write.go Mutators to work with Terraform (#124) 2022-12-09 08:57:30 +01:00