简体   繁体   中英

how to pass subnet to tfvars? using terraform for azure subnets

i have a su.net module like this:

    module "subnet" {
  source = "../../azurerm/azurerm-subnet"

  business_unit       = var.business_unit
  location            = var.location
  region              = var.region
  resource_group_name  = var.vnet_resource_group
  virtual_network_name = var.virtual_network_name
  address_prefixes     = var.address_prefixes
}

how can pass these values to a tfvars file?

During your terraform plan execution you should pass your values in a tfvars file. command: terraform plan "-var-file=su.net.tfvars" In your su.net.tfvars pass values like this:

business_unit       = "IT"
location            = "Your VNET Location"
region              = "..."
resource_group_name  = "Your VNET RG Name"
virtual_network_name = "Your VNET Name"
address_prefixes     = "A suitable address prefix like 10.0.1.0/24"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM