Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
**/.terraform/*
**/.terraform

# Terraform provider schema export files (generated)
**/.terraform-provider-schema.json

# .tfstate files
*.tfstate
*.tfstate.*
Expand Down
2 changes: 1 addition & 1 deletion 0_core-infrastructure/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ Last updated: 2026-02-09
<!-- START BADGE -->
<div align="center">
<img src="https://img.shields.io/badge/Total%20views-1706-limegreen" alt="Total views">
<p>Refresh Date: 2026-02-10</p>
<p>Refresh Date: 2026-02-11</p>
</div>
<!-- END BADGE -->
2 changes: 1 addition & 1 deletion 0_core-infrastructure/azure-bastion/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,6 @@ Below is a list of variables used in this template, their expected values, types
<!-- START BADGE -->
<div align="center">
<img src="https://img.shields.io/badge/Total%20views-1706-limegreen" alt="Total views">
<p>Refresh Date: 2026-02-10</p>
<p>Refresh Date: 2026-02-11</p>
</div>
<!-- END BADGE -->
2 changes: 1 addition & 1 deletion 0_core-infrastructure/azure-dns/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@ Below is a list of variables used in this template, their expected values, types
<!-- START BADGE -->
<div align="center">
<img src="https://img.shields.io/badge/Total%20views-1706-limegreen" alt="Total views">
<p>Refresh Date: 2026-02-10</p>
<p>Refresh Date: 2026-02-11</p>
</div>
<!-- END BADGE -->
2 changes: 1 addition & 1 deletion 0_core-infrastructure/network-security-group/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@ Below is a list of variables used in this template, their expected values, types
<!-- START BADGE -->
<div align="center">
<img src="https://img.shields.io/badge/Total%20views-1706-limegreen" alt="Total views">
<p>Refresh Date: 2026-02-10</p>
<p>Refresh Date: 2026-02-11</p>
</div>
<!-- END BADGE -->
2 changes: 1 addition & 1 deletion 0_core-infrastructure/public-ip/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@ Below is a list of variables used in this template, their expected values, types
<!-- START BADGE -->
<div align="center">
<img src="https://img.shields.io/badge/Total%20views-1706-limegreen" alt="Total views">
<p>Refresh Date: 2026-02-10</p>
<p>Refresh Date: 2026-02-11</p>
</div>
<!-- END BADGE -->
2 changes: 1 addition & 1 deletion 0_core-infrastructure/resource-group/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ Below is a list of variables used in this template, their expected values, types
<!-- START BADGE -->
<div align="center">
<img src="https://img.shields.io/badge/Total%20views-1706-limegreen" alt="Total views">
<p>Refresh Date: 2026-02-10</p>
<p>Refresh Date: 2026-02-11</p>
</div>
<!-- END BADGE -->
2 changes: 1 addition & 1 deletion 0_core-infrastructure/subnet/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@ Below is a list of variables used in this template, their expected values, types
<!-- START BADGE -->
<div align="center">
<img src="https://img.shields.io/badge/Total%20views-1706-limegreen" alt="Total views">
<p>Refresh Date: 2026-02-10</p>
<p>Refresh Date: 2026-02-11</p>
</div>
<!-- END BADGE -->
2 changes: 1 addition & 1 deletion 0_core-infrastructure/virtual-network/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@ Below is a list of variables used in this template, their expected values, types
<!-- START BADGE -->
<div align="center">
<img src="https://img.shields.io/badge/Total%20views-1706-limegreen" alt="Total views">
<p>Refresh Date: 2026-02-10</p>
<p>Refresh Date: 2026-02-11</p>
</div>
<!-- END BADGE -->
2 changes: 1 addition & 1 deletion 10_migration-backup/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ Last updated: 2026-02-09
<!-- START BADGE -->
<div align="center">
<img src="https://img.shields.io/badge/Total%20views-1706-limegreen" alt="Total views">
<p>Refresh Date: 2026-02-10</p>
<p>Refresh Date: 2026-02-11</p>
</div>
<!-- END BADGE -->
2 changes: 1 addition & 1 deletion 10_migration-backup/backup/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,6 @@ terraform apply
<!-- START BADGE -->
<div align="center">
<img src="https://img.shields.io/badge/Total%20views-1706-limegreen" alt="Total views">
<p>Refresh Date: 2026-02-10</p>
<p>Refresh Date: 2026-02-11</p>
</div>
<!-- END BADGE -->
2 changes: 1 addition & 1 deletion 10_migration-backup/site-recovery/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,6 @@ terraform apply
<!-- START BADGE -->
<div align="center">
<img src="https://img.shields.io/badge/Total%20views-1706-limegreen" alt="Total views">
<p>Refresh Date: 2026-02-10</p>
<p>Refresh Date: 2026-02-11</p>
</div>
<!-- END BADGE -->
9 changes: 5 additions & 4 deletions 11_media-services/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,21 @@ 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-09
Last updated: 2026-02-11

