fix: Allow security_group_ids to take null values#825
Merged
bryantbiggs merged 1 commit intoterraform-aws-modules:masterfrom Sep 2, 2022
Merged
fix: Allow security_group_ids to take null values#825bryantbiggs merged 1 commit intoterraform-aws-modules:masterfrom
security_group_ids to take null values#825bryantbiggs merged 1 commit intoterraform-aws-modules:masterfrom
Conversation
security_group_ids to take null valuessecurity_group_ids to take null values
security_group_ids to take null valuessecurity_group_ids to take null values
antonbabenko
approved these changes
Sep 1, 2022
Member
antonbabenko
left a comment
There was a problem hiding this comment.
LGTM.
@bryantbiggs WDYT?
| auto_accept = lookup(each.value, "auto_accept", null) | ||
|
|
||
| security_group_ids = lookup(each.value, "service_type", "Interface") == "Interface" ? distinct(concat(var.security_group_ids, lookup(each.value, "security_group_ids", []))) : null | ||
| security_group_ids = lookup(each.value, "service_type", "Interface") == "Interface" ? length(distinct(concat(var.security_group_ids, lookup(each.value, "security_group_ids", [])))) > 0 ? distinct(concat(var.security_group_ids, lookup(each.value, "security_group_ids", []))) : null : null |
Member
There was a problem hiding this comment.
A bit shorter way:
Suggested change
| security_group_ids = lookup(each.value, "service_type", "Interface") == "Interface" ? length(distinct(concat(var.security_group_ids, lookup(each.value, "security_group_ids", [])))) > 0 ? distinct(concat(var.security_group_ids, lookup(each.value, "security_group_ids", []))) : null : null | |
| security_group_ids = lookup(each.value, "service_type", "Interface") == "Interface" ? try(coalescelist(distinct(concat(var.security_group_ids, lookup(each.value, "security_group_ids", [])))), null) : null |
bryantbiggs
approved these changes
Sep 2, 2022
Member
bryantbiggs
left a comment
There was a problem hiding this comment.
Looks good to me, thanks @Jorge-Rodriguez !
antonbabenko
pushed a commit
that referenced
this pull request
Sep 2, 2022
### [3.14.3](v3.14.2...v3.14.3) (2022-09-02) ### Bug Fixes * Allow `security_group_ids` to take `null` values ([#825](#825)) ([67ef09a](67ef09a))
Member
|
This PR is included in version 3.14.3 🎉 |
|
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Description
Allow the
security_group_idsargument toaws_vpc_endpointto takenullvalues when the endpoint is of Interface typeMotivation and Context
When defining a VPC endpoint of type Interface, if no
security_group_idsare defined either as defaults or in the individual endpoint definition, the value passed to theaws_vpc_endpointresource is an empty list.This PR modifies that behaviour so that if no
security_group_idsare defined, theaws_vpc_endpointreceives anullvalue instead of an empty list. Semantically, it makes no difference and it causes the default security group to be associated with the endpoint. However, functionally, anullvalue enables the use ofaws_vpc_endpoint_security_group_associationresources without triggering changes on theaws_vpc_endpointresource.How Has This Been Tested?
I have tested this changes against an environment where the side effects that this change addresses were occuring