Merge pull request #2861 from hashicorp/b-azure-instance-error

provider/azure: Provide a simpler error when using a Platform Image without a Storage Service
This commit is contained in:
Clint 2015-07-30 09:28:33 -05:00
commit 26b416335f
4 changed files with 13 additions and 4 deletions

View File

@ -0,0 +1,5 @@
package azure
import "errors"
var PlatformStorageError = errors.New("When using a platform image, the 'storage' parameter is required")

View File

@ -591,6 +591,10 @@ func retrieveImageDetails(
return configureForImage, osType, nil
}
if err == PlatformStorageError {
return nil, "", err
}
return nil, "", fmt.Errorf("Could not find image with label '%s'. Available images are: %s",
label, strings.Join(append(VMLabels, OSLabels...), ", "))
}
@ -646,8 +650,7 @@ func retrieveOSImageDetails(
}
if img.MediaLink == "" {
if storage == "" {
return nil, "", nil,
fmt.Errorf("When using a platform image, the 'storage' parameter is required")
return nil, "", nil, PlatformStorageError
}
img.MediaLink = fmt.Sprintf(osDiskBlobStorageURL, storage, name)
}

View File

@ -72,7 +72,8 @@ The following arguments are supported:
* `storage_service_name` - (Optional) The name of an existing storage account
within the subscription which will be used to store the VHDs of this
instance. Changing this forces a new resource to be created.
instance. Changing this forces a new resource to be created. **A Storage
Service is required if you are using a Platform Image**
* `reverse_dns` - (Optional) The DNS address to which the IP address of the
hosted service resolves when queried using a reverse DNS query. Changing

View File

@ -26,7 +26,7 @@ resource "azure_storage_service" "tfstor" {
The following arguments are supported:
* `name` - (Required) The name of the storage service. Must be between 4 and 24
lowercase-only characters or digits Must be unique on Azure.
lowercase-only characters or digits. Must be unique on Azure.
* `location` - (Required) The location where the storage service should be created.
For a list of all Azure locations, please consult [this link](http://azure.microsoft.com/en-us/regions/).