Skip to content

Commit 49c8e5f

Browse files
authored
direct: resolve ${resources.<group>.<key>.<field>} for fields present in the config (#3466)
## Changes - All resource references now add edge to the graph. - The references that point to a path in config are resolved based on the config at plan time. - New package: structaccess that fetches a given path from struct. ## Tests - resource_var tests disabled in #3443 are now passing. - non existent field test added in #3481 now shows correct error. - internal field reference test added in #3491 now shows correct error in direct mode.
1 parent 0769627 commit 49c8e5f

File tree

22 files changed

+888
-80
lines changed

22 files changed

+888
-80
lines changed
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files...
2-
Error: reading config: failed to read references from config for jobs.bar: parsing refs: cannot process reference resources.jobs.foo.url: only ${resources.<group>.<key>.id} references are supported
2+
Error: cannot resolve ${resources.jobs.foo.url}: url: field "url" not found in resources.Job
3+
4+
Error: cannot plan jobs.bar: dependency failed: jobs.foo
5+
6+
Error: planning failed
37

48

59
Exit code: 1
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
Error: reading config: failed to read references from config for jobs.bar: parsing refs: cannot process reference resources.jobs.foo.url: only ${resources.<group>.<key>.id} references are supported
1+
Error: cannot resolve ${resources.jobs.foo.url}: url: field "url" not found in resources.Job
2+
3+
Error: cannot plan jobs.bar: dependency failed: jobs.foo
4+
5+
Error: planning failed
26

37

48
Exit code: 1
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files...
2-
Error: reading config: failed to read references from config for volumes.foo: parsing refs: cannot process reference resources.volumes.bar.non_existent: only ${resources.<group>.<key>.id} references are supported
2+
Error: cannot resolve ${resources.volumes.bar.non_existent}: non_existent: field "non_existent" not found in resources.Volume
3+
4+
Error: cannot plan volumes.foo: dependency failed: volumes.bar
5+
6+
Error: planning failed
37

48

59
Exit code (musterr): 1
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
Error: reading config: failed to read references from config for volumes.foo: parsing refs: cannot process reference resources.volumes.bar.non_existent: only ${resources.<group>.<key>.id} references are supported
1+
Error: cannot resolve ${resources.volumes.bar.non_existent}: non_existent: field "non_existent" not found in resources.Volume
2+
3+
Error: cannot plan volumes.foo: dependency failed: volumes.bar
4+
5+
Error: planning failed
26

37

48
Exit code (musterr): 1

acceptance/bundle/resource_deps/resources_var/out.deploy.direct-exp.txt

Lines changed: 0 additions & 7 deletions
This file was deleted.

acceptance/bundle/resource_deps/resources_var/out.deploy.terraform.txt renamed to acceptance/bundle/resource_deps/resources_var/out.deploy.txt

File renamed without changes.

acceptance/bundle/resource_deps/resources_var/out.requests.direct-exp.txt

Lines changed: 0 additions & 2 deletions
This file was deleted.

acceptance/bundle/resource_deps/resources_var/out.requests.terraform.txt renamed to acceptance/bundle/resource_deps/resources_var/out.requests.txt

File renamed without changes.
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
trace $CLI bundle validate -t dev -o json | jq .resources
2-
trace errcode $CLI bundle deploy -t dev &> out.deploy.$DATABRICKS_CLI_DEPLOYMENT.txt
3-
trace jq -s '.[] | select(.path=="/api/2.0/pipelines") | .body.name' out.requests.txt &> out.requests.$DATABRICKS_CLI_DEPLOYMENT.txt
2+
trace errcode $CLI bundle deploy -t dev &> out.deploy.txt
3+
trace jq -s '.[] | select(.path=="/api/2.0/pipelines") | .body.name' out.requests.txt &> tmp.requests.txt
44
rm out.requests.txt
5+
mv tmp.requests.txt out.requests.txt

acceptance/bundle/resource_deps/resources_var/test.toml

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)