diff --git a/0_core-infrastructure/README.md b/0_core-infrastructure/README.md index 67d16da..50cc7c3 100644 --- a/0_core-infrastructure/README.md +++ b/0_core-infrastructure/README.md @@ -24,7 +24,7 @@ Last updated: 2026-02-09
- Total views -

Refresh Date: 2026-02-11

+ Total views +

Refresh Date: 2026-02-12

diff --git a/0_core-infrastructure/azure-bastion/README.md b/0_core-infrastructure/azure-bastion/README.md index f6cf176..c000d16 100644 --- a/0_core-infrastructure/azure-bastion/README.md +++ b/0_core-infrastructure/azure-bastion/README.md @@ -45,7 +45,7 @@ Below is a list of variables used in this template, their expected values, types
- Total views -

Refresh Date: 2026-02-11

+ Total views +

Refresh Date: 2026-02-12

diff --git a/0_core-infrastructure/azure-dns/README.md b/0_core-infrastructure/azure-dns/README.md index 88eec52..9c59f09 100644 --- a/0_core-infrastructure/azure-dns/README.md +++ b/0_core-infrastructure/azure-dns/README.md @@ -40,7 +40,7 @@ Below is a list of variables used in this template, their expected values, types
- Total views -

Refresh Date: 2026-02-11

+ Total views +

Refresh Date: 2026-02-12

diff --git a/0_core-infrastructure/network-security-group/README.md b/0_core-infrastructure/network-security-group/README.md index 0576257..59ae6d8 100644 --- a/0_core-infrastructure/network-security-group/README.md +++ b/0_core-infrastructure/network-security-group/README.md @@ -40,7 +40,7 @@ Below is a list of variables used in this template, their expected values, types
- Total views -

Refresh Date: 2026-02-11

+ Total views +

Refresh Date: 2026-02-12

diff --git a/0_core-infrastructure/public-ip/README.md b/0_core-infrastructure/public-ip/README.md index 1157fc7..fa55469 100644 --- a/0_core-infrastructure/public-ip/README.md +++ b/0_core-infrastructure/public-ip/README.md @@ -42,7 +42,7 @@ Below is a list of variables used in this template, their expected values, types
- Total views -

Refresh Date: 2026-02-11

+ Total views +

Refresh Date: 2026-02-12

diff --git a/0_core-infrastructure/resource-group/README.md b/0_core-infrastructure/resource-group/README.md index 322f6ec..63ba4d1 100644 --- a/0_core-infrastructure/resource-group/README.md +++ b/0_core-infrastructure/resource-group/README.md @@ -33,7 +33,7 @@ Below is a list of variables used in this template, their expected values, types
- Total views -

Refresh Date: 2026-02-11

+ Total views +

Refresh Date: 2026-02-12

diff --git a/0_core-infrastructure/subnet/README.md b/0_core-infrastructure/subnet/README.md index 0aa0d60..abce34e 100644 --- a/0_core-infrastructure/subnet/README.md +++ b/0_core-infrastructure/subnet/README.md @@ -43,7 +43,7 @@ Below is a list of variables used in this template, their expected values, types
- Total views -

Refresh Date: 2026-02-11

+ Total views +

Refresh Date: 2026-02-12

diff --git a/0_core-infrastructure/virtual-network/README.md b/0_core-infrastructure/virtual-network/README.md index d10c732..06e6f8b 100644 --- a/0_core-infrastructure/virtual-network/README.md +++ b/0_core-infrastructure/virtual-network/README.md @@ -41,7 +41,7 @@ Below is a list of variables used in this template, their expected values, types
- Total views -

Refresh Date: 2026-02-11

+ Total views +

Refresh Date: 2026-02-12

diff --git a/10_migration-backup/README.md b/10_migration-backup/README.md index 27a05b4..730ec13 100644 --- a/10_migration-backup/README.md +++ b/10_migration-backup/README.md @@ -19,7 +19,7 @@ Last updated: 2026-02-09
- Total views -

Refresh Date: 2026-02-11

+ Total views +

Refresh Date: 2026-02-12

diff --git a/10_migration-backup/backup/README.md b/10_migration-backup/backup/README.md index 564a44e..cfc9bcf 100644 --- a/10_migration-backup/backup/README.md +++ b/10_migration-backup/backup/README.md @@ -52,7 +52,7 @@ terraform apply
- Total views -

Refresh Date: 2026-02-11

+ Total views +

Refresh Date: 2026-02-12

diff --git a/10_migration-backup/site-recovery/README.md b/10_migration-backup/site-recovery/README.md index 4d093fb..1568ee7 100644 --- a/10_migration-backup/site-recovery/README.md +++ b/10_migration-backup/site-recovery/README.md @@ -52,7 +52,7 @@ terraform apply
- Total views -

Refresh Date: 2026-02-11

+ Total views +

Refresh Date: 2026-02-12

