Lifecycle argument is not taken for my azure resource

Hi, I am trying the below script and I get error as

Plan Error
Error: Unsupported argument

  on resource__demos_development_2.tf line 18, in resource "azurerm_resource_group" "rg-02":
  18:   lifecycle = {

An argument named "lifecycle" is not expected here.

Can someone please tell me whats wrong here??

`resource "azurerm_resource_group" "rg-synapse_demo" {

  name     = "rg-${local.workloadId}-${module.project_vars.environment}-${local.instance_id}"

  location = module.project_vars.location

  lifecycle = {

    prevent_destroy = true,

    ignore_changes  = ["name", "location", "environment"]

  }

  tags = {

    environment = "${module.project_vars.environment}",

    team        = "product specialists",

    demoName    = "${local.workloadId}"

  }

}`