------------------------------------------

> [!IMPORTANT]
> This folder contains sample Terraform templates for Azure media services. These templates are starting points and should be customized based on your application needs.

## Templates
## Templates available

- [cdn](./cdn)
- [CDN (Front Door Standard/Premium)](./cdn)
- [Azure AI Video Indexer](./ai-video-indexer)

<!-- START BADGE -->
<div align="center">
<img src="https://img.shields.io/badge/Total%20views-1706-limegreen" alt="Total views">
<p>Refresh Date: 2026-02-10</p>
<p>Refresh Date: 2026-02-11</p>
</div>
<!-- END BADGE -->
84 changes: 84 additions & 0 deletions 11_media-services/ai-video-indexer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# Terraform Template: <br/> Media Services (retired) → Azure AI Video Indexer (ARM-based via AzAPI)

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-10

------------------------------------------

> This template deploys an **Azure AI Video Indexer** account (ARM-based) plus its required **Storage Account**, and grants the Video Indexer managed identity the **Storage Blob Data Contributor** role on the storage account.

> [!IMPORTANT]
> **Azure Media Services (AMS) is retired** and Microsoft **blocks creation of new AMS accounts in all Azure regions**. This template uses Azure AI Video Indexer as the supported replacement for video/audio analysis workflows, and uses the `azapi` provider to deploy `Microsoft.VideoIndexer/accounts@2024-01-01`.

<img width="650" alt="image" src="https://github.com/user-attachments/assets/5535b973-51d3-4d96-8ec7-1877a3602b8a" />

<img width="650" alt="image" src="https://github.com/user-attachments/assets/f4779509-0c33-4f8c-8767-4c10ec9ab54e" />

## File Descriptions

- **main.tf**: Creates the Resource Group, Storage Account, Azure AI Video Indexer account (via `azapi_resource`), and role assignment.
- **variables.tf**: Defines the input variables.
- **provider.tf**: Configures the Azure providers (uses Azure CLI auth context).
- **terraform.tfvars**: Example values.
- **outputs.tf**: Exposes resource IDs and the Video Indexer principal ID.

## Variables

| Variable Name | Description | Type | Example Value |
| --- | --- | --- | --- |
| `resource_group_name` | The name of the resource group to create. | string | `"rg-media-services-dev"` |
| `location` | Azure region for deployment. | string | `"East US"` |
| `video_indexer_account_name` | Azure AI Video Indexer account name. | string | `"vi-media-dev-001"` |
| `storage_account_name` | Storage account name (globally unique). | string | `"stmediadev001abc"` |
| `tags` | Tags applied to supported resources. | map(string) | `{ env = "dev" }` |

## Usage

1. Authenticate:

```sh
az login
```

2. (Optional) Select subscription:

```sh
az account set --subscription "<subscription-id-or-name>"
```

3. Initialize:

```sh
terraform init -upgrade
```

4. Validate and plan:

```sh
terraform validate
terraform plan
```

5. Apply:

```sh
terraform apply -auto-approve
```

## Outputs

| Output Name | Description |
| --- | --- |
| `video_indexer_account_id` | The resource ID of the Azure AI Video Indexer account. |
| `video_indexer_principal_id` | The managed identity principal ID used for RBAC. |

<!-- START BADGE -->
<div align="center">
<img src="https://img.shields.io/badge/Total%20views-1706-limegreen" alt="Total views">
<p>Refresh Date: 2026-02-11</p>
</div>
<!-- END BADGE -->
74 changes: 74 additions & 0 deletions 11_media-services/ai-video-indexer/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# main.tf

resource "azurerm_resource_group" "rg" {
name = var.resource_group_name
location = var.location
tags = var.tags
}