diff --git a/11_media-services/README.md b/11_media-services/README.md index 21ee2b1..5c28713 100644 --- a/11_media-services/README.md +++ b/11_media-services/README.md @@ -19,7 +19,7 @@ Last updated: 2026-02-11
- Total views -

Refresh Date: 2026-02-11

+ Total views +

Refresh Date: 2026-02-12

diff --git a/11_media-services/ai-video-indexer/README.md b/11_media-services/ai-video-indexer/README.md index a7a0fb6..0851236 100644 --- a/11_media-services/ai-video-indexer/README.md +++ b/11_media-services/ai-video-indexer/README.md @@ -78,7 +78,7 @@ Last updated: 2026-02-10
- Total views -

Refresh Date: 2026-02-11

+ Total views +

Refresh Date: 2026-02-12

diff --git a/11_media-services/cdn/README.md b/11_media-services/cdn/README.md index b1d47f3..322b528 100644 --- a/11_media-services/cdn/README.md +++ b/11_media-services/cdn/README.md @@ -85,7 +85,7 @@ Last updated: 2026-02-10
- Total views -

Refresh Date: 2026-02-11

+ Total views +

Refresh Date: 2026-02-12

diff --git a/1_storage-databases/README.md b/1_storage-databases/README.md index 46a9e70..0b0e9f6 100644 --- a/1_storage-databases/README.md +++ b/1_storage-databases/README.md @@ -26,7 +26,7 @@ Last updated: 2026-02-09
- Total views -

Refresh Date: 2026-02-11

+ Total views +

Refresh Date: 2026-02-12

diff --git a/1_storage-databases/blob-storage/README.md b/1_storage-databases/blob-storage/README.md index 858e960..720eef9 100644 --- a/1_storage-databases/blob-storage/README.md +++ b/1_storage-databases/blob-storage/README.md @@ -45,7 +45,7 @@ Below is a list of variables used in this template, their expected values, types
- Total views -

Refresh Date: 2026-02-11

+ Total views +

Refresh Date: 2026-02-12

diff --git a/1_storage-databases/cosmos-db/README.md b/1_storage-databases/cosmos-db/README.md index b0d8157..d5b4ec8 100644 --- a/1_storage-databases/cosmos-db/README.md +++ b/1_storage-databases/cosmos-db/README.md @@ -40,7 +40,7 @@ Below is a list of variables used in this template, their expected values, types
- Total views -

Refresh Date: 2026-02-11

+ Total views +

Refresh Date: 2026-02-12

diff --git a/1_storage-databases/data-lake-storage/README.md b/1_storage-databases/data-lake-storage/README.md index 115a653..655079c 100644 --- a/1_storage-databases/data-lake-storage/README.md +++ b/1_storage-databases/data-lake-storage/README.md @@ -42,7 +42,7 @@ Below is a list of variables used in this template, their expected values, types
- Total views -

Refresh Date: 2026-02-11

+ Total views +

Refresh Date: 2026-02-12

diff --git a/1_storage-databases/file-storage/README.md b/1_storage-databases/file-storage/README.md index 142fee9..350a07b 100644 --- a/1_storage-databases/file-storage/README.md +++ b/1_storage-databases/file-storage/README.md @@ -44,7 +44,7 @@ Below is a list of variables used in this template, their expected values, types
- Total views -

Refresh Date: 2026-02-11

+ Total views +

Refresh Date: 2026-02-12

diff --git a/1_storage-databases/mongo-atlas/README.md b/1_storage-databases/mongo-atlas/README.md index 56d2233..5da541e 100644 --- a/1_storage-databases/mongo-atlas/README.md +++ b/1_storage-databases/mongo-atlas/README.md @@ -133,7 +133,7 @@ Below is a list of variables used in this template, their expected values, types
- Total views -

Refresh Date: 2026-02-11

+ Total views +

Refresh Date: 2026-02-12

diff --git a/1_storage-databases/mongo-atlas/known_errors.md b/1_storage-databases/mongo-atlas/known_errors.md index 8ac93be..fd426b4 100644 --- a/1_storage-databases/mongo-atlas/known_errors.md +++ b/1_storage-databases/mongo-atlas/known_errors.md @@ -62,7 +62,7 @@ Last updated: 2026-02-09
- Total views -

Refresh Date: 2026-02-11

+ Total views +

Refresh Date: 2026-02-12

diff --git a/1_storage-databases/mysql-flexible-server/README.md b/1_storage-databases/mysql-flexible-server/README.md index ea01f5f..8fff7e0 100644 --- a/1_storage-databases/mysql-flexible-server/README.md +++ b/1_storage-databases/mysql-flexible-server/README.md @@ -49,7 +49,7 @@ Below is a list of variables used in this template, their expected values, types
- Total views -

Refresh Date: 2026-02-11

+ Total views +

Refresh Date: 2026-02-12

