Skip to content

Commit cc74f7e

Browse files
pieternclaude
andcommitted
Add required field checks for postgres resource IDs
Changes the postgres resource ID fields (project_id, branch_id, endpoint_id) from optional to required, matching the API's behavior. Previously these fields were marked as omitempty but the API requires them for resource creation. Changes: - Mark project_id, branch_id, endpoint_id, and parent fields as required in bundle config - Remove manual validation from direct deployment code (now handled by config validation) - Update generated required_fields.go and JSON schema - Add validation in test server to return 400 errors matching real API behavior - Update acceptance test outputs to reflect new warning messages and error responses The test server now properly validates required ID fields and returns the same error message as the real API: "Field 'X' is required, expected non-default value (not \"\")!" All acceptance tests pass both locally and against real AWS workspace. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 67e8d85 commit cc74f7e

File tree

26 files changed

+2178
-50
lines changed

26 files changed

+2178
-50
lines changed

.databricks/databricks

54.6 MB
Binary file not shown.
Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
1+
Warning: required field "branch_id" is not set
2+
at resources.postgres_branches.main
3+
in databricks.yml:21:7
4+
15
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/deploy-postgres-branch-no-id-[UNIQUE_NAME]/default/files...
26
Deploying resources...
3-
Error: cannot create resources.postgres_branches.main: branch_id must be specified
7+
Error: cannot create resources.postgres_branches.main: Field 'branch_id' is required, expected non-default value (not "")! (400 INVALID_PARAMETER_VALUE)
8+
9+
Endpoint: POST [DATABRICKS_URL]/api/2.0/postgres/projects/test-pg-proj-[UNIQUE_NAME]/branches
10+
HTTP Status: 400 Bad Request
11+
API error_code: INVALID_PARAMETER_VALUE
12+
API message: Field 'branch_id' is required, expected non-default value (not "")!
413

514
Updating deployment state...

acceptance/bundle/resources/postgres_branches/without_branch_id/out.deploy.terraform.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
Warning: required field "branch_id" is not set
2+
at resources.postgres_branches.main
3+
in databricks.yml:21:7
4+
15
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/deploy-postgres-branch-no-id-[UNIQUE_NAME]/default/files...
26
Error: exit status 1
37

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11

22
>>> [CLI] bundle validate
3+
Warning: required field "branch_id" is not set
4+
at resources.postgres_branches.main
5+
in databricks.yml:21:7
6+
37
Name: deploy-postgres-branch-no-id-[UNIQUE_NAME]
48
Target: default
59
Workspace:
610
User: [USERNAME]
711
Path: /Workspace/Users/[USERNAME]/.bundle/deploy-postgres-branch-no-id-[UNIQUE_NAME]/default
812

9-
Validation OK!
13+
Found 1 warning
Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
1+
Warning: required field "endpoint_id" is not set
2+
at resources.postgres_endpoints.primary
3+
in databricks.yml:27:7
4+
15
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/deploy-postgres-endpoint-no-id-[UNIQUE_NAME]/default/files...
26
Deploying resources...
3-
Error: cannot create resources.postgres_endpoints.primary: endpoint_id must be specified
7+
Error: cannot create resources.postgres_endpoints.primary: Field 'endpoint_id' is required, expected non-default value (not "")! (400 INVALID_PARAMETER_VALUE)
8+
9+
Endpoint: POST [DATABRICKS_URL]/api/2.0/postgres/projects/test-pg-proj-[UNIQUE_NAME]/branches/main/endpoints
10+
HTTP Status: 400 Bad Request
11+
API error_code: INVALID_PARAMETER_VALUE
12+
API message: Field 'endpoint_id' is required, expected non-default value (not "")!
413

514
Updating deployment state...

acceptance/bundle/resources/postgres_endpoints/without_endpoint_id/out.deploy.terraform.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
Warning: required field "endpoint_id" is not set
2+
at resources.postgres_endpoints.primary
3+
in databricks.yml:27:7
4+
15
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/deploy-postgres-endpoint-no-id-[UNIQUE_NAME]/default/files...
26
Error: exit status 1
37

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11

22
>>> [CLI] bundle validate
3+
Warning: required field "endpoint_id" is not set
4+
at resources.postgres_endpoints.primary
5+
in databricks.yml:27:7
6+
37
Name: deploy-postgres-endpoint-no-id-[UNIQUE_NAME]
48
Target: default
59
Workspace:
610
User: [USERNAME]
711
Path: /Workspace/Users/[USERNAME]/.bundle/deploy-postgres-endpoint-no-id-[UNIQUE_NAME]/default
812

9-
Validation OK!
13+
Found 1 warning
Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
1+
Warning: required field "project_id" is not set
2+
at resources.postgres_projects.my_project
3+
in databricks.yml:10:7
4+
15
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/deploy-postgres-no-id-[UNIQUE_NAME]/default/files...
26
Deploying resources...
3-
Error: cannot create resources.postgres_projects.my_project: project_id must be specified
7+
Error: cannot create resources.postgres_projects.my_project: Field 'project_id' is required, expected non-default value (not "")! (400 INVALID_PARAMETER_VALUE)
8+
9+
Endpoint: POST [DATABRICKS_URL]/api/2.0/postgres/projects
10+
HTTP Status: 400 Bad Request
11+
API error_code: INVALID_PARAMETER_VALUE
12+
API message: Field 'project_id' is required, expected non-default value (not "")!
413

514
Updating deployment state...

acceptance/bundle/resources/postgres_projects/without_project_id/out.deploy.terraform.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
Warning: required field "project_id" is not set
2+
at resources.postgres_projects.my_project
3+
in databricks.yml:10:7
4+
15
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/deploy-postgres-no-id-[UNIQUE_NAME]/default/files...
26
Error: exit status 1
37

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11

22
>>> [CLI] bundle validate
3+
Warning: required field "project_id" is not set
4+
at resources.postgres_projects.my_project
5+
in databricks.yml:10:7
6+
37
Name: deploy-postgres-no-id-[UNIQUE_NAME]
48
Target: default
59
Workspace:
610
User: [USERNAME]
711
Path: /Workspace/Users/[USERNAME]/.bundle/deploy-postgres-no-id-[UNIQUE_NAME]/default
812

9-
Validation OK!
13+
Found 1 warning

0 commit comments

Comments
 (0)