Skip to content

Conversation

@gotwarlost
Copy link
Collaborator

@gotwarlost gotwarlost commented Nov 17, 2025

This PR implements Terraform semantics for null attribute values, which is to remove them from the output.

Currently it is difficult to create optional attributes and must be done like so:

    spec = merge( { actual: spec}, optionalAttributeNeeded ? { foo: "bar"} : {}

All this is unnecessary given that k8s objects do not have explicit nulls in their spec. So filtering out null values makes the above code look like:

   spec = { actual: spec, foo: optionalAttributeNeeded ? "bar" : null }

Signed-off-by: gotwarlost <krishnan.anantheswaran@elastic.co>
Signed-off-by: gotwarlost <krishnan.anantheswaran@elastic.co>
@gotwarlost gotwarlost changed the title remove keys from objects that have a null value implement Terraform null semantics to avoid complex code Nov 24, 2025
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