diff --git a/1_storage-databases/postgresql/README.md b/1_storage-databases/postgresql/README.md index 3f578bd..cfa9b4d 100644 --- a/1_storage-databases/postgresql/README.md +++ b/1_storage-databases/postgresql/README.md @@ -48,7 +48,7 @@ Below is a list of variables used in this template, their expected values, types
- Total views -

Refresh Date: 2026-02-11

+ Total views +

Refresh Date: 2026-02-12

diff --git a/1_storage-databases/sql-database/README.md b/1_storage-databases/sql-database/README.md index f24a2e7..bb9e14b 100644 --- a/1_storage-databases/sql-database/README.md +++ b/1_storage-databases/sql-database/README.md @@ -44,7 +44,7 @@ Below is a list of variables used in this template, their expected values, types
- Total views -

Refresh Date: 2026-02-11

+ Total views +

Refresh Date: 2026-02-12

diff --git a/1_storage-databases/storage-account/README.md b/1_storage-databases/storage-account/README.md index 488b161..a99e090 100644 --- a/1_storage-databases/storage-account/README.md +++ b/1_storage-databases/storage-account/README.md @@ -42,7 +42,7 @@ Below is a list of variables used in this template, their expected values, types
- Total views -

Refresh Date: 2026-02-11

+ Total views +

Refresh Date: 2026-02-12

diff --git a/2_compute-containers/README.md b/2_compute-containers/README.md index 9d9086f..2176a59 100644 --- a/2_compute-containers/README.md +++ b/2_compute-containers/README.md @@ -24,7 +24,7 @@ Last updated: 2026-02-09
- Total views -

Refresh Date: 2026-02-11

+ Total views +

Refresh Date: 2026-02-12

diff --git a/2_compute-containers/app-service/README.md b/2_compute-containers/app-service/README.md index 951fd29..198045f 100644 --- a/2_compute-containers/app-service/README.md +++ b/2_compute-containers/app-service/README.md @@ -43,7 +43,7 @@ Below is a list of variables used in this template, their expected values, types
- Total views -

Refresh Date: 2026-02-11

+ Total views +

Refresh Date: 2026-02-12

diff --git a/2_compute-containers/batch/README.md b/2_compute-containers/batch/README.md index d14d086..58641f3 100644 --- a/2_compute-containers/batch/README.md +++ b/2_compute-containers/batch/README.md @@ -40,7 +40,7 @@ Below is a list of variables used in this template, their expected values, types
- Total views -

Refresh Date: 2026-02-11

+ Total views +

Refresh Date: 2026-02-12

diff --git a/2_compute-containers/container-instances/README.md b/2_compute-containers/container-instances/README.md index c1e76f3..078adc5 100644 --- a/2_compute-containers/container-instances/README.md +++ b/2_compute-containers/container-instances/README.md @@ -45,7 +45,7 @@ Below is a list of variables used in this template, their expected values, types
- Total views -

Refresh Date: 2026-02-11

+ Total views +

Refresh Date: 2026-02-12

diff --git a/2_compute-containers/function-app/README.md b/2_compute-containers/function-app/README.md index 2a232b5..46c5963 100644 --- a/2_compute-containers/function-app/README.md +++ b/2_compute-containers/function-app/README.md @@ -43,7 +43,7 @@ Below is a list of variables used in this template, their expected values, types
- Total views -

Refresh Date: 2026-02-11

+ Total views +

Refresh Date: 2026-02-12

diff --git a/2_compute-containers/kubernetes-service/README.md b/2_compute-containers/kubernetes-service/README.md index 6447a9c..e8db7d5 100644 --- a/2_compute-containers/kubernetes-service/README.md +++ b/2_compute-containers/kubernetes-service/README.md @@ -50,7 +50,7 @@ Below is a list of variables used in this template, their expected values, types
- Total views -

Refresh Date: 2026-02-11

+ Total views +

Refresh Date: 2026-02-12

diff --git a/2_compute-containers/virtual-desktop/README.md b/2_compute-containers/virtual-desktop/README.md index a0837f1..12d53a7 100644 --- a/2_compute-containers/virtual-desktop/README.md +++ b/2_compute-containers/virtual-desktop/README.md @@ -46,7 +46,7 @@ Below is a list of variables used in this template, their expected values, types
- Total views -

Refresh Date: 2026-02-11

+ Total views +

Refresh Date: 2026-02-12

diff --git a/2_compute-containers/virtual-machine/README.md b/2_compute-containers/virtual-machine/README.md index f716c96..1329e59 100644 --- a/2_compute-containers/virtual-machine/README.md +++ b/2_compute-containers/virtual-machine/README.md @@ -45,7 +45,7 @@ Below is a list of variables used in this template, their expected values, types
- Total views -

Refresh Date: 2026-02-11

+ Total views +

Refresh Date: 2026-02-12

diff --git a/3_networking/README.md b/3_networking/README.md index 059bbc3..a7d3f0e 100644 --- a/3_networking/README.md +++ b/3_networking/README.md @@ -25,7 +25,7 @@ Last updated: 2026-02-09
- Total views -

