Preserve nullable volume_tags for aws_instance - #242
Merged
liranfarage89 merged 2 commits intoSep 6, 2026
Conversation
A literal map can never evaluate to null, so wrapping it in a `== null ? null : merge(...)` guard only adds noise to generated output. Keep the guard for dynamic expressions (variables, conditionals) where it is needed to avoid the root_block_device.tags conflict. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
liranfarage89
approved these changes
Sep 6, 2026
liranfarage89
left a comment
Contributor
There was a problem hiding this comment.
Thanks for the fix. I pushed one small commit on top so the null guard only applies to non-literal expressions (a literal map can never be null, so guarding it just adds noise to generated output). CI is green.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Preserve the original nullability of
aws_instance.volume_tagswhen Terratag adds volume tags. The generated expression now returnsnullwhen the original expression evaluates tonull, avoiding theroot_block_device.tagsconflict while retaining the existing merge behavior for non-null values.Fixes #241
Changes
volume_tagsmerge with an original-value null checkaws_instance_volume_tagsfixture with the reported conditional patternTesting
go test ./internal/tagging -run TestTagAwsInstance_PreservesNullableVolumeTags -count=1SKIP_INTEGRATION_TESTS=1 go test ./...go vet ./...go fmt ./...TestTerraformlatest/aws_instance_volume_tagsfixture run with a local provider-schema stub