Skip to content

implement Terraform null semantics to avoid complex code#32

Open
gotwarlost wants to merge 2 commits into
mainfrom
null-process
Open

implement Terraform null semantics to avoid complex code#32
gotwarlost wants to merge 2 commits into
mainfrom
null-process

Conversation

@gotwarlost

@gotwarlost gotwarlost commented Nov 17, 2025

Copy link
Copy Markdown
Collaborator

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.

1 participant