Refresh Date: 2026-02-11

+ Total views +

Refresh Date: 2026-02-12

diff --git a/3_networking/application-gateway/README.md b/3_networking/application-gateway/README.md index 93f43d1..554d172 100644 --- a/3_networking/application-gateway/README.md +++ b/3_networking/application-gateway/README.md @@ -65,7 +65,7 @@ terraform apply
- Total views -

Refresh Date: 2026-02-11

+ Total views +

Refresh Date: 2026-02-12

diff --git a/3_networking/cdn/README.md b/3_networking/cdn/README.md index a580874..bc354d7 100644 --- a/3_networking/cdn/README.md +++ b/3_networking/cdn/README.md @@ -57,7 +57,7 @@ terraform apply
- Total views -

Refresh Date: 2026-02-11

+ Total views +

Refresh Date: 2026-02-12

diff --git a/3_networking/expressroute/README.md b/3_networking/expressroute/README.md index d5da01a..578339b 100644 --- a/3_networking/expressroute/README.md +++ b/3_networking/expressroute/README.md @@ -60,7 +60,7 @@ terraform apply
- Total views -

Refresh Date: 2026-02-11

+ Total views +

Refresh Date: 2026-02-12

diff --git a/3_networking/firewall/README.md b/3_networking/firewall/README.md index 8f63e07..7e8a5ba 100644 --- a/3_networking/firewall/README.md +++ b/3_networking/firewall/README.md @@ -56,7 +56,7 @@ terraform apply
- Total views -

Refresh Date: 2026-02-11

+ Total views +

Refresh Date: 2026-02-12

diff --git a/3_networking/front-door/README.md b/3_networking/front-door/README.md index d310387..a87cbb6 100644 --- a/3_networking/front-door/README.md +++ b/3_networking/front-door/README.md @@ -58,7 +58,7 @@ terraform apply
- Total views -

Refresh Date: 2026-02-11

+ Total views +

Refresh Date: 2026-02-12

diff --git a/3_networking/load-balancer/README.md b/3_networking/load-balancer/README.md index cf38792..c10601d 100644 --- a/3_networking/load-balancer/README.md +++ b/3_networking/load-balancer/README.md @@ -71,7 +71,7 @@ terraform apply
- Total views -

Refresh Date: 2026-02-11

+ Total views +

Refresh Date: 2026-02-12

diff --git a/3_networking/traffic-manager/README.md b/3_networking/traffic-manager/README.md index d29f138..eec8f42 100644 --- a/3_networking/traffic-manager/README.md +++ b/3_networking/traffic-manager/README.md @@ -63,7 +63,7 @@ terraform apply
- Total views -

Refresh Date: 2026-02-11

+ Total views +

Refresh Date: 2026-02-12

diff --git a/3_networking/vpn-gateway/README.md b/3_networking/vpn-gateway/README.md index 5dcc302..9683a50 100644 --- a/3_networking/vpn-gateway/README.md +++ b/3_networking/vpn-gateway/README.md @@ -57,7 +57,7 @@ terraform apply
- Total views -

Refresh Date: 2026-02-11

+ Total views +

Refresh Date: 2026-02-12

diff --git a/4_identity-security/README.md b/4_identity-security/README.md index a3ef760..909c1a2 100644 --- a/4_identity-security/README.md +++ b/4_identity-security/README.md @@ -21,7 +21,7 @@ Last updated: 2026-02-09
- Total views -

Refresh Date: 2026-02-11

+ Total views +

Refresh Date: 2026-02-12

diff --git a/4_identity-security/entra_id/README.md b/4_identity-security/entra_id/README.md index 37255a1..0915f39 100644 --- a/4_identity-security/entra_id/README.md +++ b/4_identity-security/entra_id/README.md @@ -74,7 +74,7 @@ Below is a list of variables used in this template, their expected values, types
- Total views -

Refresh Date: 2026-02-11

+ Total views +

Refresh Date: 2026-02-12

diff --git a/4_identity-security/key-vault/README.md b/4_identity-security/key-vault/README.md index e4a29e0..316817e 100644 --- a/4_identity-security/key-vault/README.md +++ b/4_identity-security/key-vault/README.md @@ -91,7 +91,7 @@ Below is a list of variables used in this template, their expected values, types
- Total views -

Refresh Date: 2026-02-11

+ Total views +

Refresh Date: 2026-02-12

diff --git a/4_identity-security/managed-identity/README.md b/4_identity-security/managed-identity/README.md index 8bdb711..67d70ba 100644 --- a/4_identity-security/managed-identity/README.md +++ b/4_identity-security/managed-identity/README.md @@ -74,7 +74,7 @@ Last updated: 2026-02-09
- Total views -

Refresh Date: 2026-02-11

+ Total views +

Refresh Date: 2026-02-12

diff --git a/4_identity-security/policy/README.md b/4_identity-security/policy/README.md index 043bb79..65f2d00 100644 --- a/4_identity-security/policy/README.md +++ b/4_identity-security/policy/README.md @@ -86,7 +86,7 @@ Last updated: 2026-02-10
- Total views -

