Can you check, if the service principle has got enough permissions in the subscription, you are in? Provide maximum possible privilages and have a try to test it first
Terraform script that runs in Cloud Shell overwrites the ARM_SUBSCRIPTION_ID and ARM_TENANT_ID environment variables using values from the current Azure subscription. As a result, if the service principal referenced by the environment variables doesn't have rights to the current Azure subscription, any Terraform operations will fail
----------
--please don't forget to upvote
and Accept as answer
if the reply is helpful--