Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

provider/azure: Provide a simpler error when using a Platform Image without a Storage Service #2861

Merged
merged 3 commits into from
Jul 30, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions builtin/providers/azure/errors.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package azure

import "errors"

var PlatformStorageError = errors.New("When using a platform image, the 'storage' parameter is required")
7 changes: 5 additions & 2 deletions builtin/providers/azure/resource_azure_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -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...), ", "))
}
Expand Down Expand Up @@ -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)
}
Expand Down
3 changes: 2 additions & 1 deletion website/source/docs/providers/azure/r/instance.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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/).
Expand Down