Refresh Date: 2026-02-11

+ Total views +

Refresh Date: 2026-02-12

diff --git a/5_analytics-bigdata/README.md b/5_analytics-bigdata/README.md index 4ea12a9..7633efe 100644 --- a/5_analytics-bigdata/README.md +++ b/5_analytics-bigdata/README.md @@ -15,10 +15,11 @@ Last updated: 2026-02-09 ## Templates available - [Azure Data Factory](./data-factory) +- [Azure Synapse Analytics (Workspace)](./synapse-analytics)
- Total views -

Refresh Date: 2026-02-11

+ Total views +

Refresh Date: 2026-02-12

diff --git a/5_analytics-bigdata/data-factory/README.md b/5_analytics-bigdata/data-factory/README.md index 2c0d08b..53f7f65 100644 --- a/5_analytics-bigdata/data-factory/README.md +++ b/5_analytics-bigdata/data-factory/README.md @@ -83,7 +83,7 @@ Last updated: 2026-02-11
- Total views -

Refresh Date: 2026-02-11

+ Total views +

Refresh Date: 2026-02-12

diff --git a/5_analytics-bigdata/synapse-analytics/README.md b/5_analytics-bigdata/synapse-analytics/README.md new file mode 100644 index 0000000..a318b17 --- /dev/null +++ b/5_analytics-bigdata/synapse-analytics/README.md @@ -0,0 +1,106 @@ +# Terraform Template - Azure Synapse Analytics (Workspace) + +Costa Rica + +[![GitHub](https://img.shields.io/badge/--181717?logo=github&logoColor=ffffff)](https://github.com/) +[brown9804](https://github.com/brown9804) + +Last updated: 2026-02-12 + +------------------------------------------ + +> This template contains Terraform configurations to create an Azure Synapse Analytics workspace backed by an ADLS Gen2 filesystem. + +> [!IMPORTANT] +> Azure Synapse always uses a **managed resource group** (configured by `managed_resource_group_name`). This is created and managed by the Synapse service itself and is required for the workspace to operate. You will see **two resource groups** in Azure: your main RG plus the Synapse-managed RG. + +
+ image +
+ +
+ image +
+ +
+ image +
+ +> [!NOTE] +> +> - This template creates the Storage Account and filesystem via the AzAPI provider (management plane) to avoid key-based Storage data-plane operations (common in environments where shared keys are disabled by policy). +> - Synapse validates the default data lake storage using the DFS URL format: `https://.dfs.core.windows.net/`. This template passes that format to `azurerm_synapse_workspace`. +> - Synapse workspace names are globally unique. If you disable `append_random_suffix`, you may hit name collisions. +> - The SQL admin password must meet complexity rules (at least 3 of: upper/lower/digit/special). Use `TF_VAR_sql_administrator_password` to avoid committing secrets. + +## File Descriptions + +- **main.tf**: Creates the Resource Group, Storage Account + filesystem (ADLS Gen2), and Synapse Workspace. +- **variables.tf**: Defines the input variables used in the Terraform configuration. +- **provider.tf**: Configures the AzureRM + AzAPI providers. +- **terraform.tfvars**: Provides example values for the variables defined in `variables.tf`. +- **outputs.tf**: Defines outputs such as the Synapse workspace ID. + +## Variables + +| Variable Name | Description | Type | Example Value | +| --- | --- | --- | --- | +| `resource_group_name` | Resource Group name to create/deploy into. | string | `"rg-analytics-dev"` | +| `location` | Azure region for the deployment. | string | `"eastus"` | +| `synapse_workspace_name` | Base Synapse workspace name. If suffix enabled, final is `-`. | string | `"synw-analytics-dev"` | +| `managed_resource_group_name` | Optional base managed RG name for Synapse. If omitted, auto-generated. | string | `null` | +| `storage_account_name` | Base storage account name. If suffix enabled, final is `` (no dash). | string | `"stadlsanalyticsdev"` | +| `filesystem_name` | ADLS Gen2 filesystem name (container). | string | `"synapse"` | +| `sql_administrator_login` | Synapse SQL admin login. | string | `"sqladminuser"` | +| `sql_administrator_password` | Synapse SQL admin password (prefer env var). | string | `""` | +| `append_random_suffix` | Append a random suffix to avoid global collisions. | bool | `true` | +| `random_suffix_length` | Length of the random suffix when enabled. | number | `6` | +| `tags` | Tags applied to resources. | map(string) | `{ "env": "dev" }` | + +## Usage + +1. Authenticate: + + ```sh + az login + ```` + + ```sh + az account show + # If needed: + az account set --subscription "" + ``` + +3. Provide the SQL admin password without committing it: + + PowerShell: + + ```powershell + $env:TF_VAR_sql_administrator_password = "" + ``` + +4. Initialize: + + ```sh + terraform init -upgrade + ``` + +5. Validate and plan: + + ```sh + terraform validate + terraform plan + ``` + +6. Apply: + + ```sh + terraform apply -auto-approve + ``` + + +
+ Total views +

