Help with output in Lightsail to reuse static ip records

I’m creating a few sites in lightsail (no judgement) through a module. Here is the relevant piece of main.tf in the module:

#main.tf
resource "aws_lightsail_static_ip_attachment" "site-public-ip-attachment" {
  static_ip_name = aws_lightsail_static_ip.site-static-ip.id
  instance_name  = aws_lightsail_instance.lightsail-instance.id
}

resource "aws_lightsail_static_ip" "site-static-ip" {
  name = "${var.sitename}-ip"
}

resource "aws_lightsail_instance" "lightsail-instance" {
  name              = var.sitename
  availability_zone = var.availability_zone
  blueprint_id      = var.blueprint_id
  bundle_id         = var.bundle_id
  user_data         = "${path.module}/initscript.sh"
  key_pair_name     = aws_lightsail_key_pair.site-keypair-lightsail.id
  tags = merge(
    local.common_tags,
    {
      "Name" = "${var.sitename}" 
    },
  )
}

#outputs.tf
output "lightsail-dns-ip" {
  value = aws_lightsail_static_ip.site-static-ip.ip_address
}

I am trying to grab the static ip_address and the name to use it in a Cloudflare module to create the A records. When I output like the output.tf file above shows, it gives me this output:

  "lightsail" = {
    "lightsail-site" = {
      "siteA" = {
        "lightsail-dns-ip" = "52.10.24.125"
      }
      "siteB" = {
        "lightsail-dns-ip" = "52.89.201.14"
      }
    }
  }

My question is: how can I transform this output in the Cloudflare module via locals to create a map like this:

{
  "siteA" = "52.10.24.125"
  "siteB" =  "52.89.201.14"
}

I tried changing the output to look like this:

output "lightsail-dns-ip" {
  value = {
    for record in aws_lightsail_static_ip.site-static-ip: 
      record.name => record.ip_address
  }
}

But it produced this primitive error:

│ Error: Unsupported attribute
│
│   on ../../modules/infrastructure/modules/lightsail/modules/lightsail-site/outputs.tf line 4, in output "lightsail-dns-ip":
│    4:       record.name => record.ip_address
│
│ Can't access attributes on a primitive-typed value (string).

I appreciate any help!