Skip to content

Unable to maintain TXT & MX record via terraform #19

@snigdhasjg

Description

@snigdhasjg

Describe the bug
Terraform throws error for TXT & MX records. Although I can see records are getting added. But even after adding it is throwing error.
And for me, no other duplicate record exists for this domain. I tried deleting and adding it again via terraform but same error.

To Reproduce

terraform {
  required_providers {
    hostinger = {
      source = "hostinger/hostinger"
      version = "~> 0.1.20"
    }
  }
}

provider "hostinger" {
  api_token = "<secret-key-here>"
}

resource "hostinger_dns_record" "dmarc" {
  zone  = "example.com"
  type  = "TXT"
  name  = "_dmarc"
  value = "v=DMARC1;p=quarantine;pct=0;rua=mailto:[email protected]"
  ttl   = 60
}

resource "hostinger_dns_record" "mail_from_mx" {
  zone  = "example.com"
  type  = "MX"
  name  = aws_ses_domain_mail_from.mail_from.mail_from_domain
  value = "10 feedback-smtp.us-east-1.amazonses.com"
  ttl   = 60
}

Expected behavior
Should be able to create record.

Additional context
I tried the same with both TXT & MX record, together and one at a time. Although A & CNAME records are working fine. I'm guessing something has to do with TXT and MX record.
TF Provider version: 0.1.20

Error
with export TF_LOG="DEBUG" I got this log

This is when I was only applying DMARC TXT record

2026-01-27T00:40:40.396+0800 [DEBUG] State storage *remote.State declined to persist a state snapshot
2026-01-27T00:40:40.397+0800 [ERROR] vertex "hostinger_dns_record.dmarc" error: Provider produced inconsistent result after apply
2026-01-27T00:40:40.397+0800 [DEBUG] states/remote: state read serial is: 6; serial is: 6
2026-01-27T00:40:40.397+0800 [DEBUG] states/remote: state read lineage is: a0b36d9f-2c39-b5d7-bad5-4f6afe4ad6d5; lineage is: a0b36d9f-2c39-b5d7-bad5-4f6afe4ad6d5
╷
│ Error: Provider produced inconsistent result after apply
│ 
│ When applying changes to hostinger_dns_record.dmarc, provider "provider[\"registry.terraform.io/hostinger/hostinger\"]" produced an unexpected new value: Root object was present, but now absent.
│ 
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.2026-01-27T00:40:40.398+0800 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF"
2026-01-27T00:40:40.399+0800 [INFO]  provider: plugin process exited: plugin=.terraform/providers/registry.terraform.io/hostinger/hostinger/0.1.20/linux_amd64/terraform-provider-hostinger_v0.1.20 id=30746
2026-01-27T00:40:40.399+0800 [DEBUG] provider: plugin exited

This is when I was only applying MX record

2026-01-27T00:49:21.014+0800 [INFO]  Starting apply for hostinger_dns_record.mail_from_mx
2026-01-27T00:49:21.014+0800 [DEBUG] hostinger_dns_record.mail_from_mx: applying the planned Create change
2026-01-27T00:49:22.455+0800 [DEBUG] State storage *remote.State declined to persist a state snapshot
2026-01-27T00:49:22.455+0800 [ERROR] vertex "hostinger_dns_record.mail_from_mx" error: Provider produced inconsistent result after apply
2026-01-27T00:49:22.455+0800 [DEBUG] states/remote: state read serial is: 6; serial is: 6
2026-01-27T00:49:22.455+0800 [DEBUG] states/remote: state read lineage is: a0b36d9f-2c39-b5d7-bad5-4f6afe4ad6d5; lineage is: a0b36d9f-2c39-b5d7-bad5-4f6afe4ad6d5
╷
│ Error: Provider produced inconsistent result after apply
│ 
│ When applying changes to hostinger_dns_record.mail_from_mx, provider "provider[\"registry.terraform.io/hostinger/hostinger\"]" produced an unexpected new value: Root object was present, but now absent.
│ 
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.2026-01-27T00:49:22.456+0800 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF"
2026-01-27T00:49:22.457+0800 [INFO]  provider: plugin process exited: plugin=.terraform/providers/registry.terraform.io/hostinger/hostinger/0.1.20/linux_amd64/terraform-provider-hostinger_v0.1.20 id=32908
2026-01-27T00:49:22.457+0800 [DEBUG] provider: plugin exited

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions