# Deploy using Terraform




## Overview

F5 NGINXaaS for Azure (NGINXaaS) deployments can be managed using Terraform. This document outlines common Terraform workflows for NGINXaaS.

## Prerequisites

- Confirm that you meet the [NGINXaaS Prerequisites](/nginxaas-azure/getting-started/prerequisites.md).
- [Authenticate Terraform to Azure](https://learn.microsoft.com/en-us/azure/developer/terraform/authenticate-to-azure)
- [Install Terraform](https://learn.hashicorp.com/tutorials/terraform/install)

**Note:**  The examples in the NGINXaaS for Azure Snippets GitHub repository use the prerequisites module [available in the same repository](https://github.com/nginxinc/nginxaas-for-azure-snippets/tree/main/terraform/prerequisites).

**Note:** **System-Assigned Managed Identity Required**: Ensure your Terraform configuration includes the required system-assigned managed identity by setting `identity.type = "SystemAssigned"` or `"SystemAssigned, UserAssigned"` for each deployment.

## Create a deployment

You can find examples of Terraform configurations in the [NGINXaaS for Azure Snippets GitHub repository](https://github.com/nginxinc/nginxaas-for-azure-snippets/tree/main/terraform/deployments/create-or-update)

To create a deployment, use the following Terraform commands:

   ```shell
   terraform init
   terraform plan
   terraform apply --auto-approve
   ```

## Delete a deployment

Once the deployment is no longer needed, run the following to clean up the deployment and related resources:

   ```shell
   terraform destroy --auto-approve
   ```

## Additional resources

- If you're just starting with Terraform, you can learn more on their [official website](https://www.terraform.io/).
- [Terraform NGINX deployment documentation](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/nginx_deployment)

- [NGINXaaS Managed Identity Documentation](/nginxaas-azure/getting-started/managed-identity-portal.md)
- [NGINXaaS Azure Monitor Documentation](/nginxaas-azure/monitoring/enable-metrics.md)

