Skip to content
This repository has been archived by the owner on Jul 27, 2023. It is now read-only.

Commit

Permalink
pullzone: make origin_url & storage_zone_id mutually exclusive
Browse files Browse the repository at this point in the history
The docs say that on creation of a PZ an OriginURL is required and a StorageZoneId is optional. 
However, the reality is that ONE of the TWO are required. You must either specify a OriginURL OR a StorageZoneID. Furthermore, passing BOTH results in OriginURL being entirely ignored (StorageZoneID is preferred).
(simplesurance/bunny-go#19 (comment))
  • Loading branch information
jspizziri authored Jun 7, 2022
1 parent d36d96d commit febc2e6
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions internal/provider/resource_pullzone.go
Original file line number Diff line number Diff line change
Expand Up @@ -355,9 +355,10 @@ func resourcePullZone() *schema.Resource {
),
},
keyOriginURL: {
Type: schema.TypeString,
Required: true,
Description: "The origin URL of the Pull Zone where the files are fetched from.",
Type: schema.TypeString,
Optional: true,
Description: "The origin URL of the Pull Zone where the files are fetched from.",
ExactlyOneOf: []string{keyStorageZoneID},
},
keyPermaCacheStorageZoneID: {
Type: schema.TypeInt,
Expand Down Expand Up @@ -427,10 +428,11 @@ func resourcePullZone() *schema.Resource {
Description: "The name of the Pull Zone.",
},
keyStorageZoneID: {
Type: schema.TypeInt,
Optional: true,
ForceNew: true,
Description: "The ID of the storage zone that the Pull Zone is linked to.",
Type: schema.TypeInt,
Optional: true,
ForceNew: true,
Description: "The ID of the storage zone that the Pull Zone is linked to.",
ExactlyOneOf: []string{keyOriginURL},
},
keyZoneSecurityKey: {
Type: schema.TypeString,
Expand Down

0 comments on commit febc2e6

Please sign in to comment.