Deploy Azure Digital Twins Con Terraform

Esta mañana he visto que ya habian liberado el modulo de Azure Digital Twins para terraform

Y estoy seguro de que una vez que usted también lee a través de él, usted aprenderá que usted tiene que tomar varios pasos con el fin de lograr la configuración de Azure Digital Twins. Voy a intentar ahorrarte algo de tiempo, proporcionándote una configuración básica de terraform que te ayudará a ponerte en marcha en un abrir y cerrar de ojos.

Los modelos digitales de Azure Digital Twins son representaciones dinámicas actualizadas del mundo real. Mediante el uso de las relaciones de los modelos de DTDL personalizados, conectará gemelos a un gráfico dinámico que representa el entorno.

1. Crear el fichero providers.tf con el siguiente contenido

 1    terraform {
 2    required_version = "> 0.12"
 3    }
 4
 5    provider "azurerm" {
 6    version = "~> 2.40.0"
 7    features {}
 8    }
 9
10    provider "azuread" {
11    version = "~> 1.0"
12    }

2. Crear el fichero main.tf con el siguiente contenido

 1{
 2    data "azurerm_subscription" "current" {}
 3
 4    data "azurerm_client_config" "current" {
 5    }
 6
 7    data "azuread_domains" "aad_domains" {
 8    only_default = true
 9    }
10
11    # Create Resource Group
12    resource "azurerm_resource_group" "rg" {
13    name     = var.resource_group_name
14    location = var.location
15    tags     = var.tags
16    }
17}

3. Crear el fichero Digital_Twins.tf con el siguiente contenido

1{
2    resource "azurerm_digital_twins_instance" "example" {
3    name                = var.dt_name
4    resource_group_name = azurerm_resource_group.rg.name
5    location            = var.location
6
7    tags = var.tags
8    }
9}

4. Crear el fichero variable.tf con el siguiente contenido

 1# Commons
 2variable "location" {
 3  description = "(Required) Location of the all services to be created"
 4  default="westeurope"
 5}
 6
 7variable "resource_group_name" {
 8  description = "(Required) Resource group name of the all services to be created"
 9  default= "DTexample"
10}
11
12variable "tags" {
13  description = "(Required) Tags to be applied to the all services to be created"
14  default = { Project = "DigitalTwins", Owner = "Manuel Sánchez" }
15}
16
17# Azure Digital Twins
18variable "dt_name"{
19  description = "(Required) Name of Digital Twins instance"
20  default = "DTmanutest"
21}

5. Desplegar la solución

1az login
2az account set -- subscription <--SubscriptionID-->
3terraform init
4terraform plan -out tf.plan
5terraform apply ./tf.plan

De esta forma tendremos nuestro proyecto completamente automatizado. Espero que le sirva de ayuda. Encuentre el código completo aquí

Saludos!