Terraform Azure Provider Overview
The officially supported Nitric Terraform Azure Provider.
provider: nitric/azuretf@latest
The Nitric Terraform Azure Provider is currently in preview, it's not recommended for production deployments. We recommend using the Pulumi Azure Providers for production deployments until the Terraform provider is stable.
Prerequisites
The Terraform CLI is required to deploy the resulting Terraform Stack that Nitric generates. You can find the installation instructions for Terraform in the Terraform documentation.
The provider is built with the Cloud Development Kit for Terraform (CDKTF). Since CDKTF relies on Node.js, you'll need to have Node.js installed, you can read about the full CDKTF prerequisites in the CDKTF documentation.
Enabling Nitric Terraform Providers
The Nitric Terraform providers are currently in preview, to enable them you'll need to enable beta-providers
in your Nitric project. You can do this by adding the following to your project's nitric.yaml
file:
preview:- beta-providers
Azure Credentials
The Terraform CLI typically uses standard Azure credential settings to authenticate with Azure. If you've set credentials for the Azure CLI or an Azure SDK previously, these settings should work without modification.
If you're setting up your credentials for the first time, simply run azure login command and finish the login via your browser.
az login
Verify the Azure CLI install -
az -v
See Azure documentation for full details on credentials and configuration.
Azure CLI Installation
Installing the Azure CLI assists with credentials setup. You can install it using these summarized instructions, for more options see the Microsoft docs.
Download & install the Azure CLI.
Locating deployed resources
This Nitric Azure provider deploys resources for a stack into a resource group dedicated to that stack. You can either use one that you already have by configuring it in the stack configuration or let Nitric create one for you.
Once a stack has been deployed to Azure it's resource group should be present in the Resource groups page of the portal. Assuming it was deployed to a subscription you have access to.
Resource groups are conventionally named <project-name>-<stack-name>-<randomId>
In this example the project name is api-testing
and the stack name is az
.
Stack Configuration
# The provider to use and its published version# See releases:# https://github.com/nitrictech/nitric/tagsprovider: nitric/azuretf@latest# The target Azure region to deploy to# See available regions:# https://azure.microsoft.com/en-us/explore/global-infrastructure/products-by-region/?products=container-appsregion: my-azure-stack-region# Org to associate deployed API Management services withorg: example-org# Admin email to associate deployed API Management services withadminemail: test@example.com# Subscription ID to associate deployed services withsubscription-id: example-subscription-id