Skip to content

Redact sensitive variables from bundle plan and saved plans - #7713

Open
andrewnester wants to merge 19 commits into
mainfrom
feat/plan-secret-redaction
Open

andrewnester wants to merge 19 commits into
mainfrom
feat/plan-secret-redaction

Conversation

@andrewnester

@andrewnester andrewnester commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Changes

  • bundle plan output (text and -o json) and the saved plan file no longer contain sensitive variable values. The plan's new_state is redacted once planning is done, alongside remote_state and changes.
  • bundle deploy --plan restores sensitive fields from the current config and fails before approval when a value is missing. The restored value is built by the same function planning uses (buildPlannedState), so a deploy from the plan sends what a plain deploy sends. References that planning resolves before deploy are resolved the same way, including references to unchanged resources, which are read from their local config rather than the remote state; the rest are resolved at apply. A reference that does not resolve fails the check before anything is uploaded. An escaped $${...} is sent as ${...}. For every sensitive field: a non-empty config value is restored; a non-zero planned value with an empty config value is an error; both empty is skipped (output-only fields). A reference in the config to a resource the saved plan does not depend on is an error, and the message asks for bundle plan again.
  • The saved plan no longer carries the references of sensitive fields, so a template such as a secret with a reference inside it does not show in the plan file.
  • One pre-approval check, CheckSensitivePlanValues, reports one error per resource. It runs the same restore as apply, so the check and the apply cannot disagree. It looks at the resolved config value of each sensitive field the plan sets, so a value from --var, BUNDLE_VAR_<name>, a default, a target or the variable-overrides file all count. Sensitive variables that no planned resource uses need no value.
  • deploy --plan applies the sensitive values supplied at deploy time. They are not compared with the values used at plan time, so a saved plan can be applied with a different secret value than was planned.
  • Saved plans now use plan version 3, so released CLIs refuse them instead of applying the redaction marker as the secret. LoadPlanFromFile still reads version 2 plans, and their sensitive fields are restored from the config. Acceptance bundle/deploy/readplan/plan-version-2 covers a version 2 plan.
  • Apply no longer writes resolved references back into the redacted plan entries, so no secret is held in the plan entries after a deploy.
  • The prepareChanges warning no longer prints change values. It previously showed old, new and remote values before redaction at the default log level.

Why

Fixes #7685. bundle plan and bundle deploy showed and stored sensitive variable values that bundle validate -o json already redacts. Since a saved plan no longer carries them, deploy --plan needs the values supplied again, and it applies the values given at deploy time, not those at plan time.

Tests

  • Unit (bundle/direct/redact_test.go): the restore table covers marker and plaintext replaced, zero in plan but set in config restored, both zero skipped, empty config value error, missing resource error, a reference kept for apply, and an escaped reference sent as its literal. The check table covers a plan without sensitive resources, a set or zero value passing, and an empty config value. A separate test checks one error per resource, and another checks that apply does not write resolved values back into a redacted plan entry.
  • Acceptance bundle/variables/sensitive/plan-restore: a resource reference and an escaped reference in sensitive values; the create request bodies of a plain deploy and of deploy --plan must be identical. It also changes the config between bundle plan and deploy --plan: a reference that becomes a literal is sent as the literal, and a literal that becomes a reference is refused with the bundle plan message.
  • Acceptance bundle/deploy/readplan/plan-version-2: a version 2 plan with a stale plaintext secret still deploys the value from the config.
  • Acceptance bundle/variables/sensitive/plan-derived: unused sensitive variables with a derived default, a literal default, and a dev-target value need no value, and a saved plan deploys with the credential from the variable-overrides file.
  • Acceptance bundle/variables/sensitive/plan: literals are absent from plan output, the saved plan and local state; a saved-plan deploy requires the values again; an empty value fails with no state-changing request; a plain-path create with real values; a rotate step where only the PATCH carries the new value. The test fails on main without this change.
  • Full acceptance suite and lint pass.

This pull request and its description were written by Isaac.

bundle plan no longer prints or saves sensitive values: new_state is
redacted once planning is done. A saved plan does not carry them, so
deploy --plan requires every sensitive variable of the bundle to be set
with --var or BUNDLE_VAR_<name>, and restores each sensitive field from
the config when the config sets it. One check runs before approval and
reports all missing values in one error. The prepareChanges warning no
longer prints the change values, which were visible before redaction.

Co-authored-by: Isaac <no-reply@databricks.com>
@andrewnester
andrewnester requested review from a team as code owners November 17, 2026 09:43
@andrewnester
andrewnester requested a review from denik November 17, 2026 09:43
Co-authored-by: Isaac <no-reply@databricks.com>
@andrewnester
andrewnester force-pushed the feat/plan-secret-redaction branch from a9836b9 to 614d281 Compare November 17, 2026 09:44
@github-actions github-actions Bot added the DABs DABs related issues label Nov 17, 2026
@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Regression test report ✅

Commit: 880e130da | Workflow run

Selected 7 changed tests (limit=20, 0 not selected)

18 tests: regression=18 unreleased=0 coverage=0 failing=0
test branch main (9a14ad6) latest (v1.28.0)
TestAccept/bundle/deploy/readplan/plan-version-2/DMS= ✅ ❌ ❌
TestAccept/bundle/deploy/readplan/plan-version-2/DMS=true ✅ ❌ ❌
TestAccept/bundle/deploy/readplan/plan-version-mismatch/DMS= ✅ ❌ ❌
TestAccept/bundle/deploy/readplan/plan-version-mismatch/DMS=true ✅ ❌ ❌
TestAccept/bundle/resources/secrets/parent_rename/DMS=/READPLAN= ✅ ❌ ❌
TestAccept/bundle/resources/secrets/parent_rename/DMS=/READPLAN=1 ✅ ❌ ❌
TestAccept/bundle/resources/secrets/parent_rename/DMS=true/READPLAN= ✅ ❌ ❌
TestAccept/bundle/resources/secrets/parent_rename/DMS=true/READPLAN=1 ✅ ❌ ❌
TestAccept/bundle/resources/secrets/recreate_in_renamed_schema/DMS=/READPLAN= ✅ ❌ ❌
TestAccept/bundle/resources/secrets/recreate_in_renamed_schema/DMS=/READPLAN=1 ✅ ❌ ❌
TestAccept/bundle/resources/secrets/recreate_in_renamed_schema/DMS=true/READPLAN= ✅ ❌ ❌
TestAccept/bundle/resources/secrets/recreate_in_renamed_schema/DMS=true/READPLAN=1 ✅ ❌ ❌
TestAccept/bundle/variables/sensitive/plan-derived/DMS= ✅ ❌ ❌
TestAccept/bundle/variables/sensitive/plan-derived/DMS=true ✅ ❌ ❌
TestAccept/bundle/variables/sensitive/plan-restore/DMS= ✅ ❌ ❌
TestAccept/bundle/variables/sensitive/plan-restore/DMS=true ✅ ❌ ❌
TestAccept/bundle/variables/sensitive/plan/DMS= ✅ ❌ ❌
TestAccept/bundle/variables/sensitive/plan/DMS=true ✅ ❌ ❌
TestAccept/bundle/deploy/readplan/plan-version-2/DMS=: branch ✅ | main (9a14ad6) ❌ | latest (v1.28.0) ❌

main (9a14ad6):

acceptance_test.go:1402: Diff:
        --- bundle/deploy/readplan/plan-version-2/output.txt
        +++ /tmp/TestAcceptbundledeployreadplanplan-version-2DMS=1347615967/002/output.txt
        @@ -16,7 +16,7 @@
             "catalog_name": "main",
             "name": "test-secret",
             "schema_name": "default",
        -    "value": "dummy-config"
        +    "value": "stale-plaintext"
           }
         }

latest (v1.28.0): same output as main (9a14ad6)

TestAccept/bundle/deploy/readplan/plan-version-2/DMS=true: branch ✅ | main (9a14ad6) ❌ | latest (v1.28.0) ❌

main (9a14ad6):

acceptance_test.go:1402: Diff:
        --- bundle/deploy/readplan/plan-version-2/output.txt
        +++ /tmp/TestAcceptbundledeployreadplanplan-version-2DMS=true3951485724/002/output.txt
        @@ -16,7 +16,7 @@
             "catalog_name": "main",
             "name": "test-secret",
             "schema_name": "default",
        -    "value": "dummy-config"
        +    "value": "stale-plaintext"
           }
         }

latest (v1.28.0): same output as main (9a14ad6)

TestAccept/bundle/deploy/readplan/plan-version-mismatch/DMS=: branch ✅ | main (9a14ad6) ❌ | latest (v1.28.0) ❌

main (9a14ad6):

acceptance_test.go:1402: 
        	Error Trace:	/home/runner/work/cli/cli/libs/testdiff/testdiff.go:22
        	            				/home/runner/work/cli/cli/acceptance/acceptance_test.go:1402
        	            				/home/runner/work/cli/cli/acceptance/acceptance_test.go:1143
        	            				/home/runner/work/cli/cli/acceptance/acceptance_test.go:704
        	Error:      	Not equal: 
        	            	expected: "Error: plan version mismatch: plan has version 999 (generated with CLI \"0.0.0\"), but current version is 3\n\n\nExit code: 1\n"
        	            	actual  : "Error: plan version mismatch: plan has version 999 (generated with CLI \"0.0.0\"), but current version is 2\n\n\nExit code: 1\n"
        	            	
        	            	Diff:
        	            	--- Expected
        	            	+++ Actual
        	            	@@ -1,2 +1,2 @@
        	            	-Error: plan version mismatch: plan has version 999 (generated with CLI "0.0.0"), but current version is 3
        	            	+Error: plan version mismatch: plan has version 999 (generated with CLI "0.0.0"), but current version is 2
        	            	 
        	Test:       	TestAccept/bundle/deploy/readplan/plan-version-mismatch/DMS=
        	Messages:   	bundle/deploy/readplan/plan-version-mismatch/output.txt vs /tmp/TestAcceptbundledeployreadplanplan-version-mismatchDMS=468212364/002/output.txt

latest (v1.28.0): same output as main (9a14ad6)

TestAccept/bundle/deploy/readplan/plan-version-mismatch/DMS=true: branch ✅ | main (9a14ad6) ❌ | latest (v1.28.0) ❌

main (9a14ad6):

acceptance_test.go:1402: 
        	Error Trace:	/home/runner/work/cli/cli/libs/testdiff/testdiff.go:22
        	            				/home/runner/work/cli/cli/acceptance/acceptance_test.go:1402
        	            				/home/runner/work/cli/cli/acceptance/acceptance_test.go:1143
        	            				/home/runner/work/cli/cli/acceptance/acceptance_test.go:704
        	Error:      	Not equal: 
        	            	expected: "Error: plan version mismatch: plan has version 999 (generated with CLI \"0.0.0\"), but current version is 3\n\n\nExit code: 1\n"
        	            	actual  : "Error: plan version mismatch: plan has version 999 (generated with CLI \"0.0.0\"), but current version is 2\n\n\nExit code: 1\n"
        	            	
        	            	Diff:
        	            	--- Expected
        	            	+++ Actual
        	            	@@ -1,2 +1,2 @@
        	            	-Error: plan version mismatch: plan has version 999 (generated with CLI "0.0.0"), but current version is 3
        	            	+Error: plan version mismatch: plan has version 999 (generated with CLI "0.0.0"), but current version is 2
        	            	 
        	Test:       	TestAccept/bundle/deploy/readplan/plan-version-mismatch/DMS=true
        	Messages:   	bundle/deploy/readplan/plan-version-mismatch/output.txt vs /tmp/TestAcceptbundledeployreadplanplan-version-mismatchDMS=true2381958057/002/output.txt

latest (v1.28.0):

acceptance_test.go:1402: 
        	Error Trace:	/home/runner/work/cli/cli/libs/testdiff/testdiff.go:22
        	            				/home/runner/work/cli/cli/acceptance/acceptance_test.go:1402
        	            				/home/runner/work/cli/cli/acceptance/acceptance_test.go:1143
        	            				/home/runner/work/cli/cli/acceptance/acceptance_test.go:704
        	Error:      	Not equal: 
        	            	expected: "Error: plan version mismatch: plan has version 999 (generated with CLI \"0.0.0\"), but current version is 3\n\n\nExit code: 1\n"
        	            	actual  : "Error: plan version mismatch: plan has version 999 (generated with CLI \"0.0.0\"), but current version is 2\n\n\nExit code: 1\n"
        	            	
        	            	Diff:
        	            	--- Expected
        	            	+++ Actual
        	            	@@ -1,2 +1,2 @@
        	            	-Error: plan version mismatch: plan has version 999 (generated with CLI "0.0.0"), but current version is 3
        	            	+Error: plan version mismatch: plan has version 999 (generated with CLI "0.0.0"), but current version is 2
        	            	 
        	Test:       	TestAccept/bundle/deploy/readplan/plan-version-mismatch/DMS=true
        	Messages:   	bundle/deploy/readplan/plan-version-mismatch/output.txt vs /tmp/TestAcceptbundledeployreadplanplan-version-mismatchDMS=true3252229521/002/output.txt
FAIL
TestAccept/bundle/resources/secrets/parent_rename/DMS=/READPLAN=: branch ✅ | main (9a14ad6) ❌ | latest (v1.28.0) ❌

main (9a14ad6):