Refresh Date: 2026-02-12

+
+ diff --git a/5_analytics-bigdata/synapse-analytics/main.tf b/5_analytics-bigdata/synapse-analytics/main.tf new file mode 100644 index 0000000..451fcc3 --- /dev/null +++ b/5_analytics-bigdata/synapse-analytics/main.tf @@ -0,0 +1,128 @@ +# main.tf +# Creates an Azure Synapse Analytics workspace backed by an ADLS Gen2 filesystem. +# Storage resources are created via AzAPI (management plane) to avoid key-based data-plane operations. + +data "azurerm_client_config" "current" {} + +# Resource group creation is idempotent in ARM (PUT). This will create the RG if it doesn't exist, +# or update tags if it already exists. +resource "azapi_resource" "resource_group" { + type = "Microsoft.Resources/resourceGroups@2022-09-01" + name = var.resource_group_name + location = var.location + parent_id = "/subscriptions/${data.azurerm_client_config.current.subscription_id}" + + body = jsonencode({ + tags = var.tags + }) + + response_export_values = [ + "id", + "name" + ] +} + +resource "random_string" "suffix" { + length = var.random_suffix_length + upper = false + special = false + numeric = true + + keepers = { + resource_group_name = var.resource_group_name + location = var.location + workspace_base = var.synapse_workspace_name + storage_base = var.storage_account_name + managed_rg_base = coalesce(var.managed_resource_group_name, "rg-synapse-managed-${var.synapse_workspace_name}") + } +} + +locals { + rg_id = azapi_resource.resource_group.id + rg_name = var.resource_group_name + location = var.location + + suffix = var.append_random_suffix ? random_string.suffix.result : "" + synapse_workspace_name = var.append_random_suffix ? "${var.synapse_workspace_name}-${local.suffix}" : var.synapse_workspace_name + managed_rg_base = coalesce(var.managed_resource_group_name, "rg-synapse-managed-${var.synapse_workspace_name}") + managed_rg_name = var.append_random_suffix ? "${local.managed_rg_base}-${local.suffix}" : local.managed_rg_base + + # Storage Account names must be lowercase alphanumeric and cannot contain dashes. + storage_account_name = var.append_random_suffix ? "${var.storage_account_name}${local.suffix}" : var.storage_account_name + + # azurerm_synapse_workspace expects the Data Lake Gen2 filesystem id in DFS URL form. + # Format: https://.dfs.core.windows.net/ + dfs_filesystem_id = "https://${local.storage_account_name}.dfs.core.windows.net/${var.filesystem_name}" +} + +resource "azapi_resource" "storage_account" { + type = "Microsoft.Storage/storageAccounts@2021-04-01" + name = local.storage_account_name + location = local.location + parent_id = local.rg_id + + body = jsonencode({ + kind = "StorageV2" + sku = { + name = "Standard_LRS" + } + properties = { + isHnsEnabled = true + minimumTlsVersion = "TLS1_2" + supportsHttpsTrafficOnly = true + + # Often enforced by org policy; also avoids Terraform needing to use shared keys. + allowSharedKeyAccess = false + allowBlobPublicAccess = false + } + tags = var.tags + }) + + response_export_values = [ + "id", + "name" + ] +} + +resource "azapi_resource" "filesystem" { + type = "Microsoft.Storage/storageAccounts/blobServices/containers@2022-09-01" + name = var.filesystem_name + + parent_id = "${azapi_resource.storage_account.id}/blobServices/default" + + body = jsonencode({ + properties = { + publicAccess = "None" + } + }) + + response_export_values = [ + "id", + "name" + ] + + depends_on = [ + azapi_resource.storage_account + ] +} + +resource "azurerm_synapse_workspace" "ws" { + name = local.synapse_workspace_name + resource_group_name = local.rg_name + location = local.location + managed_resource_group_name = local.managed_rg_name + storage_data_lake_gen2_filesystem_id = local.dfs_filesystem_id + + sql_administrator_login = var.sql_administrator_login + sql_administrator_login_password = var.sql_administrator_password + + identity { + type = "SystemAssigned" + } + + tags = var.tags + + depends_on = [ + azapi_resource.filesystem + ] +} diff --git a/5_analytics-bigdata/synapse-analytics/outputs.tf b/5_analytics-bigdata/synapse-analytics/outputs.tf new file mode 100644 index 0000000..618a38f --- /dev/null +++ b/5_analytics-bigdata/synapse-analytics/outputs.tf @@ -0,0 +1,31 @@ +# outputs.tf + +output "resource_group_id" { + description = "The ID of the resource group." + value = local.rg_id +} + +output "storage_account_id" { + description = "The resource ID of the Storage Account backing Synapse." + value = azapi_resource.storage_account.id +} + +output "filesystem_id" { + description = "The ARM resource ID of the ADLS Gen2 filesystem (container)." + value = azapi_resource.filesystem.id +} + +output "filesystem_dfs_url" { + description = "The DFS URL format used by Synapse for the default data lake storage filesystem." + value = "https://${azapi_resource.storage_account.name}.dfs.core.windows.net/${azapi_resource.filesystem.name}" +} + +output "synapse_workspace_id" { + description = "The resource ID of the Synapse workspace." + value = azurerm_synapse_workspace.ws.id +} + +output "synapse_workspace_name" { + description = "The name of the Synapse workspace." + value = azurerm_synapse_workspace.ws.name +} diff --git a/5_analytics-bigdata/synapse-analytics/provider.tf b/5_analytics-bigdata/synapse-analytics/provider.tf new file mode 100644 index 0000000..1b874a2 --- /dev/null +++ b/5_analytics-bigdata/synapse-analytics/provider.tf @@ -0,0 +1,38 @@ +# provider.tf +# This file configures the Azure providers to interact with Azure resources. + +terraform { + required_version = ">= 1.8, < 2.0" + + required_providers { + azurerm = { + source = "hashicorp/azurerm" + version = "~> 3.116" + } + + azapi = { + source = "Azure/azapi" + version = "~> 1.13" + } + + random = { + source = "hashicorp/random" + version = "~> 3.6" + } + } +} + +provider "azurerm" { + features { + resource_group { + prevent_deletion_if_contains_resources = false + } + } + + # Uses the current Azure CLI context (az login + az account set) + skip_provider_registration = false +} + +provider "azapi" { + # Uses the current Azure CLI context (az login + az account set) +} diff --git a/5_analytics-bigdata/synapse-analytics/terraform.tfvars b/5_analytics-bigdata/synapse-analytics/terraform.tfvars new file mode 100644 index 0000000..dfbe965 --- /dev/null +++ b/5_analytics-bigdata/synapse-analytics/terraform.tfvars @@ -0,0 +1,29 @@ +resource_group_name = "rg-analytics-dev" +location = "eastus" + +# Synapse workspace names are globally unique. +# This template appends a random suffix by default to reduce collisions. +synapse_workspace_name = "synw-analytics-dev" + +# Optional. If omitted, the template auto-generates a Synapse managed RG name. +# managed_resource_group_name = "rg-synapse-managed-analytics-dev" + +# Storage account names must be lowercase alphanumeric and globally unique. +# This template appends a random suffix by default (without dashes). +storage_account_name = "stadlsanalyticsdev" +filesystem_name = "synapse" + +sql_administrator_login = "sqladminuser" + +# Do NOT commit real passwords. Prefer using: +# $env:TF_VAR_sql_administrator_password = "" +sql_administrator_password = "ChangeMe123!" + +append_random_suffix = true +random_suffix_length = 6 + +tags = { + env = "dev" + area = "analytics-bigdata" + iac = "terraform" +} diff --git a/5_analytics-bigdata/synapse-analytics/variables.tf b/5_analytics-bigdata/synapse-analytics/variables.tf new file mode 100644 index 0000000..09cd020 --- /dev/null +++ b/5_analytics-bigdata/synapse-analytics/variables.tf @@ -0,0 +1,132 @@ +# variables.tf +# This file defines the input variables used in the Terraform configuration. + +variable "resource_group_name" { + description = "The name of the Azure Resource Group to deploy Synapse into. If create_resource_group is true, Terraform will create this resource group." + type = string + + validation { + condition = length(trimspace(var.resource_group_name)) > 0 + error_message = "resource_group_name must not be empty." + } +} + +variable "location" { + description = "The Azure region where the Resource Group and Synapse workspace will be created." + type = string + + validation { + condition = length(trimspace(var.location)) > 0 + error_message = "location must not be empty." + } +} + +variable "synapse_workspace_name" { + description = "Base name of the Synapse workspace. If append_random_suffix is true, the final name will be '-'." + type = string + + validation { + condition = ( + length(trimspace(var.synapse_workspace_name)) > 0 + && can(regex("^[a-zA-Z0-9][a-zA-Z0-9-]*$", var.synapse_workspace_name)) + && length(var.synapse_workspace_name) <= (var.append_random_suffix ? (45 - 1 - var.random_suffix_length) : 45) + ) + error_message = "synapse_workspace_name must be 1-45 chars, start with alphanumeric, contain only alphanumeric or '-', and leave room for '-' when append_random_suffix is true." + } +} + +variable "managed_resource_group_name" { + description = "Optional base name of the Synapse managed resource group. If null/omitted, the template auto-generates a name. If append_random_suffix is true, the final name will be '-'." + type = string + default = null + + validation { + condition = ( + var.managed_resource_group_name == null ? true : ( + length(try(trimspace(var.managed_resource_group_name), "")) > 0 + && length(try(var.managed_resource_group_name, "")) <= (var.append_random_suffix ? (90 - 1 - var.random_suffix_length) : 90) + ) + ) + error_message = "managed_resource_group_name must be 1-90 chars (or null to auto-generate) and leave room for '-' when append_random_suffix is true." + } +} + +variable "storage_account_name" { + description = "Base name of the Storage Account (lowercase alphanumeric, 3-24 chars). If append_random_suffix is true, the final name will be '' (no dash)." + type = string + + validation { + condition = ( + length(trimspace(var.storage_account_name)) >= 3 + && can(regex("^[a-z0-9]+$", var.storage_account_name)) + && length(var.storage_account_name) <= (var.append_random_suffix ? (24 - var.random_suffix_length) : 24) + ) + error_message = "storage_account_name must be lowercase alphanumeric, 3-24 chars, and leave room for the suffix (no dash) when append_random_suffix is true." + } +} + +variable "filesystem_name" { + description = "Name of the ADLS Gen2 filesystem (implemented as a private blob container)." + type = string + + validation { + condition = ( + length(trimspace(var.filesystem_name)) > 0 + && length(var.filesystem_name) <= 63 + && can(regex("^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$", var.filesystem_name)) + ) + error_message = "filesystem_name must be 1-63 chars, lowercase alphanumeric or '-', and start/end with alphanumeric." + } +} + +variable "sql_administrator_login" { + description = "SQL administrator login for the Synapse workspace." + type = string + + validation { + condition = length(trimspace(var.sql_administrator_login)) > 0 + error_message = "sql_administrator_login must not be empty." + } +} + +variable "sql_administrator_password" { + description = "SQL administrator password for the Synapse workspace. Prefer providing via TF_VAR_sql_administrator_password environment variable." + type = string + sensitive = true + + validation { + condition = ( + length(var.sql_administrator_password) >= 8 + && ( + (can(regex("[A-Z]", var.sql_administrator_password)) ? 1 : 0) + + (can(regex("[a-z]", var.sql_administrator_password)) ? 1 : 0) + + (can(regex("[0-9]", var.sql_administrator_password)) ? 1 : 0) + + (can(regex("[^A-Za-z0-9]", var.sql_administrator_password)) ? 1 : 0) + ) >= 3 + ) + error_message = "sql_administrator_password must be at least 8 characters and include characters from at least 3 of: uppercase, lowercase, digits, special." + } +} + +variable "append_random_suffix" { + description = "Whether to append a random suffix to globally-unique names (workspace, managed RG, and storage account) to avoid collisions." + type = bool + default = true +} + +variable "random_suffix_length" { + description = "Length of the random suffix appended when append_random_suffix is true." + type = number + default = 6 + + validation { + condition = var.random_suffix_length >= 4 && var.random_suffix_length <= 16 + error_message = "random_suffix_length must be between 4 and 16." + } +} + +variable "tags" { + description = "A map of tags to assign to the resources." + type = map(string) + default = {} +} diff --git a/6_monitoring-management/README.md b/6_monitoring-management/README.md index 182315e..f19709c 100644 --- a/6_monitoring-management/README.md +++ b/6_monitoring-management/README.md @@ -14,7 +14,7 @@ Last updated: 2026-02-09
- Total views -

