871ca8c3d9
Two new configuration options have been exposed to allow users to specify an existing virtual network: virtual_network_name and virtual_network_resource_group_name. * virtual_network_name: name of the virtual network to attach a Packer VM to. * virtual_network_resource_group_name: name of the resource group that contains the virtual network. This value is optional. If the value is not specified, the builder queries Azure for the appropriate value. If the builder cannot disambiguate the value, a value must be provided for this setting. * virtual_network_subnet_name: name of the subnet attached to the virtual network. This value is optional. If the value is not specified, the builder queries Azure for the appropriate value. If the builder cannot disambiguate the value, a value must be provided for this setting.
37 lines
740 B
Go
37 lines
740 B
Go
package arm
|
|
|
|
// Method to resolve information about the user so that a client can be
|
|
// constructed to communicated with Azure.
|
|
//
|
|
// The following data are resolved.
|
|
//
|
|
// 1. TenantID
|
|
|
|
import (
|
|
"github.com/Azure/go-autorest/autorest/azure"
|
|
"github.com/mitchellh/packer/builder/azure/common"
|
|
)
|
|
|
|
type configRetriever struct {
|
|
// test seams
|
|
findTenantID func(azure.Environment, string) (string, error)
|
|
}
|
|
|
|
func newConfigRetriever() configRetriever {
|
|
return configRetriever{
|
|
common.FindTenantID,
|
|
}
|
|
}
|
|
|
|
func (cr configRetriever) FillParameters(c *Config) error {
|
|
if c.TenantID == "" {
|
|
tenantID, err := cr.findTenantID(*c.cloudEnvironment, c.SubscriptionID)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
c.TenantID = tenantID
|
|
}
|
|
|
|
return nil
|
|
}
|