acceptance_test.go:1402: Diff:
        --- bundle/resources/secrets/parent_rename/output.txt
        +++ /tmp/TestAcceptbundleresourcessecretsparent_renameDMS=READPLAN=982391678/002/output.txt
        @@ -111,7 +111,7 @@
                 "comment": "c1",
                 "name": "mysecret",
                 "schema_name": "myschema2",
        -        "value": "[redacted]"
        +        "value": "secret-value"
               }
             },
             "remote_state": {
        @@ -308,7 +308,7 @@
                 "comment": "c2",
                 "name": "mysecret",
                 "schema_name": "myschema2",
        -        "value": "[redacted]"
        +        "value": "secret-value"
               }
             },
             "remote_state": {
        
    acceptance_test.go:1180: 
        LOG.destroy_requests: {
        LOG.destroy_requests:   "method": "DELETE",
        LOG.destroy_requests:   "path": "/api/2.1/unity-catalog/secrets/test_catalog_renamed_btefdhoq4ngr3fgtbygkdjw56u.myschema2.mysecret"
        LOG.destroy_requests: }
        LOG.destroy_requests: {
        LOG.destroy_requests:   "method": "DELETE",
        LOG.destroy_requests:   "path": "/api/2.1/unity-catalog/schemas/test_catalog_renamed_btefdhoq4ngr3fgtbygkdjw56u.myschema2",
        LOG.destroy_requests:   "q": {
        LOG.destroy_requests:     "force": "true"
        LOG.destroy_requests:   }
        LOG.destroy_requests: }
        LOG.destroy_requests: {
        LOG.destroy_requests:   "method": "DELETE",
        LOG.destroy_requests:   "path": "/api/2.1/unity-catalog/catalogs/test_catalog_renamed_btefdhoq4ngr3fgtbygkdjw56u",
        LOG.destroy_requests:   "q": {
        LOG.destroy_requests:     "force": "true"
        LOG.destroy_requests:   }
        LOG.destroy_requests: }

latest (v1.28.0):

acceptance_test.go:1402: Diff:
        --- bundle/resources/secrets/parent_rename/output.txt
        +++ /tmp/TestAcceptbundleresourcessecretsparent_renameDMS=READPLAN=3193012361/002/output.txt
        @@ -93,6 +93,7 @@
             }
           },
           "resources.secrets.secret1": {
        +    "id": "test_catalog_[UNIQUE_NAME].myschema2.mysecret",
             "depends_on": [
               {
                 "node": "resources.catalogs.catalog1",
        @@ -103,15 +104,14 @@
                 "label": "${resources.schemas.schema1.name}"
               }
             ],
        -    "action": "update_id",
        -    "state_only": true,
        +    "action": "recreate",
             "new_state": {
               "value": {
                 "catalog_name": "test_catalog_[UNIQUE_NAME]",
                 "comment": "c1",
                 "name": "mysecret",
                 "schema_name": "myschema2",
        -        "value": "[redacted]"
        +        "value": "secret-value"
               }
             },
             "remote_state": {
        @@ -160,8 +154,8 @@
                 "remote": "[USERNAME]"
               },
               "schema_name": {
        -        "action": "update_id",
        -        "reason": "parent_renamed",
        +        "action": "recreate",
        +        "reason": "spec:immutable",
                 "old": "myschema",
                 "new": "myschema2",
                 "remote": "myschema"
        @@ -184,9 +178,10 @@
         
         >>> [CLI] bundle deploy
         Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle-[UNIQUE_NAME]/default/files...
        +Recreated secrets.secret1
         Updated schemas.schema1
         Files: 1 uploaded, 0 deleted
        -Resources: 0 created, 1 changed, 0 deleted, 2 unchanged
        +Resources: 1 created, 1 changed, 1 deleted, 1 unchanged
         
         >>> print_requests.py //unity-catalog
         {
        @@ -198,12 +191,27 @@
             "new_name": "myschema2"
           }
         }
        +{
        +  "method": "DELETE",
        +  "path": "/api/2.1/unity-catalog/secrets/test_catalog_[UNIQUE_NAME].myschema2.mysecret"
        +}
        +{
        +  "method": "POST",
        +  "path": "/api/2.1/unity-catalog/secrets",
        +  "body": {
        +    "catalog_name": "test_catalog_[UNIQUE_NAME]",
        +    "comment": "c1",
        +    "name": "mysecret",
        +    "schema_name": "myschema2",
        +    "value": "secret-value"
        +  }
        +}
         
         >>> [CLI] secrets-uc get-secret test_catalog_[UNIQUE_NAME].myschema2.mysecret
         {
           "full_name": "test_catalog_[UNIQUE_NAME].myschema2.mysecret",
           "comment": "c1",
        -  "create_time": "[SECRET_CREATE_TIME]"
        +  "create_time": "[TIMESTAMP]"
         }
         
         === Rename the catalog and change the secret's comment: the update reaches the secret at its new path
        @@ -291,6 +294,7 @@
             }
           },
           "resources.secrets.secret1": {
        +    "id": "test_catalog_renamed_[UNIQUE_NAME].myschema2.mysecret",
             "depends_on": [
               {
                 "node": "resources.catalogs.catalog1",
        @@ -301,20 +305,20 @@
                 "label": "${resources.schemas.schema1.name}"
               }
             ],
        -    "action": "update_id",
        +    "action": "recreate",
             "new_state": {
               "value": {
                 "catalog_name": "test_catalog_renamed_[UNIQUE_NAME]",
                 "comment": "c2",
                 "name": "mysecret",
                 "schema_name": "myschema2",
        -        "value": "[redacted]"
        +        "value": "secret-value"
               }
             },
             "remote_state": {
               "catalog_name": "test_catalog_[UNIQUE_NAME]",
               "comment": "c1",
        -      "create_time": "[SECRET_CREATE_TIME]",
        +      "create_time": "[TIMESTAMP]",
               "created_by": "[USERNAME]",
               "effective_owner": "[USERNAME]",
               "effective_value": "[redacted]",
        @@ -322,13 +315,13 @@
               "name": "mysecret",
               "owner": "[USERNAME]",
               "schema_name": "myschema2",
        -      "update_time": "[SECRET_CREATE_TIME]",
        +      "update_time": "[TIMESTAMP]",
               "value": "[redacted]"
             },
             "changes": {
               "catalog_name": {
        -        "action": "update_id",
        -        "reason": "parent_renamed",
        +        "action": "recreate",
        +        "reason": "spec:immutable",
                 "old": "test_catalog_[UNIQUE_NAME]",
                 "new": "test_catalog_renamed_[UNIQUE_NAME]",
                 "remote": "test_catalog_[UNIQUE_NAME]"
        @@ -342,7 +331,7 @@
               "create_time": {
                 "action": "skip",
                 "reason": "spec:output_only",
        -        "remote": "[SECRET_CREATE_TIME]"
        +        "remote": "[TIMESTAMP]"
               },
               "created_by": {
                 "action": "skip",
        @@ -372,7 +361,7 @@
               "update_time": {
                 "action": "skip",
                 "reason": "spec:output_only",
        -        "remote": "[SECRET_CREATE_TIME]"
        +        "remote": "[TIMESTAMP]"
               },
               "value": {
                 "action": "skip",
        @@ -387,10 +376,10 @@
         
         >>> [CLI] bundle deploy
         Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle-[UNIQUE_NAME]/default/files...
        +Recreated secrets.secret1
         Updated catalogs.catalog1
        -Updated secrets.secret1
         Files: 1 uploaded, 0 deleted
        -Resources: 0 created, 2 changed, 0 deleted, 1 unchanged
        +Resources: 1 created, 1 changed, 1 deleted, 1 unchanged
         
         >>> print_requests.py //unity-catalog
         {
        @@ -403,11 +390,12 @@
           }
         }
         {
        -  "method": "PATCH",
        -  "path": "/api/2.1/unity-catalog/secrets/test_catalog_renamed_[UNIQUE_NAME].myschema2.mysecret",
        -  "q": {
        -    "update_mask": "*"
        -  },
        +  "method": "DELETE",
        +  "path": "/api/2.1/unity-catalog/secrets/test_catalog_renamed_[UNIQUE_NAME].myschema2.mysecret"
        +}
        +{
        +  "method": "POST",
        +  "path": "/api/2.1/unity-catalog/secrets",
           "body": {
             "catalog_name": "test_catalog_renamed_[UNIQUE_NAME]",
             "comment": "c2",
        @@ -421,7 +409,7 @@
         {
           "full_name": "test_catalog_renamed_[UNIQUE_NAME].myschema2.mysecret",
           "comment": "c2",
        -  "create_time": "[SECRET_CREATE_TIME]"
        +  "create_time": "[TIMESTAMP]"
         }
         
         === The state tracks the new path and the plan is a no-op
        
    acceptance_test.go:1180: 
        LOG.destroy_requests: {
        LOG.destroy_requests:   "method": "DELETE",
        LOG.destroy_requests:   "path": "/api/2.1/unity-catalog/secrets/test_catalog_renamed_a2iiyjqe35bajppmfmwfhxm54a.myschema2.mysecret"
        LOG.destroy_requests: }
        LOG.destroy_requests: {
        LOG.destroy_requests:   "method": "DELETE",
        LOG.destroy_requests:   "path": "/api/2.1/unity-catalog/schemas/test_catalog_renamed_a2iiyjqe35bajppmfmwfhxm54a.myschema2",
        LOG.destroy_requests:   "q": {
        LOG.destroy_requests:     "force": "true"
        LOG.destroy_requests:   }
... (8 more lines truncated, raise DATABRICKS_CLI_TEST_MAX_LOG to see more)
TestAccept/bundle/resources/secrets/parent_rename/DMS=/READPLAN=1: branch ✅ | main (9a14ad6) ❌ | latest (v1.28.0) ❌

main (9a14ad6):

acceptance_test.go:1402: Diff:
        --- bundle/resources/secrets/parent_rename/output.txt
        +++ /tmp/TestAcceptbundleresourcessecretsparent_renameDMS=READPLAN=975677000/002/output.txt
        @@ -111,7 +111,7 @@
                 "comment": "c1",
                 "name": "mysecret",
                 "schema_name": "myschema2",
        -        "value": "[redacted]"
        +        "value": "secret-value"
               }
             },
             "remote_state": {
        @@ -308,7 +308,7 @@
                 "comment": "c2",
                 "name": "mysecret",
                 "schema_name": "myschema2",
        -        "value": "[redacted]"
        +        "value": "secret-value"
               }
             },
             "remote_state": {
        
    acceptance_test.go:1180: 
        LOG.destroy_requests: {
        LOG.destroy_requests:   "method": "DELETE",
        LOG.destroy_requests:   "path": "/api/2.1/unity-catalog/secrets/test_catalog_renamed_hwfofumqorf5vl65hju5geywci.myschema2.mysecret"
        LOG.destroy_requests: }
        LOG.destroy_requests: {
        LOG.destroy_requests:   "method": "DELETE",
        LOG.destroy_requests:   "path": "/api/2.1/unity-catalog/schemas/test_catalog_renamed_hwfofumqorf5vl65hju5geywci.myschema2",
        LOG.destroy_requests:   "q": {
        LOG.destroy_requests:     "force": "true"
        LOG.destroy_requests:   }
        LOG.destroy_requests: }
        LOG.destroy_requests: {
        LOG.destroy_requests:   "method": "DELETE",
        LOG.destroy_requests:   "path": "/api/2.1/unity-catalog/catalogs/test_catalog_renamed_hwfofumqorf5vl65hju5geywci",
        LOG.destroy_requests:   "q": {
        LOG.destroy_requests:     "force": "true"
        LOG.destroy_requests:   }
        LOG.destroy_requests: }

latest (v1.28.0):

acceptance_test.go:1402: Diff:
        --- bundle/resources/secrets/parent_rename/output.txt
        +++ /tmp/TestAcceptbundleresourcessecretsparent_renameDMS=READPLAN=1130242730/002/output.txt
        @@ -93,6 +93,7 @@
             }
           },
           "resources.secrets.secret1": {
        +    "id": "test_catalog_[UNIQUE_NAME].myschema2.mysecret",
             "depends_on": [
               {
                 "node": "resources.catalogs.catalog1",
        @@ -103,15 +104,14 @@
                 "label": "${resources.schemas.schema1.name}"
               }
             ],
        -    "action": "update_id",
        -    "state_only": true,
        +    "action": "recreate",
             "new_state": {
               "value": {
                 "catalog_name": "test_catalog_[UNIQUE_NAME]",
                 "comment": "c1",
                 "name": "mysecret",
                 "schema_name": "myschema2",
        -        "value": "[redacted]"
        +        "value": "secret-value"
               }
             },
             "remote_state": {
        @@ -160,8 +154,8 @@
                 "remote": "[USERNAME]"
               },
               "schema_name": {
        -        "action": "update_id",
        -        "reason": "parent_renamed",
        +        "action": "recreate",
        +        "reason": "spec:immutable",
                 "old": "myschema",
                 "new": "myschema2",
                 "remote": "myschema"
        @@ -184,9 +178,10 @@
         
         >>> [CLI] bundle deploy
         Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle-[UNIQUE_NAME]/default/files...
        +Recreated secrets.secret1
         Updated schemas.schema1
         Files: 1 uploaded, 0 deleted
        -Resources: 0 created, 1 changed, 0 deleted, 2 unchanged
        +Resources: 1 created, 1 changed, 1 deleted, 1 unchanged
         
         >>> print_requests.py //unity-catalog
         {
        @@ -198,12 +191,27 @@
             "new_name": "myschema2"
           }
         }
        +{
        +  "method": "DELETE",
        +  "path": "/api/2.1/unity-catalog/secrets/test_catalog_[UNIQUE_NAME].myschema2.mysecret"
        +}
        +{
        +  "method": "POST",
        +  "path": "/api/2.1/unity-catalog/secrets",
        +  "body": {
        +    "catalog_name": "test_catalog_[UNIQUE_NAME]",
        +    "comment": "c1",
        +    "name": "mysecret",
        +    "schema_name": "myschema2",
        +    "value": "secret-value"
        +  }
        +}
         
         >>> [CLI] secrets-uc get-secret test_catalog_[UNIQUE_NAME].myschema2.mysecret
         {
           "full_name": "test_catalog_[UNIQUE_NAME].myschema2.mysecret",
           "comment": "c1",
        -  "create_time": "[SECRET_CREATE_TIME]"
        +  "create_time": "[TIMESTAMP]"
         }
         
         === Rename the catalog and change the secret's comment: the update reaches the secret at its new path
        @@ -291,6 +294,7 @@
             }
           },
           "resources.secrets.secret1": {
        +    "id": "test_catalog_renamed_[UNIQUE_NAME].myschema2.mysecret",
             "depends_on": [
               {
                 "node": "resources.catalogs.catalog1",
        @@ -301,20 +305,20 @@
                 "label": "${resources.schemas.schema1.name}"
               }
             ],
        -    "action": "update_id",
        +    "action": "recreate",
             "new_state": {
               "value": {
                 "catalog_name": "test_catalog_renamed_[UNIQUE_NAME]",
                 "comment": "c2",
                 "name": "mysecret",
                 "schema_name": "myschema2",
        -        "value": "[redacted]"
        +        "value": "secret-value"
               }
             },
             "remote_state": {
               "catalog_name": "test_catalog_[UNIQUE_NAME]",
               "comment": "c1",
        -      "create_time": "[SECRET_CREATE_TIME]",
        +      "create_time": "[TIMESTAMP]",
               "created_by": "[USERNAME]",
               "effective_owner": "[USERNAME]",
               "effective_value": "[redacted]",
        @@ -322,13 +315,13 @@
               "name": "mysecret",
               "owner": "[USERNAME]",
               "schema_name": "myschema2",
        -      "update_time": "[SECRET_CREATE_TIME]",
        +      "update_time": "[TIMESTAMP]",
               "value": "[redacted]"
             },
             "changes": {
               "catalog_name": {
        -        "action": "update_id",
        -        "reason": "parent_renamed",
        +        "action": "recreate",
        +        "reason": "spec:immutable",
                 "old": "test_catalog_[UNIQUE_NAME]",
                 "new": "test_catalog_renamed_[UNIQUE_NAME]",
                 "remote": "test_catalog_[UNIQUE_NAME]"
        @@ -342,7 +331,7 @@
               "create_time": {
                 "action": "skip",
                 "reason": "spec:output_only",
        -        "remote": "[SECRET_CREATE_TIME]"
        +        "remote": "[TIMESTAMP]"
               },
               "created_by": {
                 "action": "skip",
        @@ -372,7 +361,7 @@
               "update_time": {
                 "action": "skip",
                 "reason": "spec:output_only",
        -        "remote": "[SECRET_CREATE_TIME]"
        +        "remote": "[TIMESTAMP]"
               },
               "value": {
                 "action": "skip",
        @@ -387,10 +376,10 @@
         
         >>> [CLI] bundle deploy
         Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle-[UNIQUE_NAME]/default/files...
        +Recreated secrets.secret1
         Updated catalogs.catalog1
        -Updated secrets.secret1
         Files: 1 uploaded, 0 deleted
        -Resources: 0 created, 2 changed, 0 deleted, 1 unchanged
        +Resources: 1 created, 1 changed, 1 deleted, 1 unchanged
         
         >>> print_requests.py //unity-catalog
         {
        @@ -403,11 +390,12 @@
           }
         }
         {
        -  "method": "PATCH",
        -  "path": "/api/2.1/unity-catalog/secrets/test_catalog_renamed_[UNIQUE_NAME].myschema2.mysecret",
        -  "q": {
        -    "update_mask": "*"
        -  },
        +  "method": "DELETE",
        +  "path": "/api/2.1/unity-catalog/secrets/test_catalog_renamed_[UNIQUE_NAME].myschema2.mysecret"
        +}
        +{
        +  "method": "POST",
        +  "path": "/api/2.1/unity-catalog/secrets",
           "body": {
             "catalog_name": "test_catalog_renamed_[UNIQUE_NAME]",
             "comment": "c2",
        @@ -421,7 +409,7 @@
         {
           "full_name": "test_catalog_renamed_[UNIQUE_NAME].myschema2.mysecret",
           "comment": "c2",
        -  "create_time": "[SECRET_CREATE_TIME]"
        +  "create_time": "[TIMESTAMP]"
         }
         
         === The state tracks the new path and the plan is a no-op
        
    acceptance_test.go:1180: 
        LOG.destroy_requests: {
        LOG.destroy_requests:   "method": "DELETE",
        LOG.destroy_requests:   "path": "/api/2.1/unity-catalog/secrets/test_catalog_renamed_gjndtq3chnhlna7amoz54kyjyu.myschema2.mysecret"
        LOG.destroy_requests: }
        LOG.destroy_requests: {
        LOG.destroy_requests:   "method": "DELETE",
        LOG.destroy_requests:   "path": "/api/2.1/unity-catalog/schemas/test_catalog_renamed_gjndtq3chnhlna7amoz54kyjyu.myschema2",
        LOG.destroy_requests:   "q": {
        LOG.destroy_requests:     "force": "true"
        LOG.destroy_requests:   }
... (8 more lines truncated, raise DATABRICKS_CLI_TEST_MAX_LOG to see more)
TestAccept/bundle/resources/secrets/parent_rename/DMS=true/READPLAN=: branch ✅ | main (9a14ad6) ❌ | latest (v1.28.0) ❌

main (9a14ad6):

acceptance_test.go:1402: Diff:
        --- bundle/resources/secrets/parent_rename/output.txt
        +++ /tmp/TestAcceptbundleresourcessecretsparent_renameDMS=trueREADP481003924/002/output.txt
        @@ -111,7 +111,7 @@
                 "comment": "c1",
                 "name": "mysecret",
                 "schema_name": "myschema2",
        -        "value": "[redacted]"
        +        "value": "secret-value"
               }
             },
             "remote_state": {
        @@ -308,7 +308,7 @@
                 "comment": "c2",
                 "name": "mysecret",
                 "schema_name": "myschema2",
        -        "value": "[redacted]"
        +        "value": "secret-value"
               }
             },
             "remote_state": {
        
    acceptance_test.go:1180: 
        LOG.destroy_requests: {
        LOG.destroy_requests:   "method": "DELETE",
        LOG.destroy_requests:   "path": "/api/2.1/unity-catalog/secrets/test_catalog_renamed_cyhlal72q5a5dngkjkt34d37me.myschema2.mysecret"
        LOG.destroy_requests: }
        LOG.destroy_requests: {
        LOG.destroy_requests:   "method": "DELETE",
        LOG.destroy_requests:   "path": "/api/2.1/unity-catalog/schemas/test_catalog_renamed_cyhlal72q5a5dngkjkt34d37me.myschema2",
        LOG.destroy_requests:   "q": {
        LOG.destroy_requests:     "force": "true"
        LOG.destroy_requests:   }
        LOG.destroy_requests: }
        LOG.destroy_requests: {
        LOG.destroy_requests:   "method": "DELETE",
        LOG.destroy_requests:   "path": "/api/2.1/unity-catalog/catalogs/test_catalog_renamed_cyhlal72q5a5dngkjkt34d37me",
        LOG.destroy_requests:   "q": {
        LOG.destroy_requests:     "force": "true"
        LOG.destroy_requests:   }
        LOG.destroy_requests: }

latest (v1.28.0):

acceptance_test.go:1402: Diff:
        --- bundle/resources/secrets/parent_rename/output.txt
        +++ /tmp/TestAcceptbundleresourcessecretsparent_renameDMS=trueREADP3543407293/002/output.txt
        @@ -93,6 +93,7 @@
             }
           },
           "resources.secrets.secret1": {
        +    "id": "test_catalog_[UNIQUE_NAME].myschema2.mysecret",
             "depends_on": [
               {
                 "node": "resources.catalogs.catalog1",
        @@ -103,15 +104,14 @@
                 "label": "${resources.schemas.schema1.name}"
               }
             ],
        -    "action": "update_id",
        -    "state_only": true,
        +    "action": "recreate",
             "new_state": {
               "value": {
                 "catalog_name": "test_catalog_[UNIQUE_NAME]",
                 "comment": "c1",
                 "name": "mysecret",
                 "schema_name": "myschema2",
        -        "value": "[redacted]"
        +        "value": "secret-value"
               }
             },
             "remote_state": {
        @@ -160,8 +154,8 @@
                 "remote": "[USERNAME]"
               },
               "schema_name": {
        -        "action": "update_id",
        -        "reason": "parent_renamed",
        +        "action": "recreate",
        +        "reason": "spec:immutable",
                 "old": "myschema",
                 "new": "myschema2",
                 "remote": "myschema"
        @@ -184,9 +178,10 @@
         
         >>> [CLI] bundle deploy
         Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle-[UNIQUE_NAME]/default/files...
        +Recreated secrets.secret1
         Updated schemas.schema1
         Files: 1 uploaded, 0 deleted
        -Resources: 0 created, 1 changed, 0 deleted, 2 unchanged
        +Resources: 1 created, 1 changed, 1 deleted, 1 unchanged
         
         >>> print_requests.py //unity-catalog
         {
        @@ -198,12 +191,27 @@
             "new_name": "myschema2"
           }
         }
        +{
        +  "method": "DELETE",
        +  "path": "/api/2.1/unity-catalog/secrets/test_catalog_[UNIQUE_NAME].myschema2.mysecret"
        +}
        +{
        +  "method": "POST",
        +  "path": "/api/2.1/unity-catalog/secrets",
        +  "body": {
        +    "catalog_name": "test_catalog_[UNIQUE_NAME]",
        +    "comment": "c1",
        +    "name": "mysecret",
        +    "schema_name": "myschema2",
        +    "value": "secret-value"
        +  }
        +}
         
         >>> [CLI] secrets-uc get-secret test_catalog_[UNIQUE_NAME].myschema2.mysecret
         {
           "full_name": "test_catalog_[UNIQUE_NAME].myschema2.mysecret",
           "comment": "c1",
        -  "create_time": "[SECRET_CREATE_TIME]"
        +  "create_time": "[TIMESTAMP]"
         }
         
         === Rename the catalog and change the secret's comment: the update reaches the secret at its new path
        @@ -291,6 +294,7 @@
             }
           },
           "resources.secrets.secret1": {
        +    "id": "test_catalog_renamed_[UNIQUE_NAME].myschema2.mysecret",
             "depends_on": [
               {
                 "node": "resources.catalogs.catalog1",
        @@ -301,20 +305,20 @@
                 "label": "${resources.schemas.schema1.name}"
               }
             ],
        -    "action": "update_id",
        +    "action": "recreate",
             "new_state": {
               "value": {
                 "catalog_name": "test_catalog_renamed_[UNIQUE_NAME]",
                 "comment": "c2",
                 "name": "mysecret",
                 "schema_name": "myschema2",
        -        "value": "[redacted]"
        +        "value": "secret-value"
               }
             },
             "remote_state": {
               "catalog_name": "test_catalog_[UNIQUE_NAME]",
               "comment": "c1",
        -      "create_time": "[SECRET_CREATE_TIME]",
        +      "create_time": "[TIMESTAMP]",
               "created_by": "[USERNAME]",
               "effective_owner": "[USERNAME]",
               "effective_value": "[redacted]",
        @@ -322,13 +315,13 @@
               "name": "mysecret",
               "owner": "[USERNAME]",
               "schema_name": "myschema2",
        -      "update_time": "[SECRET_CREATE_TIME]",
        +      "update_time": "[TIMESTAMP]",
               "value": "[redacted]"
             },
             "changes": {
               "catalog_name": {
        -        "action": "update_id",
        -        "reason": "parent_renamed",
        +        "action": "recreate",
        +        "reason": "spec:immutable",
                 "old": "test_catalog_[UNIQUE_NAME]",
                 "new": "test_catalog_renamed_[UNIQUE_NAME]",
                 "remote": "test_catalog_[UNIQUE_NAME]"
        @@ -342,7 +331,7 @@
               "create_time": {
                 "action": "skip",
                 "reason": "spec:output_only",
        -        "remote": "[SECRET_CREATE_TIME]"
        +        "remote": "[TIMESTAMP]"
               },
               "created_by": {
                 "action": "skip",
        @@ -372,7 +361,7 @@
               "update_time": {
                 "action": "skip",
                 "reason": "spec:output_only",
        -        "remote": "[SECRET_CREATE_TIME]"
        +        "remote": "[TIMESTAMP]"
               },
               "value": {
                 "action": "skip",
        @@ -387,10 +376,10 @@
         
         >>> [CLI] bundle deploy
         Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle-[UNIQUE_NAME]/default/files...
        +Recreated secrets.secret1
         Updated catalogs.catalog1
        -Updated secrets.secret1
         Files: 1 uploaded, 0 deleted
        -Resources: 0 created, 2 changed, 0 deleted, 1 unchanged
        +Resources: 1 created, 1 changed, 1 deleted, 1 unchanged
         
         >>> print_requests.py //unity-catalog
         {
        @@ -403,11 +390,12 @@
           }
         }
         {
        -  "method": "PATCH",
        -  "path": "/api/2.1/unity-catalog/secrets/test_catalog_renamed_[UNIQUE_NAME].myschema2.mysecret",
        -  "q": {
        -    "update_mask": "*"
        -  },
        +  "method": "DELETE",
        +  "path": "/api/2.1/unity-catalog/secrets/test_catalog_renamed_[UNIQUE_NAME].myschema2.mysecret"
        +}
        +{
        +  "method": "POST",
        +  "path": "/api/2.1/unity-catalog/secrets",
           "body": {
             "catalog_name": "test_catalog_renamed_[UNIQUE_NAME]",
             "comment": "c2",
        @@ -421,7 +409,7 @@
         {
           "full_name": "test_catalog_renamed_[UNIQUE_NAME].myschema2.mysecret",
           "comment": "c2",
        -  "create_time": "[SECRET_CREATE_TIME]"
        +  "create_time": "[TIMESTAMP]"
         }
         
         === The state tracks the new path and the plan is a no-op
        
    acceptance_test.go:1180: 
        LOG.destroy_requests: {
        LOG.destroy_requests:   "method": "DELETE",
        LOG.destroy_requests:   "path": "/api/2.1/unity-catalog/secrets/test_catalog_renamed_7m27x4s4dnfhbjiliejx6n5agq.myschema2.mysecret"
        LOG.destroy_requests: }
        LOG.destroy_requests: {
        LOG.destroy_requests:   "method": "DELETE",
        LOG.destroy_requests:   "path": "/api/2.1/unity-catalog/schemas/test_catalog_renamed_7m27x4s4dnfhbjiliejx6n5agq.myschema2",
        LOG.destroy_requests:   "q": {
        LOG.destroy_requests:     "force": "true"
        LOG.destroy_requests:   }
... (8 more lines truncated, raise DATABRICKS_CLI_TEST_MAX_LOG to see more)
TestAccept/bundle/resources/secrets/parent_rename/DMS=true/READPLAN=1: branch ✅ | main (9a14ad6) ❌ | latest (v1.28.0) ❌

main (9a14ad6):

acceptance_test.go:1402: Diff:
        --- bundle/resources/secrets/parent_rename/output.txt
        +++ /tmp/TestAcceptbundleresourcessecretsparent_renameDMS=trueREADP218328130/002/output.txt
        @@ -111,7 +111,7 @@
                 "comment": "c1",
                 "name": "mysecret",
                 "schema_name": "myschema2",
        -        "value": "[redacted]"
        +        "value": "secret-value"
               }
             },
             "remote_state": {
        @@ -308,7 +308,7 @@
                 "comment": "c2",
                 "name": "mysecret",
                 "schema_name": "myschema2",
        -        "value": "[redacted]"
        +        "value": "secret-value"
               }
             },
             "remote_state": {
        
    acceptance_test.go:1180: 
        LOG.destroy_requests: {
        LOG.destroy_requests:   "method": "DELETE",
        LOG.destroy_requests:   "path": "/api/2.1/unity-catalog/secrets/test_catalog_renamed_4z6wdw6rf5eapkwcewp4d7nk5u.myschema2.mysecret"
        LOG.destroy_requests: }
        LOG.destroy_requests: {
        LOG.destroy_requests:   "method": "DELETE",
        LOG.destroy_requests:   "path": "/api/2.1/unity-catalog/schemas/test_catalog_renamed_4z6wdw6rf5eapkwcewp4d7nk5u.myschema2",
        LOG.destroy_requests:   "q": {
        LOG.destroy_requests:     "force": "true"
        LOG.destroy_requests:   }
        LOG.destroy_requests: }
        LOG.destroy_requests: {
        LOG.destroy_requests:   "method": "DELETE",
        LOG.destroy_requests:   "path": "/api/2.1/unity-catalog/catalogs/test_catalog_renamed_4z6wdw6rf5eapkwcewp4d7nk5u",
        LOG.destroy_requests:   "q": {
        LOG.destroy_requests:     "force": "true"
        LOG.destroy_requests:   }
        LOG.destroy_requests: }

latest (v1.28.0):

acceptance_test.go:1402: Diff:
        --- bundle/resources/secrets/parent_rename/output.txt
        +++ /tmp/TestAcceptbundleresourcessecretsparent_renameDMS=trueREADP638987178/002/output.txt
        @@ -93,6 +93,7 @@
             }
           },
           "resources.secrets.secret1": {
        +    "id": "test_catalog_[UNIQUE_NAME].myschema2.mysecret",
             "depends_on": [
               {
                 "node": "resources.catalogs.catalog1",
        @@ -103,15 +104,14 @@
                 "label": "${resources.schemas.schema1.name}"
               }
             ],
        -    "action": "update_id",
        -    "state_only": true,
        +    "action": "recreate",
             "new_state": {
               "value": {
                 "catalog_name": "test_catalog_[UNIQUE_NAME]",
                 "comment": "c1",
                 "name": "mysecret",
                 "schema_name": "myschema2",
        -        "value": "[redacted]"
        +        "value": "secret-value"
               }
             },
             "remote_state": {
        @@ -160,8 +154,8 @@
                 "remote": "[USERNAME]"
               },
               "schema_name": {
        -        "action": "update_id",
        -        "reason": "parent_renamed",
        +        "action": "recreate",
        +        "reason": "spec:immutable",
                 "old": "myschema",
                 "new": "myschema2",
                 "remote": "myschema"
        @@ -184,9 +178,10 @@
         
         >>> [CLI] bundle deploy
         Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle-[UNIQUE_NAME]/default/files...
        +Recreated secrets.secret1
         Updated schemas.schema1
         Files: 1 uploaded, 0 deleted
        -Resources: 0 created, 1 changed, 0 deleted, 2 unchanged
        +Resources: 1 created, 1 changed, 1 deleted, 1 unchanged
         
         >>> print_requests.py //unity-catalog
         {
        @@ -198,12 +191,27 @@
             "new_name": "myschema2"
           }
         }
        +{
        +  "method": "DELETE",
        +  "path": "/api/2.1/unity-catalog/secrets/test_catalog_[UNIQUE_NAME].myschema2.mysecret"
        +}
        +{
        +  "method": "POST",
        +  "path": "/api/2.1/unity-catalog/secrets",
        +  "body": {
        +    "catalog_name": "test_catalog_[UNIQUE_NAME]",
        +    "comment": "c1",
        +    "name": "mysecret",
        +    "schema_name": "myschema2",
        +    "value": "secret-value"
        +  }
        +}
         
         >>> [CLI] secrets-uc get-secret test_catalog_[UNIQUE_NAME].myschema2.mysecret
         {
           "full_name": "test_catalog_[UNIQUE_NAME].myschema2.mysecret",
           "comment": "c1",
        -  "create_time": "[SECRET_CREATE_TIME]"
        +  "create_time": "[TIMESTAMP]"
         }
         
         === Rename the catalog and change the secret's comment: the update reaches the secret at its new path
        @@ -291,6 +294,7 @@
             }
           },
           "resources.secrets.secret1": {
        +    "id": "test_catalog_renamed_[UNIQUE_NAME].myschema2.mysecret",
             "depends_on": [
               {
                 "node": "resources.catalogs.catalog1",
        @@ -301,20 +305,20 @@
                 "label": "${resources.schemas.schema1.name}"
               }
             ],
        -    "action": "update_id",
        +    "action": "recreate",
             "new_state": {
               "value": {
                 "catalog_name": "test_catalog_renamed_[UNIQUE_NAME]",
                 "comment": "c2",
                 "name": "mysecret",
                 "schema_name": "myschema2",
        -        "value": "[redacted]"
        +        "value": "secret-value"
               }
             },
             "remote_state": {
               "catalog_name": "test_catalog_[UNIQUE_NAME]",
               "comment": "c1",
        -      "create_time": "[SECRET_CREATE_TIME]",
        +      "create_time": "[TIMESTAMP]",
               "created_by": "[USERNAME]",
               "effective_owner": "[USERNAME]",
               "effective_value": "[redacted]",
        @@ -322,13 +315,13 @@
               "name": "mysecret",
               "owner": "[USERNAME]",
               "schema_name": "myschema2",
        -      "update_time": "[SECRET_CREATE_TIME]",
        +      "update_time": "[TIMESTAMP]",
               "value": "[redacted]"
             },
             "changes": {
               "catalog_name": {
        -        "action": "update_id",
        -        "reason": "parent_renamed",
        +        "action": "recreate",
        +        "reason": "spec:immutable",
                 "old": "test_catalog_[UNIQUE_NAME]",
                 "new": "test_catalog_renamed_[UNIQUE_NAME]",
                 "remote": "test_catalog_[UNIQUE_NAME]"
        @@ -342,7 +331,7 @@
               "create_time": {
                 "action": "skip",
                 "reason": "spec:output_only",
        -        "remote": "[SECRET_CREATE_TIME]"
        +        "remote": "[TIMESTAMP]"
               },
               "created_by": {
                 "action": "skip",
        @@ -372,7 +361,7 @@
               "update_time": {
                 "action": "skip",
                 "reason": "spec:output_only",
        -        "remote": "[SECRET_CREATE_TIME]"
        +        "remote": "[TIMESTAMP]"
               },
               "value": {
                 "action": "skip",
        @@ -387,10 +376,10 @@
         
         >>> [CLI] bundle deploy
         Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle-[UNIQUE_NAME]/default/files...
        +Recreated secrets.secret1
         Updated catalogs.catalog1
        -Updated secrets.secret1
         Files: 1 uploaded, 0 deleted
        -Resources: 0 created, 2 changed, 0 deleted, 1 unchanged
        +Resources: 1 created, 1 changed, 1 deleted, 1 unchanged
         
         >>> print_requests.py //unity-catalog
         {
        @@ -403,11 +390,12 @@
           }
         }
         {
        -  "method": "PATCH",
        -  "path": "/api/2.1/unity-catalog/secrets/test_catalog_renamed_[UNIQUE_NAME].myschema2.mysecret",
        -  "q": {
        -    "update_mask": "*"
        -  },
        +  "method": "DELETE",
        +  "path": "/api/2.1/unity-catalog/secrets/test_catalog_renamed_[UNIQUE_NAME].myschema2.mysecret"
        +}
        +{
        +  "method": "POST",
        +  "path": "/api/2.1/unity-catalog/secrets",
           "body": {
             "catalog_name": "test_catalog_renamed_[UNIQUE_NAME]",
             "comment": "c2",
        @@ -421,7 +409,7 @@
         {
           "full_name": "test_catalog_renamed_[UNIQUE_NAME].myschema2.mysecret",
           "comment": "c2",
        -  "create_time": "[SECRET_CREATE_TIME]"
        +  "create_time": "[TIMESTAMP]"
         }
         
         === The state tracks the new path and the plan is a no-op
        
    acceptance_test.go:1180: 
        LOG.destroy_requests: {
        LOG.destroy_requests:   "method": "DELETE",
        LOG.destroy_requests:   "path": "/api/2.1/unity-catalog/secrets/test_catalog_renamed_iy4owvfjtjdmjcrzsf66rufwpi.myschema2.mysecret"
        LOG.destroy_requests: }
        LOG.destroy_requests: {
        LOG.destroy_requests:   "method": "DELETE",
        LOG.destroy_requests:   "path": "/api/2.1/unity-catalog/schemas/test_catalog_renamed_iy4owvfjtjdmjcrzsf66rufwpi.myschema2",
        LOG.destroy_requests:   "q": {
        LOG.destroy_requests:     "force": "true"
        LOG.destroy_requests:   }
... (8 more lines truncated, raise DATABRICKS_CLI_TEST_MAX_LOG to see more)
TestAccept/bundle/resources/secrets/recreate_in_renamed_schema/DMS=/READPLAN=: branch ✅ | main (9a14ad6) ❌ | latest (v1.28.0) ❌

main (9a14ad6):

acceptance_test.go:1402: Diff:
        --- bundle/resources/secrets/recreate_in_renamed_schema/output.txt
        +++ /tmp/TestAcceptbundleresourcessecretsrecreate_in_renamed_schemaD2101456169/002/output.txt
        @@ -84,7 +84,7 @@
                 "catalog_name": "test_catalog_[UNIQUE_NAME]",
                 "name": "mysecret2",
                 "schema_name": "myschema2",
        -        "value": "[redacted]"
        +        "value": "secret-value"
               }
             },
             "remote_state": {
        
    acceptance_test.go:1180: 
        LOG.deploy_requests: {
        LOG.deploy_requests:   "method": "POST",
        LOG.deploy_requests:   "path": "/api/2.1/unity-catalog/catalogs",
        LOG.deploy_requests:   "body": {
        LOG.deploy_requests:     "name": "test_catalog_jk4wp5m6mzasdfp6owshq4r7ui"
        LOG.deploy_requests:   }
        LOG.deploy_requests: }
        LOG.deploy_requests: {
        LOG.deploy_requests:   "method": "POST",
        LOG.deploy_requests:   "path": "/api/2.1/unity-catalog/schemas",
        LOG.deploy_requests:   "body": {
        LOG.deploy_requests:     "catalog_name": "test_catalog_jk4wp5m6mzasdfp6owshq4r7ui",
        LOG.deploy_requests:     "name": "myschema"
        LOG.deploy_requests:   }
        LOG.deploy_requests: }
        LOG.deploy_requests: {
        LOG.deploy_requests:   "method": "POST",
        LOG.deploy_requests:   "path": "/api/2.1/unity-catalog/secrets",
        LOG.deploy_requests:   "body": {
        LOG.deploy_requests:     "catalog_name": "test_catalog_jk4wp5m6mzasdfp6owshq4r7ui",
        LOG.deploy_requests:     "name": "mysecret",
        LOG.deploy_requests:     "schema_name": "myschema",
        LOG.deploy_requests:     "value": "secret-value"
        LOG.deploy_requests:   }
        LOG.deploy_requests: }
    acceptance_test.go:1180: 
        LOG.destroy_requests: {
        LOG.destroy_requests:   "method": "DELETE",
        LOG.destroy_requests:   "path": "/api/2.1/unity-catalog/secrets/test_catalog_jk4wp5m6mzasdfp6owshq4r7ui.myschema2.mysecret2"
        LOG.destroy_requests: }
        LOG.destroy_requests: {
        LOG.destroy_requests:   "method": "DELETE",
        LOG.destroy_requests:   "path": "/api/2.1/unity-catalog/schemas/test_catalog_jk4wp5m6mzasdfp6owshq4r7ui.myschema2",
        LOG.destroy_requests:   "q": {
        LOG.destroy_requests:     "force": "true"
        LOG.destroy_requests:   }
        LOG.destroy_requests: }
        LOG.destroy_requests: {
        LOG.destroy_requests:   "method": "DELETE",
        LOG.destroy_requests:   "path": "/api/2.1/unity-catalog/catalogs/test_catalog_jk4wp5m6mzasdfp6owshq4r7ui",
        LOG.destroy_requests:   "q": {
        LOG.destroy_requests:     "force": "true"
        LOG.destroy_requests:   }
        LOG.destroy_requests: }

latest (v1.28.0):

acceptance_test.go:1402: Diff:
        --- bundle/resources/secrets/recreate_in_renamed_schema/output.txt
        +++ /tmp/TestAcceptbundleresourcessecretsrecreate_in_renamed_schemaD3028281407/002/output.txt
        @@ -84,7 +84,7 @@
                 "catalog_name": "test_catalog_[UNIQUE_NAME]",
                 "name": "mysecret2",
                 "schema_name": "myschema2",
        -        "value": "[redacted]"
        +        "value": "secret-value"
               }
             },
             "remote_state": {
        @@ -128,7 +128,7 @@
               },
               "name": {
                 "action": "recreate",
        -        "reason": "id_field",
        +        "reason": "spec:immutable",
                 "old": "mysecret",
                 "new": "mysecret2",
                 "remote": "mysecret"
        @@ -139,8 +139,8 @@
                 "remote": "[USERNAME]"
               },
               "schema_name": {
        -        "action": "update_id",
        -        "reason": "parent_renamed",
        +        "action": "recreate",
        +        "reason": "spec:immutable",
                 "old": "myschema",
                 "new": "myschema2",
                 "remote": "myschema"
        
    acceptance_test.go:1180: 
        LOG.deploy_requests: {
        LOG.deploy_requests:   "method": "POST",
        LOG.deploy_requests:   "path": "/api/2.1/unity-catalog/catalogs",
        LOG.deploy_requests:   "body": {
        LOG.deploy_requests:     "name": "test_catalog_jtgaxzvjkvcwxhtfirpwut3hgm"
        LOG.deploy_requests:   }
        LOG.deploy_requests: }
        LOG.deploy_requests: {
        LOG.deploy_requests:   "method": "POST",
        LOG.deploy_requests:   "path": "/api/2.1/unity-catalog/schemas",
        LOG.deploy_requests:   "body": {
        LOG.deploy_requests:     "catalog_name": "test_catalog_jtgaxzvjkvcwxhtfirpwut3hgm",
        LOG.deploy_requests:     "name": "myschema"
        LOG.deploy_requests:   }
        LOG.deploy_requests: }
        LOG.deploy_requests: {
        LOG.deploy_requests:   "method": "POST",
        LOG.deploy_requests:   "path": "/api/2.1/unity-catalog/secrets",
        LOG.deploy_requests:   "body": {
        LOG.deploy_requests:     "catalog_name": "test_catalog_jtgaxzvjkvcwxhtfirpwut3hgm",
        LOG.deploy_requests:     "name": "mysecret",
        LOG.deploy_requests:     "schema_name": "myschema",
        LOG.deploy_requests:     "value": "secret-value"
        LOG.deploy_requests:   }
        LOG.deploy_requests: }
    acceptance_test.go:1180: 
        LOG.destroy_requests: {
        LOG.destroy_requests:   "method": "DELETE",
        LOG.destroy_requests:   "path": "/api/2.1/unity-catalog/secrets/test_catalog_jtgaxzvjkvcwxhtfirpwut3hgm.myschema2.mysecret2"
        LOG.destroy_requests: }
        LOG.destroy_requests: {
        LOG.destroy_requests:   "method": "DELETE",
        LOG.destroy_requests:   "path": "/api/2.1/unity-catalog/schemas/test_catalog_jtgaxzvjkvcwxhtfirpwut3hgm.myschema2",
        LOG.destroy_requests:   "q": {
        LOG.destroy_requests:     "force": "true"
        LOG.destroy_requests:   }
        LOG.destroy_requests: }
        LOG.destroy_requests: {
        LOG.destroy_requests:   "method": "DELETE",
        LOG.destroy_requests:   "path": "/api/2.1/unity-catalog/catalogs/test_catalog_jtgaxzvjkvcwxhtfirpwut3hgm",
        LOG.destroy_requests:   "q": {
        LOG.destroy_requests:     "force": "true"
        LOG.destroy_requests:   }
        LOG.destroy_requests: }
TestAccept/bundle/resources/secrets/recreate_in_renamed_schema/DMS=/READPLAN=1: branch ✅ | main (9a14ad6) ❌ | latest (v1.28.0) ❌

main (9a14ad6):

acceptance_test.go:1402: Diff:
        --- bundle/resources/secrets/recreate_in_renamed_schema/output.txt
        +++ /tmp/TestAcceptbundleresourcessecretsrecreate_in_renamed_schemaD3988112763/002/output.txt
        @@ -84,7 +84,7 @@
                 "catalog_name": "test_catalog_[UNIQUE_NAME]",
                 "name": "mysecret2",
                 "schema_name": "myschema2",
        -        "value": "[redacted]"
        +        "value": "secret-value"
               }
             },
             "remote_state": {
        
    acceptance_test.go:1180: 
        LOG.deploy_requests: {
        LOG.deploy_requests:   "method": "POST",
        LOG.deploy_requests:   "path": "/api/2.1/unity-catalog/catalogs",
        LOG.deploy_requests:   "body": {
        LOG.deploy_requests:     "name": "test_catalog_s3enrtcic5fahnsmc54qlihn5q"
        LOG.deploy_requests:   }
        LOG.deploy_requests: }
        LOG.deploy_requests: {
        LOG.deploy_requests:   "method": "POST",
        LOG.deploy_requests:   "path": "/api/2.1/unity-catalog/schemas",
        LOG.deploy_requests:   "body": {
        LOG.deploy_requests:     "catalog_name": "test_catalog_s3enrtcic5fahnsmc54qlihn5q",
        LOG.deploy_requests:     "name": "myschema"
        LOG.deploy_requests:   }
        LOG.deploy_requests: }
        LOG.deploy_requests: {
        LOG.deploy_requests:   "method": "POST",
        LOG.deploy_requests:   "path": "/api/2.1/unity-catalog/secrets",
        LOG.deploy_requests:   "body": {
        LOG.deploy_requests:     "catalog_name": "test_catalog_s3enrtcic5fahnsmc54qlihn5q",
        LOG.deploy_requests:     "name": "mysecret",
        LOG.deploy_requests:     "schema_name": "myschema",
        LOG.deploy_requests:     "value": "secret-value"
        LOG.deploy_requests:   }
        LOG.deploy_requests: }
    acceptance_test.go:1180: 
        LOG.destroy_requests: {
        LOG.destroy_requests:   "method": "DELETE",
        LOG.destroy_requests:   "path": "/api/2.1/unity-catalog/secrets/test_catalog_s3enrtcic5fahnsmc54qlihn5q.myschema2.mysecret2"
        LOG.destroy_requests: }
        LOG.destroy_requests: {
        LOG.destroy_requests:   "method": "DELETE",
        LOG.destroy_requests:   "path": "/api/2.1/unity-catalog/schemas/test_catalog_s3enrtcic5fahnsmc54qlihn5q.myschema2",
        LOG.destroy_requests:   "q": {
        LOG.destroy_requests:     "force": "true"
        LOG.destroy_requests:   }
        LOG.destroy_requests: }
        LOG.destroy_requests: {
        LOG.destroy_requests:   "method": "DELETE",
        LOG.destroy_requests:   "path": "/api/2.1/unity-catalog/catalogs/test_catalog_s3enrtcic5fahnsmc54qlihn5q",
        LOG.destroy_requests:   "q": {
        LOG.destroy_requests:     "force": "true"
        LOG.destroy_requests:   }
        LOG.destroy_requests: }

latest (v1.28.0):

acceptance_test.go:1402: Diff:
        --- bundle/resources/secrets/recreate_in_renamed_schema/output.txt
        +++ /tmp/TestAcceptbundleresourcessecretsrecreate_in_renamed_schemaD4229527920/002/output.txt
        @@ -84,7 +84,7 @@
                 "catalog_name": "test_catalog_[UNIQUE_NAME]",
                 "name": "mysecret2",
                 "schema_name": "myschema2",
        -        "value": "[redacted]"
        +        "value": "secret-value"
               }
             },
             "remote_state": {
        @@ -128,7 +128,7 @@
               },
               "name": {
                 "action": "recreate",
        -        "reason": "id_field",
        +        "reason": "spec:immutable",
                 "old": "mysecret",
                 "new": "mysecret2",
                 "remote": "mysecret"
        @@ -139,8 +139,8 @@
                 "remote": "[USERNAME]"
               },
               "schema_name": {
        -        "action": "update_id",
        -        "reason": "parent_renamed",
        +        "action": "recreate",
        +        "reason": "spec:immutable",
                 "old": "myschema",
                 "new": "myschema2",
                 "remote": "myschema"
        
    acceptance_test.go:1180: 
        LOG.deploy_requests: {
        LOG.deploy_requests:   "method": "POST",
        LOG.deploy_requests:   "path": "/api/2.1/unity-catalog/catalogs",
        LOG.deploy_requests:   "body": {
        LOG.deploy_requests:     "name": "test_catalog_lytsmdeibncmhfhuacwqwbbe5a"
        LOG.deploy_requests:   }
        LOG.deploy_requests: }
        LOG.deploy_requests: {
        LOG.deploy_requests:   "method": "POST",
        LOG.deploy_requests:   "path": "/api/2.1/unity-catalog/schemas",
        LOG.deploy_requests:   "body": {
        LOG.deploy_requests:     "catalog_name": "test_catalog_lytsmdeibncmhfhuacwqwbbe5a",
        LOG.deploy_requests:     "name": "myschema"
        LOG.deploy_requests:   }
        LOG.deploy_requests: }
        LOG.deploy_requests: {
        LOG.deploy_requests:   "method": "POST",
        LOG.deploy_requests:   "path": "/api/2.1/unity-catalog/secrets",
        LOG.deploy_requests:   "body": {
        LOG.deploy_requests:     "catalog_name": "test_catalog_lytsmdeibncmhfhuacwqwbbe5a",
        LOG.deploy_requests:     "name": "mysecret",
        LOG.deploy_requests:     "schema_name": "myschema",
        LOG.deploy_requests:     "value": "secret-value"
        LOG.deploy_requests:   }
        LOG.deploy_requests: }
    acceptance_test.go:1180: 
        LOG.destroy_requests: {
        LOG.destroy_requests:   "method": "DELETE",
        LOG.destroy_requests:   "path": "/api/2.1/unity-catalog/secrets/test_catalog_lytsmdeibncmhfhuacwqwbbe5a.myschema2.mysecret2"
        LOG.destroy_requests: }
        LOG.destroy_requests: {
        LOG.destroy_requests:   "method": "DELETE",
        LOG.destroy_requests:   "path": "/api/2.1/unity-catalog/schemas/test_catalog_lytsmdeibncmhfhuacwqwbbe5a.myschema2",
        LOG.destroy_requests:   "q": {
        LOG.destroy_requests:     "force": "true"
        LOG.destroy_requests:   }
        LOG.destroy_requests: }
        LOG.destroy_requests: {
        LOG.destroy_requests:   "method": "DELETE",
        LOG.destroy_requests:   "path": "/api/2.1/unity-catalog/catalogs/test_catalog_lytsmdeibncmhfhuacwqwbbe5a",
        LOG.destroy_requests:   "q": {
        LOG.destroy_requests:     "force": "true"
        LOG.destroy_requests:   }
        LOG.destroy_requests: }

8 more failure details omitted, see the full report in the run.

andrewnester and others added 2 commits November 17, 2026 10:02
Co-authored-by: Isaac <no-reply@databricks.com>
The acceptance test checks that the literals stay out of plan output,
the saved plan and local state, that a saved plan needs the values
passed again, that an empty value fails before any state-changing
request, and that a rotated value reaches only the PATCH request.

Co-authored-by: Isaac <no-reply@databricks.com>
@andrewnester
andrewnester force-pushed the feat/plan-secret-redaction branch from 614d281 to 2212f0c Compare November 17, 2026 10:04
@eng-dev-ecosystem-bot

eng-dev-ecosystem-bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Collaborator

✅ Integration test report

Commit: 880e130

Run: 46391986706

Env 💚​RECOVERED ✅​pass 🙈​skip Time
💚​ aws linux-2core-8gb 1 183 22 2:48
💚​ aws-windows-latest-4core-16gb 1 183 22 4:16
💚​ azure linux-2core-8gb 1 182 22 3:01
💚​ azure-windows-latest-4core-16gb 1 182 22 4:13
💚​ gcp linux-2core-8gb 1 183 22 3:07
💚​ gcp-windows-latest-4core-16gb 1 183 22 4:09
Test Name aws linux-2core-8gb aws-windows-latest-4core-16gb azure linux-2core-8gb azure-windows-latest-4core-16gb gcp linux-2core-8gb gcp-windows-latest-4core-16gb
💚​ TestAccept 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
Top 3 slowest tests (at least 2 minutes):
duration env testname
3:14 aws-windows-latest-4core-16gb TestAccept
3:07 azure-windows-latest-4core-16gb TestAccept
3:06 gcp-windows-latest-4core-16gb TestAccept

@andrewnester

Copy link
Copy Markdown
Contributor Author

/review

@denik denik left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Design: the deploy value isn't tied to the plan value. deploy --plan now sends whatever value is supplied at deploy time, so it can differ from the planned one. For example, a plan updates a secret's comment, and at deploy time BUNDLE_VAR_x holds a different (wrong) value. The PATCH then sends a value nobody reviewed in the plan, and nothing warns. Would a salted fingerprint of each sensitive field in the plan work, with a check at deploy time that the supplied value matches and an error if not? That would keep "the saved plan is what gets applied" true. At minimum, the changelog should say this more strongly.

Comment thread bundle/direct/bundle_plan.go Resolved
Comment thread bundle/direct/bundle_plan.go Resolved
Comment thread bundle/direct/bundle_plan.go Resolved
Comment thread bundle/direct/bundle_plan.go Resolved
Comment thread bundle/direct/redact.go
return nil
}

if entry.NewState != nil {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rule "the plan must not be serialized after this" is only stated in the comment, and nothing enforces it. If someone later re-serializes new_state from the cache after this point, the secrets leak silently. Could we assert it, or add a test that fails if new_state is non-redacted at output time?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not asserted in code, because makePlan has no unit-test harness in this package. The check is at output time instead: the variables/sensitive/plan acceptance case pipes bundle plan -o json and the saved plan file through a check that fails the test if a secret literal appears in them. A change that re-serializes unredacted new_state before output fails there. I can add a unit test on the serialized plan if you want one at that level.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Supporting detail: this already happens in memory. Apply's resolveReferences(..., false) (bundle_apply.go:142 → bundle_plan.go:1604) calls sv.SyncToJSON(entry.NewState) from the unredacted cache. So after a deploy, the entries of a secret with a reference carry the plaintext again. Today nothing serializes the plan after apply (the only marshal is cmd/bundle/plan.go:112), and apply reads only the cache. Skipping that SyncToJSON when !isPreDeploy would remove the hazard instead of documenting it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 4340263. Resolving references now writes new_state back to the plan only before deploy. After apply the redacted entries are not re-serialized, so no plaintext is written back into them. The unit test TestResolveReferencesAfterApplyKeepsRedactedEntry fails when that write is restored.

Comment thread bundle/direct/bundle_plan.go Resolved
andrewnester and others added 2 commits November 20, 2026 13:33
deploy --plan rejected every sensitive variable that had no --var or
BUNDLE_VAR_ value, including variables a resource never uses and
variables set by a default, a target or the variable-overrides file.
The check now looks only at the resolved config value of each sensitive
field the plan sets, so every source of a value counts the same, and
the variable-overrides file is no longer a special case.

The check reports one error per problem, and it reads the adapter only
for resource types with sensitive fields. The acceptance case
variables/sensitive/plan-derived covers unused derived, literal-default
and target-set sensitive variables.

Co-authored-by: Isaac <no-reply@databricks.com>
@andrewnester

Copy link
Copy Markdown
Contributor Author

Thanks for the review. The changes for the other comments are in fcecb40.

On the design point (the deploy-time value is not tied to the plan-time value): this PR does not add a fingerprint. A fingerprint would change the saved plan format and store secret-derived data in the plan file, so it needs its own decision. Meanwhile the changelog and PR description now say explicitly that deploy --plan applies the sensitive values supplied at deploy time and does not compare them with the values used at plan time.

@andrewnester

Copy link
Copy Markdown
Contributor Author

Follow-up on the design point: the deploy-time value stays as documented in this PR (the plan format does not change). If a fingerprint check is wanted later, it can come as a separate PR with a plan-format version bump.

@andrewnester
andrewnester requested a review from denik November 20, 2026 14:16
Comment thread .nextchanges/bundles/7713.md Outdated
@@ -0,0 +1 @@
* `bundle plan` no longer shows or saves sensitive variable values, and `bundle deploy --plan` requires them to be supplied again at deploy time (for example with `--var` or `BUNDLE_VAR_<name>`). `deploy --plan` applies the sensitive values supplied at deploy time, which are not checked against the values used at plan time. ([#7713](https://github.com/databricks/cli/pull/7713))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

first sentence is sufficient

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 0b2cd9c. The entry now keeps only the first sentence. The note that deploy --plan uses the values supplied at deploy time, without comparing them with the plan, came from an earlier review comment; it stays in the PR description.

andrewnester and others added 3 commits November 25, 2026 15:25
Co-authored-by: Isaac <no-reply@databricks.com>
Plan JSON now shows sensitive values as [redacted]. Deploy and destroy
requests still send the real value. Only the three plan "value" lines
changed.

Co-authored-by: Isaac <no-reply@databricks.com>

@denik denik left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Automated review of 4af7b65 by Opus, Fable and Astra; each finding verified against the code.

One blocking issue: deploy --plan can send a different secret value than a plain deploy for the same input (inline, reproduced). The rest checked out. Redaction now runs after the plan-time SyncToJSON. A plain deploy still applies from the unredacted cache. No new RPCs. Nothing merged to main since the base conflicts: build, unit tests and the related acceptance tests pass on a merge with current main.

Not posted inline:

  1. Should fix bundle/direct/bundle_plan.go:76, bundle/direct/dresources/redact_config.go:64: CheckSensitivePlanValues repeats the restore rule's walk with its own adapter lookup. SensitiveFieldRules returns the same as the existing dresources.GetResourceConfig(t).SensitiveFields, used in bundle/config/validate/sensitive_variable_references.go; main also has dresources.IsSensitiveResourceField since #8111. One method that prepares and restores the saved plan's state, run where process.go loads the plan, would keep the check and the apply from drifting. The fix for the blocking item rewrites this code anyway.
  2. Nit (convention) bundle/direct/bundle_plan.go:80: the dedup keys on err.Error(), and AGENTS.md says never to branch on error strings. Looking each resource up once and reporting a missing one once would avoid it.

Comment thread bundle/direct/redact.go Resolved
Comment thread bundle/direct/redact.go Resolved
Comment thread bundle/direct/redact.go
return nil
}

if entry.NewState != nil {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Supporting detail: this already happens in memory. Apply's resolveReferences(..., false) (bundle_apply.go:142 → bundle_plan.go:1604) calls sv.SyncToJSON(entry.NewState) from the unredacted cache. So after a deploy, the entries of a secret with a reference carry the plaintext again. Today nothing serializes the plan after apply (the only marshal is cmd/bundle/plan.go:112), and apply reads only the cache. Skipping that SyncToJSON when !isPreDeploy would remove the hazard instead of documenting it.

@denik
denik self-requested a review November 28, 2026 09:15
andrewnester and others added 2 commits November 28, 2026 09:17
…ction

Co-authored-by: Isaac <no-reply@databricks.com>
A resource reference and an escaped reference in a sensitive value are restored
verbatim from the config, so the create requests of deploy --plan differ from a
plain deploy. The test compares the two request bodies and fails on this branch.

Co-authored-by: Isaac <no-reply@databricks.com>
andrewnester and others added 2 commits November 28, 2026 09:26
The deploy from a saved plan restored the sensitive fields from the raw config string, so a
reference was sent as its literal text and an escaped reference as its escaped form.
The restore now builds the state the way makePlan does (PrepareInputConfig, PrepareState,
unescapeRefs) and keeps the references of sensitive fields for apply to resolve. A value
that still holds an unresolved reference is an error.

The check before apply and the apply share one restore (restoreSavedPlanStates), so they
cannot disagree. A resource missing from the config is reported once. Apply no longer
serializes resolved references back into the plan entry, so the redacted plan entries keep
no secret after a deploy.

Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
@andrewnester

Copy link
Copy Markdown
Contributor Author

Addressed both items from the review body in 4340263 (plus b1927a2 for a lint fix):

  1. The check before apply and the apply now run one method, restoreSavedPlanStates, so they cannot drift. SensitiveFieldRules is removed. The restore reads the sensitive fields with dresources.GetResourceConfig(...).SensitiveFields; IsSensitiveResourceField works on whole-config dyn paths, while the restore works on one typed state, so it is not used here.
  2. Each resource is looked up once. A resource missing from the config is reported once, and nothing is deduplicated on err.Error().

andrewnester and others added 2 commits November 28, 2026 19:36
A plan from this CLI carries redacted secret values that only a CLI restoring them from the
config can apply. Version 3 makes released CLIs refuse these plans, instead of applying the
redaction marker as the secret. Version 2 plans stay readable: restore replaces their
sensitive fields from the config.

Co-authored-by: Isaac <no-reply@databricks.com>
…ction

Co-authored-by: Isaac <no-reply@databricks.com>

@denik denik left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Automated review of 7d5e265 by Opus, Fable and Astra; each finding verified against the code.

The previous round's restore bug and plan-version point are fixed. Two Should-fix points remain on the restore (inline): a sensitive field whose reference changes between plan and deploy --plan gets the plan's reference or a reference the graph doesn't order, and the restore duplicates makePlan's build. Build, the bundle/direct, deployplan and cmd/bundle/utils unit tests, and 93 acceptance tests under variables/sensitive, deploy/readplan and resources/secrets pass on a merge with current main (no conflicts). No new RPCs.

Not posted inline:

  1. Should fix bundle/direct/bundle_plan.go:83: newAdapterForKey is a second way to build client-less adapters. RecordMissingInternalIDs (bundle_plan.go:1021) uses dresources.InitAll(nil) with getAdapterForKey; doing the same in CheckSensitivePlanValues also keeps the existing resource type "x" not supported, available: ... error for a saved plan with an unknown type.
  2. Should fix acceptance/bundle/deploy/readplan/plan-version-2/script:2: the test rewrites plan_version on a job plan, so "version 2 plans have their sensitive fields restored from the config" is covered only by the unit table. A secret whose new_state.value.value is set to a stale plaintext in the same jq, with the create request value printed, would pin it.
  3. Nit bundle/direct/redact.go:185: the "unresolved reference" error prints the sensitive field's value with %q. It looks unreachable today (built and refs come from the same config value), but if it ever fires it puts the secret in the output; leaving the value out of the message is safer.

Comment thread bundle/direct/redact.go Resolved
Comment thread bundle/direct/redact.go Resolved
Comment thread bundle/direct/redact.go Resolved
Comment thread bundle/direct/redact.go Resolved
@denik

denik commented Nov 29, 2026

Copy link
Copy Markdown
Contributor

🤖 Thanks, both review-body points are covered: the check and the apply share restoreSavedPlanStates, SensitiveFieldRules is gone, and a missing resource is reported once without keying on err.Error().

@denik
denik self-requested a review November 29, 2026 09:22
andrewnester and others added 2 commits November 29, 2026 10:25
A sensitive field whose reference changed between bundle plan and deploy --plan got the
plan's reference back, so apply overwrote the literal from the config. A reference to a
resource the plan does not depend on was applied without ordering, and failed mid-apply.

The restore now builds the value with buildPlannedState, which is the build makePlan uses.
It keeps the references the config has, and drops the plan's when the config has none. A
reference to a resource the plan does not depend on is an error that asks for bundle plan
again. References that planning resolves before deploy are resolved the same way; the rest
are left for apply.

The plan no longer carries the references of sensitive fields, so a template such as a
secret followed by a reference no longer shows in the saved plan.

Co-authored-by: Isaac <no-reply@databricks.com>
…ction

Co-authored-by: Isaac <no-reply@databricks.com>
@andrewnester

Copy link
Copy Markdown
Contributor Author

Addressed the three items from the review body in 062e144 and merge acaf8de:

  1. The check builds its adapters with dresources.InitAll(nil) and getAdapterForKey, as RecordMissingInternalIDs does. newAdapterForKey is gone, so an unknown type gives the existing "resource type ... not supported" error.
  2. plan-version-2 now has a secret. Its new_state.value.value is set to a stale plaintext in the same jq, and the create request shows the config value.
  3. The "unresolved reference" error no longer includes the field value.

@denik denik left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Automated review of acaf8de by Opus and Astra (two independent Astra passes and an Astra advocate pass; Fable was unavailable this round). Each finding was verified against the code.

Both points from the last round are fixed. A reference that changes to a literal after planning no longer keeps the plan's reference, and a reference to a resource the plan doesn't depend on is refused before approval. makePlan and the restore now share buildPlannedState. One Should-fix point remains, on the new resolveSensitiveRefs (inline, reproduced): a reference to an unchanged resource can deploy a different secret than a plain deploy does, and a bad reference fails mid-apply instead of before approval.

Tested on a merge with current main (no conflicts): build, the bundle/direct, deployplan and cmd/bundle/utils unit tests, and the acceptance tests under variables/sensitive, deploy/readplan and resources/secrets all pass. No new RPCs.

Comment thread bundle/direct/redact.go Outdated
if err != nil {
return fmt.Errorf("parsing reference %q: %w", target, err)
}
value, err := b.LookupReferencePreDeploy(ctx, targetPath)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Should fix This still resolves differently from planning in two cases. Both are reproduced with scratch acceptance tests on this branch merged into current main:

  • A reference to an unchanged resource. CalculatePlan drops new_state for Skip entries, so LookupReferencePreDeploy fails here ("missing new_state"). The error is skipped, and apply then resolves the reference from remote state. Example: a deployed schema with name: MySchema and a new secret with value: ${resources.schemas.s.name}. A plain deploy POSTs "value": "MySchema", but deploy --plan POSTs "value": "myschema" (UC lowercases schema names, and so does the testserver). On main both send MySchema, because the plan carried the resolved value.
  • Other lookup errors are skipped too, and CheckSensitivePlanValues doesn't run this step. Say the reference changes after bundle plan to ${resources.catalogs.c.nonexistent}. It's the same node, so the depends-on check passes. A plain bundle plan fails with "schema mismatch". deploy --plan uploads the files, creates the catalog, and only then fails with cannot create resources.secrets.sec: cannot resolve "${resources.catalogs.c.nonexistent}".

Suggested fix: skip only errDelayed, and stop the deploy on any other error before approval, like the other restore errors do. For a Skip target, read the field from the target's local state built from the config (buildPlannedState), which is the value planning uses. A plan-restore step with an unchanged schema whose name has upper case would pin the first case.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in d7a97da (merged main in 880e130). Only delayed references are skipped now; any other lookup error stops the deploy, and CheckSensitivePlanValues runs the same resolution before anything is uploaded. An unchanged resource is resolved from its local state built from the config, the way planning builds it.

New plan-restore steps: an already deployed schema MySchema with a secret value: ${resources.schemas.s.name}. Plain deploy and deploy --plan send the same value. On acaf8de --plan sent myschema and the diff failed. A reference that changes to ${resources.catalogs.source_catalog.nonexistent} is refused before upload. On acaf8de it uploaded, created the catalog, then failed mid-apply.

Comment thread bundle/direct/redact.go Resolved
Comment thread bundle/direct/redact.go Resolved
@denik

denik commented Nov 30, 2026

Copy link
Copy Markdown
Contributor

🤖 Thanks, the three review-body points are covered. CheckSensitivePlanValues now uses InitAll(nil) with getAdapterForKey. plan-version-2 pins the stale plaintext: the regression report shows it fails on main, and the create request carries the config value. The unresolved-reference error no longer prints the value.

@denik
denik self-requested a review November 30, 2026 08:49
andrewnester and others added 2 commits November 30, 2026 09:22
A reference in a sensitive field to an unchanged resource was left for apply, which reads the
remote state. The API lowercases some names, so a plain deploy and deploy --plan sent different
values. A reference that did not resolve was skipped, and the failure came after the catalog was
created.

An unchanged resource now gets a local state built from the config the way planning builds it,
and references resolve from it. Only a delayed reference is left for apply; any other lookup
error stops the deploy. CheckSensitivePlanValues runs the same resolution before anything is
uploaded. A lookup of a remote-only field without remote state is delayed, not an error.

Co-authored-by: Isaac <no-reply@databricks.com>
…ction

Co-authored-by: Isaac <no-reply@databricks.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DABs DABs related issues factory-generated

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature request: Redact sensitive variables from bundle plan and deploy

4 participants