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

azurerm_cosmosdb_account ip_range_filter can't be "" when try to skip #2700

Closed
snerting opened this issue Jan 17, 2019 · 2 comments · Fixed by #2713
Closed

azurerm_cosmosdb_account ip_range_filter can't be "" when try to skip #2700

snerting opened this issue Jan 17, 2019 · 2 comments · Fixed by #2713

Comments

@snerting
Copy link

I'm creating a terraform config (let's call it config A) who is used as a module in another config (config B).
In config A I have a optional variable who is a comma separated string (without space) contain IP addresses or IP address ranges in CIDR form.
What I want is to skip or not set value of this variable if there is no IP's as input from config B.
I tried set "" as value, but that of course not work. Also tried other values, but can't figure it out.

Is there any way to have this work or must I create two config (let's call it config A.1 and A.2) where A.1 contains the string variable, and A.2 not.

Maybe a sample code can help.

#Config A
resource "azurerm_cosmosdb_account" "db" {
  name                = "${var.name_from_module_caller}"
  location            = "northeuropa"
  resource_group_name = "test-cosmos-db-from-terraform"
  offer_type = "Standard"
  consistency_policy  = {
    consistency_level = "Session"
  }
  geo_location        = {
  location            = "northeuropa"
    location          = "${azurerm_resource_group.rg.location}"
    failover_priority = 0
  }
  ip_range_filter     = "${var.whitelis_ip_from_module_caller}" #Need a way to skip this, if var.whitelis_ip_from_module_caller is "". Can't use ""
}

#Config B
module "test-cosmos-db" {
  source              = "/module/azure_cosmos_module"
  name_from_module_caller = "test-cosmosdb"
  # whitelis_ip_from_module_caller //NOT SET, BECAUSE THIS MUST BE OPENED FOR EVERYONE
}

If ip_range_filter had been an list instead, this could easly been set to empty, so maybe that should have been used, instead of string?

@katbyte
Copy link
Collaborator

katbyte commented Jan 18, 2019

Hi @snerting,

Thank you for bringing this to our attention, I've opened #2713 that will allow empty strings for the ip filter

@tombuildsstuff tombuildsstuff modified the milestones: 2.0.0, 1.22.0 Jan 21, 2019
@ghost
Copy link

ghost commented Mar 5, 2019

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks!

@ghost ghost locked and limited conversation to collaborators Mar 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
3 participants