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.
92%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
Passed
No findings from the security scan
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.
coralogix/terraform-provider-coralogix
7db6f79
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.