Skip to content

Commit

Permalink
adds validation to only allow valid DNS record types
Browse files Browse the repository at this point in the history
  • Loading branch information
joel-g committed Mar 4, 2020
1 parent a58cec0 commit a820a89
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions cloudflare/resource_cloudflare_record.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (

cloudflare "github.com/cloudflare/cloudflare-go"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/helper/validation"
)

func resourceCloudflareRecord() *schema.Resource {
Expand Down Expand Up @@ -45,9 +46,10 @@ func resourceCloudflareRecord() *schema.Resource {
},

"type": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
Type: schema.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validation.StringInSlice([]string{"A", "AAAA", "CNAME", "TXT", "SRV", "LOC", "MX", "NS", "SPF", "CERT", "DNSKEY", "DS", "NAPTR", "SMIMEA", "SSHFP", "TLSA", "URI"}, false),
},

"value": {
Expand Down

0 comments on commit a820a89

Please sign in to comment.