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
The local for the nat gateway ids was causing issues when
custom_nat_gateway_enabled
was set to true. This was because terraform needs at least the key to be static for an argument tofor_each
, and in the case of nat gateways created by the module and the logic that was implemented, the key could only be determined after the apply. This PR is to fix that issue by splitting the local into 2 locals, so that not null condition can be applied on the nat gateway ids from vars, while maintaining the consistency with the nat gateways created within the module.Related Issue
Checklist
Please ensure that the following steps are completed before submitting the pull request:
Type of change
Please delete options that are not relevant.
Testing Instructions
Run terraform apply on
examples/custom-subnets
while changing the values for the module attributes:custom_nat_gateway_enabled
custom_az_ngw_ids
Covering different scenarios.