You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -17,7 +17,7 @@ Before deploying this solution, ensure you have the following tools installed:
17
17
18
18
### Installing azlocal CLI
19
19
20
-
The deployment script uses the `azlocal` CLI instead of the standard Azure CLI to work with LocalStack. Install it using:
20
+
The [deploy.sh](deploy.sh) Bash script uses the `azlocal` CLI instead of the standard Azure CLI to work with LocalStack. Install it using:
21
21
22
22
```bash
23
23
pip install azlocal
@@ -27,7 +27,7 @@ For more information, see [Get started with the az tool on LocalStack](https://a
27
27
28
28
## Architecture Overview
29
29
30
-
The Terraform modules deploy the following Azure resources:
30
+
The [main.tf](main.tf)Terraform module creates the following Azure resources:
31
31
32
32
1.[Azure Storage Account](https://learn.microsoft.com/en-us/azure/storage/common/storage-account-overview): Provides blob storage with `input` and `output` containers for storing text blobs processed by the function app.
33
33
2.[Azure App Service Plan](https://learn.microsoft.com/en-us/azure/app-service/overview-hosting-plans): Defines the compute resources (CPU, memory, and scaling options) that host the Azure Functions app.
@@ -37,281 +37,22 @@ The Terraform modules deploy the following Azure resources:
37
37
38
38
For more information on the sample application, see [Azure Functions App with Managed Identity](../README.md).
39
39
40
-
## Terraform Modules
41
-
42
-
Below is a summary of the key Terraform modules included in this deployment:
43
-
44
-
-**`main.tf`**: Defines all Azure resources and their configuration.
45
-
-**`variables.tf`**: Declares input variables and validation rules.
46
-
-**`outputs.tf`**: Specifies output values after deployment.
47
-
-**`providers.tf`**: Configures the Terraform provider for Azure.
48
-
49
-
Below you can read the declarative code in HashiCorp Configuration Language (HCL). The `main.tf` module uses conditional provisioning for the user-assigned managed identity and role assignments resources. In Terraform, you can use the `count` argument in a conditional expression to decide whether creating resources or not. For example, the `count = var.managed_identity_type == "UserAssigned" ? 1 : 0` expression instructs Terraform to create the user-assigned managed identity resource when the value of the variable named `managed_identity_type` is set to `UserAssigned`. Refer to [Conditional Expressions](https://developer.hashicorp.com/terraform/language/expressions/conditionals) for more information.
You can use the `deploy.sh` script to automate the deployment of all Azure resources and the sample application in a single step, streamlining setup and reducing manual configuration. Before running the script, customize the variable values based on your needs. In particular, use the `MANAGED_IDENTITY_TYPE` variable to specify the type of managed identity to provision: `SystemAssigned` or `UserAssigned`.
204
-
205
-
```bash
206
-
#!/bin/bash
207
-
208
-
# Variables
209
-
PREFIX='local'
210
-
SUFFIX='test'
211
-
LOCATION='westeurope'
212
-
MANAGED_IDENTITY_TYPE='UserAssigned'# SystemAssigned or UserAssigned
213
-
CURRENT_DIR="$(cd "$(dirname "$0")"&& pwd)"
214
-
ZIPFILE="function_app.zip"
215
-
ENVIRONMENT=$(az account show --query environmentName --output tsv)
216
-
217
-
# Change the current directory to the script's directory
218
-
cd"$CURRENT_DIR"||exit
219
-
220
-
# Run terraform init and apply
221
-
if [[ $ENVIRONMENT=="LocalStack" ]];then
222
-
echo"Using tflocal and azlocal for LocalStack emulator environment and ."
223
-
TERRAFORM="tflocal"
224
-
AZ="azlocal"
225
-
else
226
-
echo"Using standard terraform and az for AzureCloud environment."
echo"Failed to deploy function app [$FUNCTION_APP_NAME]."
294
-
exit 1
295
-
fi
296
-
297
-
# Remove the zip package of the function app
298
-
if [ -f"$ZIPFILE" ];then
299
-
rm "$ZIPFILE"
300
-
fi
301
-
```
42
+
The [deploy.sh](deploy.sh) script automates the deployment of all Azure resources and the sample application in a single step. Before running the script, customize the variable values based on your needs. In particular, use the `MANAGED_IDENTITY_TYPE` variable to specify the type of managed identity to provision: `SystemAssigned` or `UserAssigned`.
302
43
303
44
> **Note**
304
45
> You can use the `azlocal` CLI as a drop-in replacement for the `az` CLI to direct all commands to the LocalStack for Azure emulator. Alternatively, run `azlocal start_interception` to automatically intercept and redirect all `az` commands to LocalStack. Likewise, the `tflocal` is a local replacement for the standard `terraform` CLI, allowing you to run Terraform commands against LocalStack's Azure emulation environment. For more information, see [Get started with the az tool on LocalStack](https://azure.localstack.cloud/user-guides/sdks/az/).
305
46
306
-
The `deploy.sh` script executes the following steps:
47
+
The [deploy.sh](deploy.sh) script executes the following steps:
307
48
308
-
- Cleans up any previous Terraform state and plan files to ensure a fresh deployment.
309
-
- Initializes the Terraform working directory and downloads required plugins.
310
-
- Creates and validates a Terraform execution plan for the Azure infrastructure.
311
-
- Applies the Terraform plan to provision all necessary Azure resources.
312
-
- Extracts resource names and outputs from the Terraform deployment.
313
-
- Packages the code of the serverless application into a zip file for deployment.
314
-
- Deploys the zip package to the Azure Functions App using the LocalStack Azure CLI.
49
+
- Cleans up any previous Terraform state and plan files to ensure a fresh deployment
50
+
- Initializes the Terraform working directory and downloads required plugins
51
+
- Creates and validates a Terraform execution plan for the Azure infrastructure
52
+
- Applies the Terraform plan to provision all necessary Azure resources
53
+
- Extracts resource names and outputs from the Terraform deployment
54
+
- Packages the code of the serverless application into a zip file for deployment
55
+
- Deploys the zip package to the Azure Functions App using the LocalStack Azure CLI
0 commit comments