Skip to content

Commit 7ef6ef0

Browse files
feat(write-only): mark base field as sensitive during generation (#15240)
1 parent 35f8c83 commit 7ef6ef0

File tree

3 files changed

+2
-2
lines changed

3 files changed

+2
-2
lines changed

docs/content/reference/field.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ sensitive: true
110110
### `write_only`
111111
Set to true to enable write-only functionality for this field.
112112
If true, the [**Write-only Arguments**](https://developer.hashicorp.com/terraform/plugin/sdkv2/resources/write-only-arguments) will be automatically generated by the code generator (`[field_name]_wo` and `[field_name]_wo_version`).
113-
The base field should also be marked as `sensitive` so that the value is obscured in Terraform output but it will still be stored in state. (This is necessary for compatibility with Terraform <v1.11.) The write-only version of the field will be obscured in Terraform output and _won't_ be stored in state. See [Ephemerality in Resources - Use Write-only arguments](https://developer.hashicorp.com/terraform/language/resources/ephemeral/write-only) for more information.
113+
The base field will automatically be marked as `sensitive` so that the value is obscured in Terraform output but it will still be stored in state. (This is necessary for compatibility with Terraform <v1.11.) The write-only version of the field will be obscured in Terraform output and _won't_ be stored in state. See [Ephemerality in Resources - Use Write-only arguments](https://developer.hashicorp.com/terraform/language/resources/ephemeral/write-only) for more information.
114114

115115
Example:
116116

mmv1/api/resource.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -818,6 +818,7 @@ func buildWriteOnlyVersionField(name string, originalField *Type, writeOnlyField
818818

819819
func (r *Resource) addWriteOnlyFields(props []*Type, propWithWoConfigured *Type) []*Type {
820820
propWithWoConfigured.WriteOnly = false
821+
propWithWoConfigured.Sensitive = true
821822
if len(propWithWoConfigured.RequiredWith) > 0 {
822823
log.Fatalf("WriteOnly property '%s' in resource '%s' cannot have RequiredWith set. This combination is not supported.", propWithWoConfigured.Name, r.Name)
823824
}

mmv1/products/compute/VpnTunnel.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,6 @@ properties:
178178
required: true
179179
ignore_read: true
180180
write_only: true
181-
sensitive: true
182181
- name: 'sharedSecretHash'
183182
type: String
184183
description: |

0 commit comments

Comments
 (0)