DOC-1928: Document write-only attributes for Terraform provider#566
DOC-1928: Document write-only attributes for Terraform provider#566
Conversation
Adds guidance for the password_wo / password_wo_version pattern shipped in provider v1.6.0 (PR #303) and updates Schema Registry HCL examples to use the write-only variants. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
✅ Deploy Preview for rp-cloud ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughDocumentation updates to the Terraform provider guide introducing Terraform 1.11+ write-only attributes for sensitive fields. Adds new documentation explaining required provider/CLI versions, the Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
modules/manage/pages/terraform-provider.adoc (2)
689-735: Consider definingvar.schema_passwordin this example.Similar to the earlier Schema Registry example, this combined example references
var.schema_passwordin multiple places (lines 696, 719, 720, 733, 734) but does not define the variable. Users copying this example might encounter an undefined variable error.📝 Suggested improvement: Add variable definition
Add this variable definition at the beginning of the example:
[source,hcl] ---- variable "schema_password" { description = "Password for the Schema Registry user" sensitive = true } data "redpanda_cluster" "byoc" { id = "byoc-cluster-id" }Or add a note:
NOTE: This example uses `var.schema_password`. Define it as a sensitive variable as shown in <<manage-sensitive-attributes-with-write-only-fields>>.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@modules/manage/pages/terraform-provider.adoc` around lines 689 - 735, The example references var.schema_password in redpanda_user.schema_user, redpanda_schema.user_events, and redpanda_schema_registry_acl.user_events_acl but never defines it; add a variable declaration for schema_password (sensitive = true) at the start of the example or add a NOTE instructing users to define var.schema_password (see manage-sensitive-attributes-with-write-only-fields) so the HCL snippet is runnable and avoids undefined-variable errors.
584-611: Consider definingvar.schema_passwordin this example.The example references
var.schema_passwordon lines 586, 609, and 610, but the variable is not defined in this code snippet. While the variable definition appears in an earlier standalone example (lines 255-258), users might copy this Schema Registry example in isolation and encounter an undefined variable error.📝 Suggested improvement: Add variable definition to make example self-contained
Add this variable definition before the
data "redpanda_cluster"block:[source,hcl] ---- variable "schema_password" { description = "Password for the Schema Registry user" sensitive = true } data "redpanda_cluster" "byoc" { id = "byoc-cluster-id" }Or add a note referencing the earlier example:
NOTE: This example uses `var.schema_password`, which should be defined as a sensitive variable. See <<manage-sensitive-attributes-with-write-only-fields>> for the variable definition.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@modules/manage/pages/terraform-provider.adoc` around lines 584 - 611, The example uses var.schema_password in redpanda_user.schema_user and redpanda_schema.user_events but never defines that variable in this snippet; add a self-contained variable declaration for schema_password (marked sensitive) before data.redpanda_cluster.byoc or include a brief NOTE pointing readers to the earlier variable example (manage-sensitive-attributes-with-write-only-fields) so copying the schema registry example alone won't produce an undefined variable error.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@modules/manage/pages/terraform-provider.adoc`:
- Around line 689-735: The example references var.schema_password in
redpanda_user.schema_user, redpanda_schema.user_events, and
redpanda_schema_registry_acl.user_events_acl but never defines it; add a
variable declaration for schema_password (sensitive = true) at the start of the
example or add a NOTE instructing users to define var.schema_password (see
manage-sensitive-attributes-with-write-only-fields) so the HCL snippet is
runnable and avoids undefined-variable errors.
- Around line 584-611: The example uses var.schema_password in
redpanda_user.schema_user and redpanda_schema.user_events but never defines that
variable in this snippet; add a self-contained variable declaration for
schema_password (marked sensitive) before data.redpanda_cluster.byoc or include
a brief NOTE pointing readers to the earlier variable example
(manage-sensitive-attributes-with-write-only-fields) so copying the schema
registry example alone won't produce an undefined variable error.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 5de69b57-e200-4103-baba-28243eb4a708
📒 Files selected for processing (1)
modules/manage/pages/terraform-provider.adoc
|
|
||
| === Terraform provider: Write-only attributes for sensitive fields | ||
|
|
||
| The Redpanda Terraform provider (v1.6.0+) now supports https://developer.hashicorp.com/terraform/plugin/framework/resources/write-only-arguments[Terraform 1.11+ write-only attributes^] for sensitive fields such as user passwords and pipeline client secrets. Use the new `<field>_wo` and `<field>_wo_version` attributes to keep credentials out of your `.tfstate` file. See xref:manage:terraform-provider.adoc#manage-sensitive-attributes-with-write-only-fields[Manage sensitive attributes with write-only fields]. |
There was a problem hiding this comment.
| The Redpanda Terraform provider (v1.6.0+) now supports https://developer.hashicorp.com/terraform/plugin/framework/resources/write-only-arguments[Terraform 1.11+ write-only attributes^] for sensitive fields such as user passwords and pipeline client secrets. Use the new `<field>_wo` and `<field>_wo_version` attributes to keep credentials out of your `.tfstate` file. See xref:manage:terraform-provider.adoc#manage-sensitive-attributes-with-write-only-fields[Manage sensitive attributes with write-only fields]. | |
| The Redpanda Terraform provider (v1.6.0+) now supports https://developer.hashicorp.com/terraform/plugin/framework/resources/write-only-arguments[Terraform 1.11+ write-only attributes^] for sensitive fields such as user passwords and pipeline client secrets. Use the new `password_wo` and `password_wo_version` attributes (and equivalents for other sensitive fields) to keep credentials out of your `.tfstate file`. See xref:manage:terraform-provider.adoc#manage-sensitive-attributes-with-write-only-fields[Manage sensitive attributes with write-only fields]. |
There was a problem hiding this comment.
From Claude: What's new entry — wording of _wo
The what's new entry uses angle-bracket placeholders in prose (_wo), which works in technical writing but could be confusing to a non-Terraform reader.
|
|
||
| == Manage sensitive attributes with write-only fields | ||
|
|
||
| You can use https://developer.hashicorp.com/terraform/plugin/framework/resources/write-only-arguments[Terraform 1.11+ write-only attributes^] to keep sensitive values out of your Terraform state file. By default, Terraform persists sensitive attributes such as passwords to `.tfstate` after running `terraform apply` or `terraform plan`. This can leak credentials when state is stored in a remote backend or in CI runner artifacts. |
There was a problem hiding this comment.
| You can use https://developer.hashicorp.com/terraform/plugin/framework/resources/write-only-arguments[Terraform 1.11+ write-only attributes^] to keep sensitive values out of your Terraform state file. By default, Terraform persists sensitive attributes such as passwords to `.tfstate` after running `terraform apply` or `terraform plan`. This can leak credentials when state is stored in a remote backend or in CI runner artifacts. | |
| You can use https://developer.hashicorp.com/terraform/plugin/framework/resources/write-only-arguments[Terraform 1.11+ write-only attributes^] to keep sensitive values out of your Terraform state file. By default, Terraform persists sensitive attributes such as passwords to `.tfstate` when you run `terraform apply`. When you store state in a remote backend or in CI runner artifacts, this can leak credentials. |
There was a problem hiding this comment.
Terraform plan does not write to .tfstate. Only apply does.
|
|
||
| === Supported attributes | ||
|
|
||
| |=== |
There was a problem hiding this comment.
Table inconsistency — redpanda_pipeline breaks the <field>_wo pattern
In the Supported attributes table, the redpanda_pipeline row shows client_secret as the write-only attribute (not client_secret_wo), and secret_version instead of client_secret_wo_version. The "How write-only attributes work" section describes the <field>_wo / <field>_wo_version
naming convention as universal. This inconsistency will confuse readers.
There was a problem hiding this comment.
Either:
- Update the table note to explain redpanda_pipeline uses a different naming scheme, or
or - Add a sentence to "How write-only attributes work" noting the exception
| * `<field>_wo`: A write-only attribute. Terraform sends the value to the provider during `apply` but never persists it to state. | ||
| * `<field>_wo_version`: An integer version. Because Terraform cannot detect changes in a write-only value (there is nothing to compare against in state), you increment this number to signal that the value has changed and to trigger an update on the next apply. | ||
|
|
||
| The original plaintext attributes (such as `password`) are deprecated but retained for backwards compatibility. You can migrate to the write-only variants on your own schedule. |
There was a problem hiding this comment.
| The original plaintext attributes (such as `password`) are deprecated but retained for backwards compatibility. You can migrate to the write-only variants on your own schedule. | |
| The provider retains the original plaintext attributes for backward compatibility. You can migrate to the write-only variants on your own schedule. |
| } | ||
| ---- | ||
|
|
||
| Then, set the value securely using an environment variable before running Terraform: |
There was a problem hiding this comment.
Set the variable before running Terraform:
There was a problem hiding this comment.
^^ Add new lead-in to the bash block
| Write-only attributes require: | ||
|
|
||
| * Terraform CLI 1.11 or later | ||
| * Redpanda Terraform provider v1.6.0 or later |
There was a problem hiding this comment.
| Write-only attributes require: | |
| * Terraform CLI 1.11 or later | |
| * Redpanda Terraform provider v1.6.0 or later | |
| Write-only attributes require Terraform CLI 1.11 or later and Redpanda Terraform provider v1.6.0 or later. |
|
Review from Claude (I added comments in context): |
Feediver1
left a comment
There was a problem hiding this comment.
Left several update suggestions.
Adds guidance for the password_wo / password_wo_version pattern shipped in provider v1.6.0 (PR #303) and updates Schema Registry HCL examples to use the write-only variants.
Description
Resolves https://github.com/redpanda-data/documentation-private/issues/
Review deadline:
Page previews
https://deploy-preview-566--rp-cloud.netlify.app/redpanda-cloud/manage/terraform-provider/
Checks