Skip to content

Commit

Permalink
azurerm_dns_x_record: ignore case on target_resource_id
Browse files Browse the repository at this point in the history
In some case (at least for the cdn endpoint), the ID of target resource
read from API (which uses the API model of the target resource) doesn't match
the `target_resource_id` if it is imported via Terraform (which actually
uses the API model of the `azurerm_dns_x_record`) in casing.

Fixes: hashicorp#8191
  • Loading branch information
magodo committed Aug 24, 2020
1 parent c668f40 commit ef3a1ae
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 13 deletions.
11 changes: 6 additions & 5 deletions azurerm/internal/services/dns/dns_a_record_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package dns

import (
"fmt"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/suppress"
"net/http"
"time"

Expand Down Expand Up @@ -68,12 +69,12 @@ func resourceArmDnsARecord() *schema.Resource {
},

"target_resource_id": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: azure.ValidateResourceID,
ConflictsWith: []string{"records"},

Type: schema.TypeString,
Optional: true,
ValidateFunc: azure.ValidateResourceID,
// TODO: switch ConflictsWith for ExactlyOneOf when the Provider SDK's updated
ConflictsWith: []string{"records"},
DiffSuppressFunc: suppress.CaseDifference,
},

"tags": tags.Schema(),
Expand Down
10 changes: 6 additions & 4 deletions azurerm/internal/services/dns/dns_aaaa_record_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package dns

import (
"fmt"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/suppress"
"net/http"
"time"

Expand Down Expand Up @@ -75,10 +76,11 @@ func resourceArmDnsAAAARecord() *schema.Resource {
"tags": tags.Schema(),

"target_resource_id": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: azure.ValidateResourceID,
ConflictsWith: []string{"records"},
Type: schema.TypeString,
Optional: true,
ValidateFunc: azure.ValidateResourceID,
ConflictsWith: []string{"records"},
DiffSuppressFunc: suppress.CaseDifference,
},
},
}
Expand Down
10 changes: 6 additions & 4 deletions azurerm/internal/services/dns/dns_cname_record_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package dns

import (
"fmt"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/suppress"
"net/http"
"time"

Expand Down Expand Up @@ -67,10 +68,11 @@ func resourceArmDnsCNameRecord() *schema.Resource {
},

"target_resource_id": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: azure.ValidateResourceID,
ConflictsWith: []string{"record"},
Type: schema.TypeString,
Optional: true,
ValidateFunc: azure.ValidateResourceID,
ConflictsWith: []string{"record"},
DiffSuppressFunc: suppress.CaseDifference,
},

"tags": tags.Schema(),
Expand Down

0 comments on commit ef3a1ae

Please sign in to comment.