Root Module Structure
Terraform configuration and variables
Input Variables
| Name | Description | Type |
|---|---|---|
resource_group_name |
Name of the Azure Resource Group where all resources will be created. | string |
name |
Name of the Azure Storage Account. | string |
account_tier |
Performance tier of the storage account (Standard or Premium). | string |
account_replication_type |
Replication strategy for the storage account such as LRS, GRS, RAGRS, or ZRS. | string |
container_name |
Name of the blob storage container used to store dataset files. | string |
container_access_type |
Access level for the container (private, blob, or container). In this lab it is set to private. | string |
virtual_network_name |
Name of the Virtual Network that will host the compute resources. | string |
address_space |
Address range used by the Virtual Network. | list(string) |
subnet_name |
Name of the subnet created inside the Virtual Network. | string |
address_prefixes |
Address ranges assigned to the subnet within the virtual network. | list(string) |
application_insights_name |
Name of the Azure Application Insights resource used for monitoring ML experiments. | string |
application_type |
Type of Application Insights instance being created. | string |
key_vault_name |
Name of the Azure Key Vault used to store secrets securely. | string |
secret_name |
Name of the secret that will be stored inside the Key Vault. | string |
sku_name |
SKU or pricing tier used for the Key Vault. | string |
workspace_name |
Name of the Azure Machine Learning Workspace. | string |
type |
Type of Managed Identity assigned to the ML workspace (for example SystemAssigned). | string |
datastore_name |
Name of the Azure Machine Learning datastore that connects to blob storage. | string |
ml_instance_name |
Name of the Machine Learning Compute Instance. | string |
machine_size |
Virtual machine size used for the compute instance. | string |
authorization_type |
Authorization type used for the ML compute instance. | string |
object_id |
Azure Active Directory Object ID of the user to whom the compute instance will be assigned. | string |
description |
Description assigned to the Machine Learning Compute Instance. | string |
tags |
Tags assigned to the compute instance for resource organization. | object({ name = string }) |
Output Variables
| Name | Description |
|---|---|
storage_account_id |
The unique resource ID of the Azure Storage Account created in the storage module. This ID can be referenced by other modules or resources that need to interact with the storage account. |
storage_container_name |
The name of the blob storage container created inside the storage account. This container stores the dataset files used for machine learning experiments. |
storage_primary_key |
The primary access key of the Azure Storage Account. This key allows services to authenticate and access the storage account securely. It is marked as sensitive because it contains confidential credentials. |
primary_connection_string |
The primary connection string of the storage account. This connection string is used to securely connect applications or services (such as ML datastore configuration) to the storage account. It is also marked as sensitive. |
subnet_id |
The resource ID of the subnet created in the network module. This value is passed to the Machine Learning module so that the ML compute instance can be deployed inside the subnet. |
key_id |
The ID of the Key Vault secret created in the key vault module. This identifies the secret stored in Azure Key Vault that contains the storage account connection string. |
instance_id |
The resource ID of the Azure Machine Learning Compute Instance created in the machine learning module. This output can be used to reference or manage the compute instance after deployment. |
How Output Variables Are Accessed from Modules in Terraform
In Terraform, output variables are used to share important information from one module so that it can be used by another module or by the root module.
When resources are created inside a child module, some of their values (such as IDs, connection strings, or names) may be needed outside that module. To make these values available, they are defined in the child module using output variables.
Once an output variable is defined inside a child module, it can be accessed in the root module using the following format:
module.<module_name>.<output_variable_name>
How This Works
- A resource is created inside a child module.
- The important value from that resource (for example a storage account ID) is defined as an output variable in the child module.
- The root module calls the child module.
- The root module can then access the output using:
module.<module_name>.<output_name>
Example
If the storage module defines an output variable called:
output "storage_account_id"
Then the root module can access this value as:
module.storage.storage_account_id
Here:
moduletells Terraform that we are accessing a modulestorageis the name of the modulestorage_account_idis the output variable defined inside that module
Output variables make Terraform modules reusable and allow different parts of your infrastructure to communicate without hardcoding resource IDs or connection strings.