Commit Graph

3 Commits

Author SHA1 Message Date
Jake Champlin 179aa62ad4
provider/cloudflare: Fix record validation
Previously we only validated that the cloudflare record provided was a valid record type. However, a record can be of a valid type, and still not be proxied, making it an invalid record type.

The main downside to having to check for whether or not the record type is proxied or not during validation, is that it relies on having two schema keys populated. This means that we can only catch the improper record type during `apply` time, instead of `plan` time.

```
$ go test -v -run "TestValidateRecordType" ./builtin/providers/cloudflare
=== RUN   TestValidateRecordType
--- PASS: TestValidateRecordType (0.00s)
PASS
ok      github.com/hashicorp/terraform/builtin/providers/cloudflare     0.004s
```
2017-02-15 21:52:04 -05:00
Jake Champlin 6a31ed5ee8
Use a better format in error output 2017-01-13 15:43:47 -05:00
Jake Champlin 8ac7f53c33
provider/cloudflare: Add validation for record types and record content
Adds a validation function for cloudflare record types. Also adds an apply-time validation for the record's content based on record type. Currently only validating `A` and `AAAA` records, can be expanded to verify record content for every possible record type in the future.

```
$ make test TEST=./builtin/providers/cloudflare
==> Checking that code complies with gofmt requirements...
==> Checking AWS provider for unchecked errors...
==> NOTE: at this time we only look for uncheck errors in the AWS package
==> Installing errcheck...
go generate $(go list ./... | grep -v /terraform/vendor/)
2017/01/13 14:41:37 Generated command/internal_plugin_list.go
TF_ACC= go test ./builtin/providers/cloudflare  -timeout=30s -parallel=4
ok      github.com/hashicorp/terraform/builtin/providers/cloudflare     0.018s
```

Fixes: #11173
2017-01-13 14:42:13 -05:00