Azure APIM - add AAD groups to multiple products

Getting this error message when deploying products and assigning the same AAD group to multiple Products. Seems the first one goes fine and on the second call to the module it says the object already exist. Please see the code below after the error message:

Error: A resource with the ID "/subscriptions/mysubid/resourceGroups/myrg/providers/Microsoft.ApiManagement/service
/myapimname/groups/myaadgroup" already exists - to be managed via Terraform this resource needs to be imported into the State. Please see the resource
 documentation for "azurerm_api_management_group" for more information.

  on ../mpp/bu-group.tf line 1, in resource "azurerm_api_management_group" "external_group":
   1: resource "azurerm_api_management_group" "external_group" {



##[error]Terraform command 'apply' failed with exit code '1'.:  A resource with the ID "/subscriptions/mysubid/resourceGroups/myrg
/providers/Microsoft.ApiManagement/service/myapimname/groups/myaadgroup" already exists - to be managed via Terraform this resource needs to be imported into the 
State. Please see the resource documentation for "azurerm_api_management_group" for more information.
Finishing: TerraformCLI

===============
locals {
env = terraform.workspace

dev = {
product1 = {
product_name = “Product-1”
approval_required = true
published = true
subscriptions_limit = “2”
aad_group_obj_id = “00000000-0000-0000-0000-000000000000”
aad_group_name = “AG-Azure-Sample-Group”
product_policy = “…/policy-samples/base-policy.xml”
}
product2 = {
product_name = “Product-2”
approval_required = true
published = true
subscriptions_limit = “2”
aad_group_obj_id = “00000000-0000-0000-0000-000000000000”
aad_group_name = “AG-Azure-Sample-Group”
product_policy = “…/policy-samples/base-policy.xml”
}
}}

======main.tf==================================================================

module “product-provision” {
source = “…/module-product-provision”
for_each = local.product_map

resource_group_name = local.resource_group_name
api_management_name = local.api_management_name

product_name = each.value.product_name
approval_required = each.value.approval_required
published = each.value.published
subscriptions_limit = each.value.subscriptions_limit
aad_group_obj_id = each.value.aad_group_obj_id
aad_group_name = each.value.aad_group_name
product_policy_file_path = each.value.product_policy
}

=======…/module-product-provision=================================================================

Product for BU APIs

resource “azurerm_api_management_product” “custom_product” {
product_id = var.product_name
api_management_name = var.api_management_name
resource_group_name = var.resource_group_name
display_name = replace(var.product_name, “-”, " ")

Require subscription keys for API access

subscription_required = true
approval_required = var.approval_required
published = var.published
subscriptions_limit = var.subscriptions_limit
}

Relate group to a product, for each is if we want to use developer or guest built in groups

resource “azurerm_api_management_product_group” “assignments” {
for_each = toset([azurerm_api_management_group.external_group.name])
product_id = azurerm_api_management_product.custom_product.product_id
group_name = each.key
api_management_name = var.api_management_name
resource_group_name = var.resource_group_name
}

Create default policy for Product

resource “azurerm_api_management_product_policy” “apim-product-policy” {
product_id = azurerm_api_management_product.custom_product.product_id
api_management_name = var.api_management_name
resource_group_name = var.resource_group_name
xml_content = file(var.product_policy_file_path)
}

Assign AAD groups to Product

resource “azurerm_api_management_group” “external_group” {
name = var.aad_group_name
resource_group_name = var.resource_group_name
api_management_name = var.api_management_name
display_name = var.aad_group_name
description = “This group is link to AAD group {var.aad_group_name}" external_id = "aad://my tenant ID/groups/{var.aad_group_obj_id}”
type = “external”
}