resource "azapi_resource" "storage_account" {
type = "Microsoft.Storage/storageAccounts@2021-04-01"
name = var.storage_account_name
location = azurerm_resource_group.rg.location
parent_id = azurerm_resource_group.rg.id

body = jsonencode({
kind = "StorageV2"
sku = {
name = "Standard_LRS"
}
properties = {
minimumTlsVersion = "TLS1_2"
supportsHttpsTrafficOnly = true

# Many orgs enforce disabling key-based auth at the Storage Account level.
# Using AzAPI avoids Terraform needing to poll the data plane with account keys.
allowSharedKeyAccess = false

allowBlobPublicAccess = false
}
tags = var.tags
})

response_export_values = [
"id",
"name"
]
}

resource "azapi_resource" "video_indexer" {
type = "Microsoft.VideoIndexer/accounts@2024-01-01"
name = var.video_indexer_account_name
location = azurerm_resource_group.rg.location
parent_id = azurerm_resource_group.rg.id

identity {
type = "SystemAssigned"
}

body = jsonencode({
properties = {
storageServices = {
resourceId = azapi_resource.storage_account.id
}
}
tags = var.tags
})

response_export_values = [
"id",
"name",
"identity.principalId"
]
}

resource "azurerm_role_assignment" "video_indexer_storage_blob_data_contributor" {
scope = azapi_resource.storage_account.id
role_definition_name = "Storage Blob Data Contributor"
principal_id = jsondecode(azapi_resource.video_indexer.output).identity.principalId

depends_on = [
azapi_resource.storage_account,
azapi_resource.video_indexer
]
}
21 changes: 21 additions & 0 deletions 11_media-services/ai-video-indexer/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# outputs.tf

output "resource_group_id" {
description = "The ID of the resource group."
value = azurerm_resource_group.rg.id
}

output "storage_account_id" {
description = "The ID of the storage account linked to Video Indexer."
value = azapi_resource.storage_account.id
}

output "video_indexer_account_id" {
description = "The resource ID of the Azure AI Video Indexer account."
value = jsondecode(azapi_resource.video_indexer.output).id
}

output "video_indexer_principal_id" {
description = "The system-assigned managed identity principalId for the Video Indexer account."
value = jsondecode(azapi_resource.video_indexer.output).identity.principalId
}
33 changes: 33 additions & 0 deletions 11_media-services/ai-video-indexer/provider.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# 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"
}
}
}

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)
}
10 changes: 10 additions & 0 deletions 11_media-services/ai-video-indexer/terraform.tfvars
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
resource_group_name = "rg-media-services-dev"
location = "East US"
video_indexer_account_name = "vi-media-dev-001"
storage_account_name = "stmediadev001abc" # must be globally unique

tags = {
env = "dev"
iac = "terraform"
area = "media-services"
}
32 changes: 32 additions & 0 deletions 11_media-services/ai-video-indexer/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# variables.tf

variable "resource_group_name" {
description = "The name of the resource group to create."
type = string
}

variable "location" {
description = "Azure region for deployment."
type = string
default = "East US"
}

variable "video_indexer_account_name" {
description = "The name of the Azure AI Video Indexer (ARM-based) account to create."
type = string
}

variable "storage_account_name" {
description = "The name of the Storage Account to create and link to Video Indexer. Must be globally unique and meet Azure naming rules."
type = string
}

variable "tags" {
description = "Tags applied to supported resources."
type = map(string)
default = {
env = "dev"
iac = "terraform"
area = "media-services"
}
}
1 change: 0 additions & 1 deletion 11_media-services/cdn/.terraform-provider-schema.json

This file was deleted.

2 changes: 1 addition & 1 deletion 11_media-services/cdn/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,6 @@ Last updated: 2026-02-10
<!-- START BADGE -->
<div align="center">
<img src="https://img.shields.io/badge/Total%20views-1706-limegreen" alt="Total views">
<p>Refresh Date: 2026-02-10</p>
<p>Refresh Date: 2026-02-11</p>
</div>
<!-- END BADGE -->
2 changes: 1 addition & 1 deletion 1_storage-databases/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ Last updated: 2026-02-09
<!-- START BADGE -->
<div align="center">
<img src="https://img.shields.io/badge/Total%20views-1706-limegreen" alt="Total views">
<p>Refresh Date: 2026-02-10</p>
<p>Refresh Date: 2026-02-11</p>
</div>
<!-- END BADGE -->
Loading