Skip to content

Commit

Permalink
Merge pull request #2319 from nickysemenza/nicky/custom-cert-no-geo
Browse files Browse the repository at this point in the history
when geo_restrictions aren't set, set as nil and not empty string
  • Loading branch information
jacobbednarz authored Mar 24, 2023
2 parents 1164aca + e1a65cc commit cc59935
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .changelog/2319.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
resource/cloudflare_custom_ssl: fix json sent to API when geo_restrictions are not used
```
8 changes: 6 additions & 2 deletions internal/sdkv2provider/resource_cloudflare_custom_ssl.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,12 @@ func expandToZoneCustomSSLOptions(ctx context.Context, d *schema.ResourceData) (
for id, value := range cert.(map[string]interface{}) {
var newValue interface{}
if id == "geo_restrictions" {
newValue = cloudflare.ZoneCustomSSLGeoRestrictions{
Label: value.(string),
if value == "" {
newValue = nil
} else {
newValue = cloudflare.ZoneCustomSSLGeoRestrictions{
Label: value.(string),
}
}
} else {
newValue = value.(string)
Expand Down

0 comments on commit cc59935

Please sign in to comment.