Skip to content

scaleway_domain_record: FQDN vs relative name causes forced replacement #3407

@jremy42

Description

@jremy42

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version

Terraform v1.5.0+
Provider version: scaleway/scaleway v2.x

Affected Resource(s)

  • scaleway_domain_record
  • scaleway_tem_domain

Terraform Configuration Files

data "scaleway_domain_zone" "root" {
  domain = "example.com"
}

resource "scaleway_tem_domain" "this" {
  name       = data.scaleway_domain_zone.root.domain
  accept_tos = true
}

resource "scaleway_domain_record" "dmarc" {
  dns_zone = data.scaleway_domain_zone.root.domain
  name     = scaleway_tem_domain.this.dmarc_name
  type     = "TXT"
  data     = scaleway_tem_domain.this.dmarc_config
}

Debug Output

N/A - This is a state/diff issue, not a crash.

Panic Output

N/A

Expected Behavior

When using scaleway_tem_domain.this.dmarc_name or scaleway_tem_domain.this.dkim_name as the name attribute in scaleway_domain_record, Terraform should not detect any changes on subsequent plans and should not force resource replacement.

Actual Behavior

Terraform detects a change in the name attribute and forces a replacement of the DNS record:

scaleway_domain_record.dmarc must be replaced
-/+ resource "scaleway_domain_record" "dmarc" {
    ~ fqdn       = "_dmarc.example.com" -> (known after apply)
    ~ id         = "1d824d80-6835-4862-9aa4-168a3ec0275b" -> (known after apply)
    ~ name       = "_dmarc" -> "_dmarc.example.com."  # forces replacement
    ~ priority   = 0 -> (known after apply)
    ~ project_id = "41b5c043-ce43-4431-a671-8ce6774d61ff" -> (known after apply)
    ~ root_zone  = true -> (known after apply)
    # (4 unchanged attributes hidden)
}

Applying this leads to the Terraform state being removed, the actual record is not removed though and an error is returned. Creating the record is included in all consequent Terraform plans but application results in the same error.

Steps to Reproduce

  1. Create a scaleway_tem_domain resource
  2. Create a scaleway_domain_record using scaleway_tem_domain.this.dmarc_name as the name attribute
  3. terraform apply (succeeds)
  4. terraform plan (shows unwanted replacement)

Important Factoids

The scaleway_tem_domain resource returns FQDN values for dmarc_name and dkim_name attributes (e.g., _dmarc.example.com. with trailing dot), while scaleway_domain_record expects relative names (e.g., _dmarc without the domain suffix). This mismatch triggers forced replacement since name is marked as ForceNew: true.

A DiffSuppressFunc should be added to normalize both FQDN and relative name formats for comparison.

References

  • Affects TEM service integration with Domain DNS management
  • Same issue occurs with dkim_name attribute

Metadata

Metadata

Assignees

Labels

domainDomains issues, bugs and feature requeststemTransactional Email issues, bugs and feature requests

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions