mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-25 18:45:20 -06:00
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:
commit
26b416335f
5
builtin/providers/azure/errors.go
Normal file
5
builtin/providers/azure/errors.go
Normal file
@ -0,0 +1,5 @@
|
||||
package azure
|
||||
|
||||
import "errors"
|
||||
|
||||
var PlatformStorageError = errors.New("When using a platform image, the 'storage' parameter is required")
|
@ -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)
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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/).
|
||||
|
Loading…
Reference in New Issue
Block a user