Skip to content

Enforce only one type per processor#3498

Draft
taylorchandleryoung wants to merge 1 commit intomasterfrom
taylor.c.young/OPA-4203-tf-p-2-enforce-single-type-block
Draft

Enforce only one type per processor#3498
taylorchandleryoung wants to merge 1 commit intomasterfrom
taylor.c.young/OPA-4203-tf-p-2-enforce-single-type-block

Conversation

@taylorchandleryoung
Copy link
Contributor

@taylorchandleryoung taylorchandleryoung commented Feb 5, 2026

Motivation

The user can currently issue a malformed terraform request that returns in a different shape and terraform responds with an error with the provider.

We should prevent this terraform shape.

Changes

Using cursor: had it add a validator that checks for all non default processor fields. If we do this based off of processor names, we would need to update this every time we add a new processor.

Alternative considered

Validators: []validator.Object{ objectvalidator.ExactlyOneOf( path.MatchRelative().AtName("sample"), path.MatchRelative().AtName("quota"), path.MatchRelative().AtName("filter"), // ... all 22+ processor types ), }

This runs in the same issue mentioned above that it is fragile when we add new processor types

Copy link
Member

@tessneau tessneau left a comment

Choose a reason for hiding this comment

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

nice ! 🔥

Copy link
Member

Choose a reason for hiding this comment

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

tioli: maybe this could fit nicely in processor_common.go since its pretty small, to keep all processor things together?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants