Incorporate review feedback
This commit is contained in:
parent
9a5792ab3f
commit
60bba8f8af
@ -1,5 +1,5 @@
|
|||||||
# Managed Lustre create filesystem
|
# Azure Managed Lustre
|
||||||
This template deploys a Managed Lustre filesystem.
|
This template deploys an Azure Managed Lustre file system.
|
||||||
|
|
||||||
## Terraform resource types
|
## Terraform resource types
|
||||||
|
|
||||||
@ -7,81 +7,23 @@ This template deploys a Managed Lustre filesystem.
|
|||||||
- [azurerm_virtual_network](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/virtual_network)
|
- [azurerm_virtual_network](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/virtual_network)
|
||||||
- [azurerm_subnet](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/subnet)
|
- [azurerm_subnet](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/subnet)
|
||||||
- [azurerm_managed_lustre_file_system](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/managed_lustre_file_system)
|
- [azurerm_managed_lustre_file_system](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/managed_lustre_file_system)
|
||||||
|
- [random_pet](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/pet)
|
||||||
|
- [random_string](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/string)
|
||||||
|
|
||||||
## Variables
|
## Variables
|
||||||
|
|
||||||
| Name | Description |
|
| Name | Description | Default value |
|
||||||
|-|-|
|
|-|-|-|
|
||||||
| `rg_location` | Resource group location |
|
| `resource_group_name_prefix` | Prefix of the resource group name that's combined with a random ID so name is unique in your Azure subscription. | rg |
|
||||||
| `amlfs_sku_name` | SKU name for the Azure Managed Lustre file system |
|
| `resource_group_location` | Location of the resource group. | eastus |
|
||||||
| `amlfs_storage_capacity_in_tb` | The size of the AML file system, in TiB. This might be rounded up. |
|
| `virtual_network_name` | Name of the virtual network resource. | "" |
|
||||||
| `amlfs_maintenance_day_of_week` | Day of the week on which the maintenance window will occur |
|
| `subnet_name` | Name of the virtual network subnet. | "" |
|
||||||
| `amlfs_maintenance_time_of_day` | The time of day (in UTC) to start the maintenance window |
|
| `amlfs_name` | Name of the Managed Lustre file system resource. | "" |
|
||||||
|
| `amlfs_sku_name` | SKU name for the Azure Managed Lustre file system. Possible values are: AMLFS-Durable-Premium-40, AMLFS-Durable-Premium-125, AMLFS-Durable-Premium-250, and AMLFS-Durable-Premium-500. | AMLFS-Durable-Premium-40 |
|
||||||
|
| `amlfs_storage_capacity_in_tb` | The size of the AML file system, in TiB. This might be rounded up. | 48 |
|
||||||
|
| `amlfs_maintenance_day_of_week` | Day of the week on which the maintenance window will occur. Possible values are: Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, and Saturday. | Saturday |
|
||||||
|
| `amlfs_maintenance_time_of_day` | The time of day (in UTC) to start the maintenance window. | 02:00 |
|
||||||
|
|
||||||
## Usage
|
## Example
|
||||||
|
|
||||||
```bash
|
To see how to run this example, see [Create an Azure Managed Lustre file system using Terraform](https://learn.microsoft.com/azure/azure-managed-lustre/create-aml-file-system-terraform).
|
||||||
> terraform plan
|
|
||||||
|
|
||||||
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
|
|
||||||
+ create
|
|
||||||
|
|
||||||
Terraform will perform the following actions:
|
|
||||||
|
|
||||||
# azurerm_managed_lustre_file_system.example will be created
|
|
||||||
+ resource "azurerm_managed_lustre_file_system" "example" {
|
|
||||||
+ id = (known after apply)
|
|
||||||
+ location = "eastus"
|
|
||||||
+ name = (known after apply)
|
|
||||||
+ resource_group_name = (known after apply)
|
|
||||||
+ sku_name = "AMLFS-Durable-Premium-40"
|
|
||||||
+ storage_capacity_in_tb = 48
|
|
||||||
+ subnet_id = (known after apply)
|
|
||||||
+ zones = [
|
|
||||||
+ "1",
|
|
||||||
]
|
|
||||||
|
|
||||||
+ maintenance_window {
|
|
||||||
+ day_of_week = "Saturday"
|
|
||||||
+ time_of_day_in_utc = "02:00"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# azurerm_resource_group.example will be created
|
|
||||||
+ resource "azurerm_resource_group" "example" {
|
|
||||||
+ id = (known after apply)
|
|
||||||
+ location = "eastus"
|
|
||||||
+ name = (known after apply)
|
|
||||||
}
|
|
||||||
|
|
||||||
# azurerm_subnet.example will be created
|
|
||||||
+ resource "azurerm_subnet" "example" {
|
|
||||||
+ address_prefixes = [
|
|
||||||
+ "10.0.2.0/24",
|
|
||||||
]
|
|
||||||
+ enforce_private_link_endpoint_network_policies = (known after apply)
|
|
||||||
+ enforce_private_link_service_network_policies = (known after apply)
|
|
||||||
+ id = (known after apply)
|
|
||||||
+ name = (known after apply)
|
|
||||||
+ private_endpoint_network_policies_enabled = (known after apply)
|
|
||||||
+ private_link_service_network_policies_enabled = (known after apply)
|
|
||||||
+ resource_group_name = (known after apply)
|
|
||||||
+ virtual_network_name = (known after apply)
|
|
||||||
}
|
|
||||||
|
|
||||||
# azurerm_virtual_network.example will be created
|
|
||||||
+ resource "azurerm_virtual_network" "example" {
|
|
||||||
+ address_space = [
|
|
||||||
+ "10.0.0.0/16",
|
|
||||||
]
|
|
||||||
+ dns_servers = (known after apply)
|
|
||||||
+ guid = (known after apply)
|
|
||||||
+ id = (known after apply)
|
|
||||||
+ location = "eastus"
|
|
||||||
+ name = (known after apply)
|
|
||||||
+ resource_group_name = (known after apply)
|
|
||||||
+ subnet = (known after apply)
|
|
||||||
}
|
|
||||||
|
|
||||||
Plan: 4 to add, 0 to change, 0 to destroy.
|
|
||||||
```
|
|
||||||
|
@ -1,26 +1,54 @@
|
|||||||
resource "azurerm_resource_group" "example" {
|
resource "random_pet" "rg_name" {
|
||||||
name = "${random_pet.prefix.id}-rg"
|
prefix = var.resource_group_name_prefix
|
||||||
location = var.rg_location
|
}
|
||||||
|
|
||||||
|
resource "azurerm_resource_group" "rg" {
|
||||||
|
name = "${random_pet.rg_name.id}"
|
||||||
|
location = var.resource_group_location
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "random_string" "azurerm_virtual_network_name" {
|
||||||
|
length = 13
|
||||||
|
lower = true
|
||||||
|
numeric = false
|
||||||
|
special = false
|
||||||
|
upper = false
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "azurerm_virtual_network" "example" {
|
resource "azurerm_virtual_network" "example" {
|
||||||
name = "${random_pet.prefix.id}-vnet"
|
name = coalesce(var.virtual_network_name, "vnet-${random_string.azurerm_virtual_network_name.result}")
|
||||||
resource_group_name = azurerm_resource_group.example.name
|
resource_group_name = azurerm_resource_group.rg.name
|
||||||
address_space = ["10.0.0.0/16"]
|
address_space = ["10.0.0.0/16"]
|
||||||
location = azurerm_resource_group.example.location
|
location = azurerm_resource_group.rg.location
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "random_string" "azurerm_subnet_name" {
|
||||||
|
length = 13
|
||||||
|
lower = true
|
||||||
|
numeric = false
|
||||||
|
special = false
|
||||||
|
upper = false
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "azurerm_subnet" "example" {
|
resource "azurerm_subnet" "example" {
|
||||||
name = "${random_pet.prefix.id}-subnet"
|
name = coalesce(var.subnet_name, "subnet-${random_string.azurerm_subnet_name.result}")
|
||||||
resource_group_name = azurerm_resource_group.example.name
|
resource_group_name = azurerm_resource_group.rg.name
|
||||||
virtual_network_name = azurerm_virtual_network.example.name
|
virtual_network_name = azurerm_virtual_network.example.name
|
||||||
address_prefixes = ["10.0.2.0/24"]
|
address_prefixes = ["10.0.2.0/24"]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
resource "random_string" "azurerm_amlfs_name" {
|
||||||
|
length = 13
|
||||||
|
lower = true
|
||||||
|
numeric = false
|
||||||
|
special = false
|
||||||
|
upper = false
|
||||||
|
}
|
||||||
|
|
||||||
resource "azurerm_managed_lustre_file_system" "example" {
|
resource "azurerm_managed_lustre_file_system" "example" {
|
||||||
name = "${random_pet.prefix.id}"
|
name = coalesce(var.amlfs_name, "amlfs-${random_string.azurerm_amlfs_name.result}")
|
||||||
resource_group_name = azurerm_resource_group.example.name
|
resource_group_name = azurerm_resource_group.rg.name
|
||||||
location = azurerm_resource_group.example.location
|
location = azurerm_resource_group.rg.location
|
||||||
sku_name = var.amlfs_sku_name
|
sku_name = var.amlfs_sku_name
|
||||||
subnet_id = azurerm_subnet.example.id
|
subnet_id = azurerm_subnet.example.id
|
||||||
storage_capacity_in_tb = var.amlfs_storage_capacity_in_tb
|
storage_capacity_in_tb = var.amlfs_storage_capacity_in_tb
|
||||||
@ -30,8 +58,3 @@ resource "azurerm_managed_lustre_file_system" "example" {
|
|||||||
time_of_day_in_utc = var.amlfs_maintenance_time_of_day
|
time_of_day_in_utc = var.amlfs_maintenance_time_of_day
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "random_pet" "prefix" {
|
|
||||||
prefix = var.prefix
|
|
||||||
length = 1
|
|
||||||
}
|
|
@ -1,3 +1,7 @@
|
|||||||
|
output "resource_group_name" {
|
||||||
|
value = azurerm_resource_group.example.name
|
||||||
|
}
|
||||||
|
|
||||||
output "virtual_network_name" {
|
output "virtual_network_name" {
|
||||||
value = azurerm_virtual_network.example.name
|
value = azurerm_virtual_network.example.name
|
||||||
}
|
}
|
||||||
|
@ -4,11 +4,11 @@ terraform {
|
|||||||
required_providers {
|
required_providers {
|
||||||
azurerm = {
|
azurerm = {
|
||||||
source = "hashicorp/azurerm"
|
source = "hashicorp/azurerm"
|
||||||
version = ">= 3.0, < 4.0"
|
version = "~> 3.0, < 4.0"
|
||||||
}
|
}
|
||||||
random = {
|
random = {
|
||||||
source = "hashicorp/random"
|
source = "hashicorp/random"
|
||||||
version = ">= 3.0"
|
version = "~> 3.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,19 +1,41 @@
|
|||||||
variable "prefix" {
|
variable "resource_group_name_prefix" {
|
||||||
type = string
|
type = string
|
||||||
default = "managed-lustre-file-system"
|
default = "rg"
|
||||||
description = "Prefix of the resource name"
|
description = "Prefix of the resource group name that's combined with a random ID so name is unique in your Azure subscription."
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "rg_location" {
|
variable "resource_group_location" {
|
||||||
type = string
|
type = string
|
||||||
default = "eastus"
|
default = "eastus"
|
||||||
description = "Resource group location"
|
description = "Location of the resource group."
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "virtual_network_name" {
|
||||||
|
type = string
|
||||||
|
description = "The name of the virtual network resource. The value will be randomly generated if blank."
|
||||||
|
default = ""
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "subnet_name" {
|
||||||
|
type = string
|
||||||
|
description = "The name of the virtual network subnet. The value will be randomly generated if blank."
|
||||||
|
default = ""
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "amlfs_name" {
|
||||||
|
type = string
|
||||||
|
description = "The name of the Manage Lustre file system resource. The value will be randomly generated if blank."
|
||||||
|
default = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "amlfs_sku_name" {
|
variable "amlfs_sku_name" {
|
||||||
type = string
|
type = string
|
||||||
default = "AMLFS-Durable-Premium-40"
|
default = "AMLFS-Durable-Premium-40"
|
||||||
description = "SKU name for the Azure Managed Lustre file system"
|
validation {
|
||||||
|
condition = contains(["AMLFS-Durable-Premium-40", "AMLFS-Durable-Premium-125", "AMLFS-Durable-Premium-250", "AMLFS-Durable-Premium-500"], var.amlfs_sku_name)
|
||||||
|
error_message = "The SKU value must be one of the following: AMLFS-Durable-Premium-40, AMLFS-Durable-Premium-125, AMLFS-Durable-Premium-250, AMLFS-Durable-Premium-500."
|
||||||
|
}
|
||||||
|
description = "SKU name for the Azure Managed Lustre file system."
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "amlfs_storage_capacity_in_tb" {
|
variable "amlfs_storage_capacity_in_tb" {
|
||||||
@ -25,11 +47,15 @@ variable "amlfs_storage_capacity_in_tb" {
|
|||||||
variable "amlfs_maintenance_day_of_week" {
|
variable "amlfs_maintenance_day_of_week" {
|
||||||
type = string
|
type = string
|
||||||
default = "Saturday"
|
default = "Saturday"
|
||||||
description = "Day of the week on which the maintenance window will occur"
|
validation {
|
||||||
|
condition = contains(["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], var.amlfs_maintenance_day_of_week)
|
||||||
|
error_message = "The maintenance day of week value must be one of the following: Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday."
|
||||||
|
}
|
||||||
|
description = "Day of the week on which the maintenance window will occur."
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "amlfs_maintenance_time_of_day" {
|
variable "amlfs_maintenance_time_of_day" {
|
||||||
type = string
|
type = string
|
||||||
default = "02:00"
|
default = "02:00"
|
||||||
description = "The time of day (in UTC) to start the maintenance window"
|
description = "The time of day (in UTC) to start the maintenance window."
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user