sassoftware / viya4-iac-azure

This project contains Terraform configuration files to provision infrastructure components required to deploy SAS Viya platform products on Microsoft Azure Cloud.
Apache License 2.0
73 stars 88 forks source link

count is evaluated to 1 always #156

Closed pilyk closed 3 years ago

pilyk commented 3 years ago

https://github.com/sassoftware/viya4-iac-azure/blob/dad94e97ab4e5caada4df63b6a5b99497f0446a2/main.tf#L172

Encountered an issue where I wanted to have the count = 0 since I will not be using public IPs for both jump vm and nfs vm and left the vm_public_access_cidrs empty but always evaluated to 1.

My suggested fix:

count = (((var.create_jump_public_ip && var.create_jump_vm && (length(local.vm_public_access_cidrs) > 0)) || (var.create_nfs_public_ip && var.storage_type == "standard" && (length(local.vm_public_access_cidrs) > 0))) != false) ? 1 : 0

OR maybe

count = ((var.create_jump_public_ip && var.create_jump_vm && (length(local.vm_public_access_cidrs) > 0)) || (var.create_nfs_public_ip && var.storage_type == "standard" && (length(local.vm_public_access_cidrs) > 0))) ? 1 : 0

Thanks.

thpang commented 3 years ago

Hi @pilyk we'll look into this. For future reference this is a public GitHub repo, if you have suggestions for a code change, fork the repo, make the adjustments you believe would benefit everyone, test those changes, then submit a pull request and we'll look at merging the code. Thx again.

If you have questions on making contributions please refer to our document on this here