Merge pull request #2777 from dwradcliffe/dnsimple_force_new
provider/dnsimple: domain and type should force new records
This commit is contained in:
commit
efaf63969c
|
@ -19,6 +19,7 @@ func resourceDNSimpleRecord() *schema.Resource {
|
|||
"domain": &schema.Schema{
|
||||
Type: schema.TypeString,
|
||||
Required: true,
|
||||
ForceNew: true,
|
||||
},
|
||||
|
||||
"domain_id": &schema.Schema{
|
||||
|
@ -39,6 +40,7 @@ func resourceDNSimpleRecord() *schema.Resource {
|
|||
"type": &schema.Schema{
|
||||
Type: schema.TypeString,
|
||||
Required: true,
|
||||
ForceNew: true,
|
||||
},
|
||||
|
||||
"value": &schema.Schema{
|
||||
|
@ -74,12 +76,12 @@ func resourceDNSimpleRecordCreate(d *schema.ResourceData, meta interface{}) erro
|
|||
newRecord.Ttl = ttl.(string)
|
||||
}
|
||||
|
||||
log.Printf("[DEBUG] DNS Simple Record create configuration: %#v", newRecord)
|
||||
log.Printf("[DEBUG] DNSimple Record create configuration: %#v", newRecord)
|
||||
|
||||
recId, err := client.CreateRecord(d.Get("domain").(string), newRecord)
|
||||
|
||||
if err != nil {
|
||||
return fmt.Errorf("Failed to create DNS Simple Record: %s", err)
|
||||
return fmt.Errorf("Failed to create DNSimple Record: %s", err)
|
||||
}
|
||||
|
||||
d.SetId(recId)
|
||||
|
@ -93,7 +95,7 @@ func resourceDNSimpleRecordRead(d *schema.ResourceData, meta interface{}) error
|
|||
|
||||
rec, err := client.RetrieveRecord(d.Get("domain").(string), d.Id())
|
||||
if err != nil {
|
||||
return fmt.Errorf("Couldn't find DNS Simple Record: %s", err)
|
||||
return fmt.Errorf("Couldn't find DNSimple Record: %s", err)
|
||||
}
|
||||
|
||||
d.Set("domain_id", rec.StringDomainId())
|
||||
|
@ -133,11 +135,11 @@ func resourceDNSimpleRecordUpdate(d *schema.ResourceData, meta interface{}) erro
|
|||
updateRecord.Ttl = attr.(string)
|
||||
}
|
||||
|
||||
log.Printf("[DEBUG] DNS Simple Record update configuration: %#v", updateRecord)
|
||||
log.Printf("[DEBUG] DNSimple Record update configuration: %#v", updateRecord)
|
||||
|
||||
_, err := client.UpdateRecord(d.Get("domain").(string), d.Id(), updateRecord)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Failed to update DNS Simple Record: %s", err)
|
||||
return fmt.Errorf("Failed to update DNSimple Record: %s", err)
|
||||
}
|
||||
|
||||
return resourceDNSimpleRecordRead(d, meta)
|
||||
|
@ -146,12 +148,12 @@ func resourceDNSimpleRecordUpdate(d *schema.ResourceData, meta interface{}) erro
|
|||
func resourceDNSimpleRecordDelete(d *schema.ResourceData, meta interface{}) error {
|
||||
client := meta.(*dnsimple.Client)
|
||||
|
||||
log.Printf("[INFO] Deleting DNS Simple Record: %s, %s", d.Get("domain").(string), d.Id())
|
||||
log.Printf("[INFO] Deleting DNSimple Record: %s, %s", d.Get("domain").(string), d.Id())
|
||||
|
||||
err := client.DestroyRecord(d.Get("domain").(string), d.Id())
|
||||
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error deleting DNS Simple Record: %s", err)
|
||||
return fmt.Errorf("Error deleting DNSimple Record: %s", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
Loading…
Reference in New Issue