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

feat: (IAC-367) Allow Ability To Specify Which Availability Zones the Subnets Get Created In #240

Merged
merged 6 commits into from
Nov 3, 2023

Conversation

jarpat
Copy link
Contributor

@jarpat jarpat commented Nov 2, 2023

Changes

Allows users the ability to specify which AZs that the subnet gets created in with the new subnet_azs variable.

Similar to the existing subnets the map lets to set the name of the subnet along with zones will be used during creation

subnet_azs = {
  "private"       : ["us-east-2c"],
  "control_plane" : ["us-east-2c", "us-east-2b"],
  "public"        : ["us-east-2a", "us-east-2b"],
  "database"      : ["us-east-2a", "us-east-2b"]
}

So if your defined subnets as so in your .tfvars

{
    "private" : ["192.168.0.0/18"], 
    "control_plane" : ["192.168.130.0/28", "192.168.130.16/28"],
    "public" : ["192.168.129.0/25", "192.168.129.128/25"],
    "database" : ["192.168.128.0/25", "192.168.128.128/25"]
}

for "control_plane" : ["192.168.130.0/28", "192.168.130.16/28"], the first subnet will be created in us-east-2c and the second in us-east-2b

This variable is entirely optional, and if not defined the code will perform a lookup to populate the zones just like the behavior in viya4-iac-aws:7.2.1 and prior. If entire keys are not defined, the lookup will be used to populate those.

Tests

Scenario Provider Summary K8s Version Order Cadence
1 AWS OOTB, subnet_azs not defined v1.26.10-eks-4f4795d ****** fast:2020
2 AWS OOTB, all keys in subnet_azs customized v1.26.10-eks-4f4795d ****** fast:2020
3 AWS OOTB, partial keys in subnet_azs defined v1.26.10-eks-4f4795d ****** fast:2020

Validation Scenarios

In all cases subnet was left as the default value: https://github.com/sassoftware/viya4-iac-aws/blob/staging/variables.tf#L371

Scenario Summary Behavior
1 subnet_azs not defined, defaults to {} Valid, no error message
2 subnet_azs fully defined, correct entries per each key Valid, no error message
3 subnet_azs defined, private key omitted Valid, no error message
4 subnet_azs defined, control_plane key omitted Valid, no error message
5 subnet_azs defined, database key not enough entries Invalid, error message thrown
6 subnet_azs defined, public key not enough entries Invalid, error message thrown
7 subnet_azs defined, control_plane key extra entries Valid, no error message

@jarpat jarpat self-assigned this Nov 2, 2023
@jarpat jarpat added the enhancement New feature or request label Nov 2, 2023
docs/CONFIG-VARS.md Outdated Show resolved Hide resolved
docs/CONFIG-VARS.md Outdated Show resolved Hide resolved
variables.tf Outdated Show resolved Hide resolved
jarpat and others added 3 commits November 2, 2023 16:14
Co-authored-by: David Houck <[email protected]>
Co-authored-by: David Houck <[email protected]>
Co-authored-by: David Houck <[email protected]>
@jarpat
Copy link
Contributor Author

jarpat commented Nov 2, 2023

@dhoucgitter good catch on the vars/docs, applied those suggestions.

Copy link
Member

@thpang thpang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am ok with the update here as long as we check to ensure the same number of elements for each subnet match the cidr and azs. We can at least ensure they have matching items.

@jarpat
Copy link
Contributor Author

jarpat commented Nov 3, 2023

I am ok with the update here as long as we check to ensure the same number of elements for each subnet match the cidr and azs. We can at least ensure they have matching items.

@thpang see latest commit, validation added.

Copy link
Member

@thpang thpang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jarpat
Copy link
Contributor Author

jarpat commented Nov 3, 2023

Tests ran fine, did a minor doc update as well for the variable. Merging.

@jarpat jarpat merged commit baae3e1 into staging Nov 3, 2023
3 checks passed
@jarpat jarpat deleted the IAC-367 branch November 3, 2023 17:09
dhoucgitter pushed a commit that referenced this pull request Feb 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants