azure: reject bad configuration faster
This commit is contained in:
parent
787f08f39b
commit
2684153cb2
|
@ -519,6 +519,10 @@ func assertRequiredParametersSet(c *Config, errs *packer.MultiError) {
|
|||
}
|
||||
}
|
||||
|
||||
if c.TempResourceGroupName != "" && c.BuildResourceGroupName != "" {
|
||||
errs = packer.MultiErrorAppend(errs, fmt.Errorf("The settings temp_resource_group_name and build_resource_group_name cannot both be defined. Please define one or neither."))
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////
|
||||
// Compute
|
||||
toInt := func(b bool) int {
|
||||
|
|
|
@ -899,6 +899,31 @@ func TestConfigShouldAcceptManagedImageStorageAccountTypes(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestConfigShouldRejectTempAndBuildResourceGroupName(t *testing.T) {
|
||||
config := map[string]interface{}{
|
||||
"capture_name_prefix": "ignore",
|
||||
"capture_container_name": "ignore",
|
||||
"image_offer": "ignore",
|
||||
"image_publisher": "ignore",
|
||||
"image_sku": "ignore",
|
||||
"location": "ignore",
|
||||
"storage_account": "ignore",
|
||||
"resource_group_name": "ignore",
|
||||
"subscription_id": "ignore",
|
||||
"communicator": "none",
|
||||
|
||||
// custom may define one or the other, but not both
|
||||
"temp_resource_group_name": "rgn00",
|
||||
"build_resource_group_name": "rgn00",
|
||||
}
|
||||
|
||||
_, _, err := newConfig(config, getPackerConfiguration())
|
||||
if err == nil {
|
||||
t.Fatal("expected config to reject the use of both temp_resource_group_name and build_resource_group_name")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
func getArmBuilderConfiguration() map[string]string {
|
||||
m := make(map[string]string)
|
||||
for _, v := range requiredConfigValues {
|
||||
|
|
|
@ -134,8 +134,9 @@ When creating a managed image the following two options are required.
|
|||
assigned. Knowing the resource group and VM name allows one to execute commands to update the VM during a Packer
|
||||
build, e.g. attach a resource disk to the VM.
|
||||
|
||||
- `temp_resource_group_name` (string) name assigned to the temporary resource group created during the build. If this value is not set, a random
|
||||
value will be assigned. Cannot be used together with `build_resource_group_name`.
|
||||
- `temp_resource_group_name` (string) name assigned to the temporary resource group created during the build. If this
|
||||
value is not set, a random value will be assigned. This resource group is deleted at the end of the build. Cannot be
|
||||
used together with `build_resource_group_name`.
|
||||
|
||||
- `tenant_id` (string) The account identifier with which your `client_id` and `subscription_id` are associated. If not
|
||||
specified, `tenant_id` will be looked up using `subscription_id`.
|
||||
|
|
Loading…
Reference in New Issue