Skip to content

fix(dns_record): unify dynamic flags type in list data source - #7088

Open
SAY-5 wants to merge 1 commit into
cloudflare:mainfrom
SAY-5:fix/dns-records-datasource-7004
Open

fix(dns_record): unify dynamic flags type in list data source#7088
SAY-5 wants to merge 1 commit into
cloudflare:mainfrom
SAY-5:fix/dns-records-datasource-7004

Conversation

@SAY-5

@SAY-5 SAY-5 commented May 3, 2026

Copy link
Copy Markdown

Closes #7004.

The cloudflare_dns_records data source crashed when a zone contained both an A record and a CAA record. CAA records carry a numeric data.flags while A records omit the field, which decoded as a typeless dynamic null. Terraform's list serialiser requires every list element to share a single concrete type, so the differing per-record flags types produced inconsistent list element types (... "flags":cty.DynamicPseudoType ...) then (... "flags":cty.Number ...) and aborted the read.

Normalise the dynamic flags after page accumulation: when any sibling exposes a concrete underlying type (Float64 or String, the subtypes already permitted by the schema validator), rewrap typeless null elements as a typed null of the same type so the resulting list has a uniform element type.

The fix is scoped to the list data source's Read path; resource and singular data source code paths are untouched. Existing dns_record schema/unit tests pass.

Records returned by the dns_records data source can have differing concrete
underlying types for data.flags (CAA records carry a number while A records
omit the field and decode as a typeless dynamic null). Terraform's list
serialiser requires a uniform element type, so the differing per-record
types crashed the provider with 'inconsistent list element types'.

Normalise the dynamic flags so every element exposes the same underlying
type before constructing the list.

Closes cloudflare#7004

Signed-off-by: SAY-5 <saiasish.cnp@gmail.com>
@SAY-5
SAY-5 requested a review from a team as a code owner May 3, 2026 06:25
@SAY-5
SAY-5 force-pushed the fix/dns-records-datasource-7004 branch from 23ba1ad to cb7889b Compare May 31, 2026 02:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cloudflare_dns_records datasource causes panic

2 participants