Terraform azure cdn module method not able to create the cdn with variable

Terraform azure cdn module method not able to create the cdn which we are able to create using resources but when we try to make it a module type we are getting issues like “name is unexpected here”
resources code
main.tf
terraform {
required_providers {
azurerm = {
source = “hashicorp/azurerm”
version = “~>3.30.0”
}
}
}

provider “azurerm” {
features {}
}

data “azurerm_resource_group” “resourcegroup” {
name = var.rsgname
}

resource “azurerm_cdn_profile” “example” {
name = var.cdnprofilename
location = data.azurerm_resource_group.resourcegroup.location
resource_group_name = data.azurerm_resource_group.resourcegroup.name
sku = var.skuname
}

resource “azurerm_cdn_endpoint” “example” {
name = var.cdnendpointname
profile_name = azurerm_cdn_profile.example.name
location = data.azurerm_resource_group.resourcegroup.location
resource_group_name = data.azurerm_resource_group.resourcegroup.name

origin {
name = var.originname
host_name = var.hostname
}
tags = {
ENV = “example”
}
}
variable.tf
variable “rsgname” {
default = “”
}

variable “cdnprofilename” {
default = “”
}

variable “skuname” {
default = “Standard_Verizon”
}

variable “cdnendpointname” {
default = “cdn-endpoint-test”
}
variable “originname” {
default = “origin-cdn”
}

variable “hostname” {
default = “www.test.com
}

Module with source
main.tf
module “azurerm_cdn_profile” {
source = “…/azure-terraform-module”
cdnprofilename = “azure-frontdoor-test”
skuname = “Standard_Verizon”
originname = “test”
cdnendpointname = “cdn-test-endpoint”
rsgname = “dev-test-sg”
hostname = “www.test.com
}

please provide me the any solution on this
my outcome should be modules should also have variables and call the resources should create the cdn
we are not able to add the
name = " "
profile_name = " "
location = “”
resource_group_name= “” if we give this way in module we are getting “name is not expected here” or “profile_name is not expected here”