Is there a way in terraform to give users choice of authentication ( like password or keyvault... etc) at the input level?

I am using azure provider, and for the sake of vm authentication i want to provide users 2 types of authentication ( randomly generate password and key vault based) .

below is the snapshot of code how i am doing for individual approach, but i need to convert these based on user authentication choice. For example if user want to key vault authentication, it should ask vault related inputs and create password based on it. If user wants dynamic password it should not ask vault parameters or execute vault resources, it simply has to run random resource and create password.

data “azurerm_resource_group” “rg_keyvault” {
name = “${var.azure_secret_rg}”
}

data “azurerm_key_vault” “keyvault” {
name = “{var.azure_keyvault_name}" resource_group_name = "{data.azurerm_resource_group.rg_keyvault.name}”
}

data “azurerm_key_vault_secret” “bigip_admin_password” {
name = “{var.azure_keyvault_secret_name}" key_vault_id = "{data.azurerm_key_vault.keyvault.id}”
}

resource “random_password” “password” {

}

resource “azurerm_virtual_machine” “x” {


os_profile {
admin_username = var.f5_username

#admin_password = random_password.password.result
#admin_password = data.azurerm_key_vault_secret.bigip_admin_password.value

}