Gcp plan is giving error with count

terraform plan for below part of code is giving error for gcp.

rrdatas = [element(
    google_compute_instance.web.*.network_interface.0.access_config.0.nat_ip,
    count.index,
    
  )]

The error is:

 ./terraform1.0 plan
╷
│ Error: Reference to "count" in non-counted context
│ 
│   on main.tf line 73, in resource "google_dns_record_set" "a":
│   73:     count.index,
│ 
│ The "count" object can only be used in "module", "resource", and "data" blocks, and only when the "count"
│ argument is set.

Blockquote

Please suggest how to fix that

Hi @ukreddy-erwin,

The error indicates that the containing object is not using count, therefor count.index is not a valid reference in this context. Can you show the complete configuration block for google_dns_record_set.a?