dnsimple / terraform-provider-dnsimple

Terraform DNSimple provider.
https://www.terraform.io/docs/providers/dnsimple/
Mozilla Public License 2.0
22 stars 20 forks source link

Add detailed validation errors #59

Closed nestorsalceda closed 2 years ago

nestorsalceda commented 2 years ago

Validation errors are exposed in Dnsimple-go client in main version, we use these errors to provide the Terraform user a better experience giving them more information about which field caused the error:

❯ terraform apply                                                                                                                                                                                                                                                                                      
dnsimple_zone_record.test-txt: Refreshing state... [id=2810984]                                                                                                                                                                                                                                        

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:                                                                                                                                                             
  + create                                                                                                                                                                                                                                                                                             

Terraform will perform the following actions:                                                                                                                                                                                                                                                          

  # dnsimple_zone_record.test-a will be created                                                                                                                                                                                                                                                        
  + resource "dnsimple_zone_record" "test-a" {                                                                                                                                                                                                                                                         
      + id             = (known after apply)                                                                                                                                                                                                                                                           
      + name           = "a-record"                                                                                                                                                                                                                                                                    
      + priority       = (known after apply)                                                                                                                                                                                                                                                           
      + qualified_name = (known after apply)                                                                                                                                                                                                                                                           
      + ttl            = "3600"                                                                                                                                                                                                                                                                        
      + type           = "AAAA"                                                                                                                                                                                                                                                                        
      + value          = "192.168.10.1"                                                                                                                                                                                                                                                                
      + zone_id        = (known after apply)                                                                                                                                                                                                                                                           
      + zone_name      = "testforterraformandnestor.com"                                                                                                                                                                                                                                               
    }                                                                                                                                                                                                                                                                                                  

Plan: 1 to add, 0 to change, 0 to destroy.                                                                                                                                                                                                                                                             

Do you want to perform these actions?                                                                                                                                                                                                                                                                  
  Terraform will perform the actions described above.                                                                                                                                                                                                                                                  
  Only 'yes' will be accepted to approve.                                                                                                                                                                                                                                                              

  Enter a value: yes                                                                                                                                                                                                                                                                                   

dnsimple_zone_record.test-a: Creating...                                                                                                                                                                                                                                                               
╷                                                                                                                                                                                                                                                                                                      
│ Error: API returned a Validation Error for: value                                                                                                                                                                                                                                                    
│                                                                                                                                                                                                                                                                                                      
│   with dnsimple_zone_record.test-a,                                                                                                                                                                                                                                                                  
│   on simple.tf line 34, in resource "dnsimple_zone_record" "test-a":                                                                                                                                                                                                                                 
│   34:     value  = "192.168.10.1"                                                                                                                                                                                                                                                                    
│                                                                                                                                                                                                                                                                                                      
│ is an invalid IPv6 address    
nestorsalceda commented 2 years ago

This is blocked until having a release of the DNSimple-Go client