databricks-cli/bundle
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
..
artifacts Make all workspace paths string fields (#327) 2023-04-12 16:54:36 +02:00
config Add omitempty tag to bundle git details (#372) 2023-05-01 14:34:12 +02:00
deploy Improved error message when 'bricks bundle run' is executed before 'bricks bundle deploy' (#378) 2023-05-10 11:02:25 +02:00
deployer Acquire lock prior to deploy (#270) 2023-03-22 16:37:26 +01:00
internal/tf Update Terraform provider schema structs (#265) 2023-03-20 17:22:55 +01:00
phases Add bundle destroy command (#300) 2023-04-06 12:54:58 +02:00
run Fixed printing the tasks in job output in DAG execution order (#377) 2023-05-08 16:35:47 +02:00
schema Add top level docs for bundle json schema (#313) 2023-04-12 21:43:53 +02:00
tests Add git config block to bundle config (#356) 2023-04-26 16:54:36 +02:00
bundle.go Store relative path to configuration file for every resource (#322) 2023-04-12 16:17:13 +02:00
bundle_test.go Store relative path to configuration file for every resource (#322) 2023-04-12 16:17:13 +02:00
context.go Make sync command work in bundle context; reorder args (#207) 2023-02-20 11:33:30 +01:00
context_test.go Add command that writes the materialized bundle configuration to stdout (#95) 2022-11-21 15:39:53 +01:00
mutator.go Include mutator name in logging context (#271) 2023-03-22 15:54:10 +01:00
mutator_test.go Move mutator interface to top level bundle package (#105) 2022-11-28 10:59:43 +01:00
root.go Add function to opportunistically load a bundle (#180) 2023-01-27 16:57:39 +01:00
root_test.go Add function to opportunistically load a bundle (#180) 2023-01-27 16:57:39 +01:00