CtrlK
BlogDocsLog inGet started
Tessl Logo
SkillPublic

modify-plan-unknown-collection-elements

Use when a resource ModifyPlan or plan modifier reads a list or set of nested objects with ElementsAs into Go structs. An unknown element fails the plan; walk types.Object values instead.

Quality

92%

Does it follow best practices?

Run evals on this skill

Adds up to 20 points to the overall score

View guide
SecuritybySnyk

Passed

No findings from the security scan

SKILL.md
Quality
Evals
Security

ModifyPlan must tolerate unknown elements of a known collection

Trigger: ModifyPlan (or a plan modifier) calls ElementsAs(ctx, &[]SomeModel{}, false) on a configured, planned, or prior list or set of objects.

Fix: Read Elements() as types.Object, skip each element that is null or unknown, and read attributes with obj.Attributes()["name"]. To change a value, clone the attributes, set the new one, and rebuild with types.ObjectValue / types.ListValue / types.SetValue. Test it by calling ModifyPlan directly with tftypes.NewValue(objType, tftypes.UnknownValue) elements. The protocol baseline harness checks required attributes before it plans, so it never reaches the modifier with an unknown object.

Why: A whole-collection IsUnknown() guard misses rules = [jsondecode(x.out)], where the list is known but an element is unknown. A Go struct cannot hold an unknown object, so the conversion adds a Value Conversion Error and the plan fails.

Repository

coralogix/terraform-provider-coralogix

Path

.claude/skills/modify-plan-unknown-collection-elements/SKILL.md

Last updated
First committed

Is this your skill?

If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.