I decompiled json file to bicep file using VS Code. After the decompilation, I am getting the following error:
The expression is involved in a cycle ("virtualNetworks_VNET_DEV_name_SNET_APPDEV01" -> "virtualNetworks_VNET_DEV_name_resource").bicep(BCP080)
Please help me resolve the issue.
Thanks in advance.
Refer Github issue for the similar error "Expression involved in a cycle" while decompiling from
JSON
toBicep
.This error comes when a bicep compiler finds that a parameter or resource is pointing out itself.
To correct it, remove the reference to a resource that is referring itself, as there is no need to do so.
Two ways to remove the error:
resourceId()
to reference the corresponding symbolic resource and access the resource Id property which is detailed in the given MS Doc.Here I tried to decompile a sample template into
Bicep
fromJson
. TheresourcedId
function is used in theJSON
code to access theId
, as showed.After decompilation, it was changed to
nsg.id
and no error was thrown. It fails to operate properly in every case, and you had the same problem. That is why I recommended you use one of the ways I described above.