Skip to content

Commit

Permalink
Check network before creating volume (#86)
Browse files Browse the repository at this point in the history
  • Loading branch information
zulh-civo committed Sep 6, 2021
1 parent 37e3d50 commit 3fe8f23
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions civo/resource_volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ func resourceVolumeCreate(d *schema.ResourceData, m interface{}) error {
config.Region = currentRegion
}

_, err := apiClient.FindNetwork(config.NetworkID)
if err != nil {
return fmt.Errorf("[ERR] Unable to find network ID %q in %q region", config.NetworkID, config.Region)
}

volume, err := apiClient.NewVolume(config)
if err != nil {
return fmt.Errorf("[ERR] failed to create a new volume: %s", err)
Expand Down

0 comments on commit 3fe8f23

Please sign in to comment.