Refresh Date: 2026-02-11

+ Total views +

Refresh Date: 2026-02-12

diff --git a/7_iot/README.md b/7_iot/README.md index e607932..cfef4dc 100644 --- a/7_iot/README.md +++ b/7_iot/README.md @@ -14,7 +14,7 @@ Last updated: 2026-02-09
- Total views -

Refresh Date: 2026-02-11

+ Total views +

Refresh Date: 2026-02-12

diff --git a/8_ai-ml/README.md b/8_ai-ml/README.md index 9f3a057..a069616 100644 --- a/8_ai-ml/README.md +++ b/8_ai-ml/README.md @@ -14,7 +14,7 @@ Last updated: 2026-02-09
- Total views -

Refresh Date: 2026-02-11

+ Total views +

Refresh Date: 2026-02-12

diff --git a/9_developer-tools/README.md b/9_developer-tools/README.md index 4460136..44f284a 100644 --- a/9_developer-tools/README.md +++ b/9_developer-tools/README.md @@ -14,7 +14,7 @@ Last updated: 2026-02-09
- Total views -

Refresh Date: 2026-02-11

+ Total views +

Refresh Date: 2026-02-12

diff --git a/README.md b/README.md index 33bfe37..c38bafa 100644 --- a/README.md +++ b/README.md @@ -106,6 +106,7 @@ Last updated: 2026-02-11 - [Analytics and Big Data](./5_analytics-bigdata) - [Azure Data Factory](./5_analytics-bigdata/data-factory) + - [Azure Synapse Analytics (Workspace)](./5_analytics-bigdata/synapse-analytics) @@ -255,8 +256,8 @@ graph TD;
- Total views -

Refresh Date: 2026-02-11

+ Total views +

Refresh Date: 2026-02-12