Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split locals for nat gateway ids #74

Merged
merged 1 commit into from
Feb 10, 2024

Conversation

shubhamsinha-sf
Copy link
Contributor

@shubhamsinha-sf shubhamsinha-sf commented Feb 10, 2024

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 to for_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

  • Closed issue : Follow up to PR on issue 70.

Checklist

Please ensure that the following steps are completed before submitting the pull request:

  • Code follows the Terraform best practices and style guidelines.
  • Changes are appropriately documented, including any necessary updates to README or other documentation files.
  • Unit tests have been added or updated to cover the changes introduced by this pull request.
  • Changes have been tested locally and verified to work as expected.
  • The code has been reviewed to ensure it aligns with the project's goals and standards.
  • Dependencies and backward compatibility have been considered and addressed if applicable.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

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.

Copy link

Quality Gate Passed Quality Gate passed

Issues
0 New issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@jamescrowley321
Copy link
Contributor

LGTM

@shubhamsinha-sf shubhamsinha-sf merged commit b95f4f4 into main Feb 10, 2024
5 checks passed
@shubhamsinha-sf shubhamsinha-sf deleted the bugfix/split-locals-for-nat-gateway-ids branch February 10, 2024 12:31
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