Skip to content

DiffSuppressFunc alternative? #1030

Open
@amalavet

Description

@amalavet

Module version

v1.11.0

Use-cases

To keep our plans less verbose, we'd like to be able to obscure/shorten the diff for some of our attributes on our resources.

Attempted Solutions

  1. Setting sensitive obscures the diff, but we want to obscure non-sensitive fields as well
  2. I have attempted to use a plan modifier, but this impacts the value that gets applied to the state as well.
"my_field": schema.StringAttribute{
	...
        Sensitive: true,
},
type suppressFieldValue struct{}

func (m suppressFieldValue) Description(_ context.Context) string {
	return "Suppresses the value within the plan"
}

func (m suppressFieldValue) MarkdownDescription(_ context.Context) string {
	return "Suppresses the value within the plan"
}

func (m suppressFieldValue) PlanModifyString(
	_ context.Context,
	req planmodifier.StringRequest,
	resp *planmodifier.StringResponse,
) {
	resp.PlanValue = types.StringValue("<<SUPPRESSED>>")
}

Proposal

We could have an optional value that, if set, overrides the diff of the attribute within the plan?

... 
func (m suppressFieldValue) PlanModifyString(
	_ context.Context,
	req planmodifier.StringRequest,
	resp *planmodifier.StringResponse,
) {
	resp.PlanDiffValue = types.StringValue("<<SUPPRESSED>>")
}

or just do something like: DiffSuppressFunc from sdkv2

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestwaiting-responseIssues or pull requests waiting for an external response

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions