-
Notifications
You must be signed in to change notification settings - Fork 45
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 #236
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to review the need to add or change what the customer is providing.
locals.tf
Outdated
public_subnet_azs = ( | ||
can(var.subnet_azs["public"]) ? | ||
(length(var.subnet_azs["public"]) >= length(lookup(var.subnets, "public", [])) ? | ||
var.subnet_azs["public"] | ||
: distinct(concat(var.subnet_azs["public"], data.aws_availability_zones.available.names))) | ||
: data.aws_availability_zones.available.names | ||
) | ||
|
||
private_subnet_azs = ( | ||
can(var.subnet_azs["private"]) ? | ||
(length(var.subnet_azs["private"]) >= length(lookup(var.subnets, "private", [])) ? | ||
var.subnet_azs["private"] | ||
: distinct(concat(var.subnet_azs["private"], data.aws_availability_zones.available.names))) | ||
: data.aws_availability_zones.available.names | ||
) | ||
|
||
database_subnet_azs = ( | ||
can(var.subnet_azs["database"]) ? | ||
(length(var.subnet_azs["database"]) >= length(lookup(var.subnets, "database", [])) ? | ||
var.subnet_azs["database"] | ||
: distinct(concat(var.subnet_azs["database"], data.aws_availability_zones.available.names))) | ||
: data.aws_availability_zones.available.names | ||
) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code now takes what the customer provided an augments that value, i.e. its not what the customer provided, its a very well educated guess and provides what's needed, but it simply covers up the user error in that they did not provide the correct number of items for this element. Need a discussion on this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, it may be better not to correct or append to the user input and let it fail, the user should correct any mistakes made.
This should be a quick update to the local.tf
+ doc , I'll make the change and test it out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated the behavior, no longer correcting user input and will let it fail instead. The user should be responsible for correct input. Docs and locals.tf changed, performing tests.
Closing this PR, need to rebase and rework this slightly after the most recent changes from IAC-1174. |
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 creationSo if your defined subnets as so in your .tfvars
for
"private" : ["192.168.0.0/18", "192.168.64.0/18"]
, the first subnet will be created inus-east-2c
and the second inus-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.Also, If not enough zones are defined in the(behavior removed)subnet_azs
in comparison to thesubnets
map a the zone lookup will be done to make up the difference.Test
WIP