You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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?
The text was updated successfully, but these errors were encountered:
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
locked and limited conversation to collaborators
Mar 5, 2019
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
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?
The text was updated successfully, but these errors were encountered: