In this code, we indicate that the provider we are using is azurerm and that the authentication information to Azure is the service principal created. However, for security reasons, it is not advisable to put identification information in code, knowing that this code may be accessible by other people.
We will, therefore, improve the previous code by replacing it with this one:
provider "azurerm" {}
So, we delete the credentials in the Terraform code and we will pass the identification values to specific Terraform environment variables:
ARM_SUBSCRIPTION_ID
ARM_CLIENT_ID
ARM_CLIENT_SECRET
ARM_TENANT_ID
We will see how to set these environment variables later in this chapter, in the Deploy the infrastructure section.
As a result, the Terraform code no longer contains any identification information.
We have just seen how to configure Terraform for Azure authentication. We will now explain how to quickly configure Terraform to perform local development and testing.