'Making an argument optional in terraform resource block
Can we make argument usage present in a resource block optional for eg like in below resource block table_name , mapping_rule_name and data_format are optional parameter and I want to have a standard format for terraform where I can make these values optional for e.g like if var.table_name variable has value it should provide it to table_name otherwise table_name should be ignored i.e. eventhubconnection be formed without table_name,mapping_rule_name and data_format as these are optional value
resource "azurerm_kusto_eventhub_data_connection" "eventhub_connection" {
name = "my-kusto-eventhub-data-connection"
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location
cluster_name = azurerm_kusto_cluster.cluster.name
database_name = azurerm_kusto_database.database.name
eventhub_id = azurerm_eventhub.eventhub.id
consumer_group = azurerm_eventhub_consumer_group.consumer_group.name
table_name = var.table_name #(Optional)
mapping_rule_name = var.mapping_rule_name #(Optional)
data_format = var.data_format #(Optional)
}
Is there any way to do that in terraform?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
