File tree Expand file tree Collapse file tree
quickstart/101-resource-group Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -14,7 +14,9 @@ provider "azurerm" {
1414 features {}
1515}
1616
17+ resource "random_uuid" "uuid" {}
18+
1719resource "azurerm_resource_group" "rg" {
18- name = var. resource_group_name
19- location = var. resource_group_location
20- }
20+ name = " ${ var . resource_group_name_prefix } - ${ random_uuid . uuid . result } "
21+ location = var. resource_group_location
22+ }
Original file line number Diff line number Diff line change 1+ output "resource_group_name" {
2+ value = azurerm_resource_group. rg . name
3+ }
Original file line number Diff line number Diff line change 11# Azure resource group
22
3- This template deploys an Azure resource group.
3+ This template deploys an Azure resource group with a random name beginning with "rg-" .
44
5- ## Resources
5+ ## Terraform resource types
66
7- | Terraform Resource Type | Description |
8- | - | - |
9- | ` azurerm_resource_group ` | The resource group all resources are deployed into |
7+ - [ random_uuid] ( https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/uuid )
8+ - [ azurerm_resource_group] ( https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/resource_group )
109
1110## Variables
1211
1312| Name | Description |
1413| -| -|
15- | ` name ` | Name of the deployment |
16- | ` environment ` | The depolyment environment name (used for postfixing resource names) |
17- | ` location ` | The Azure Region to deploy these resources in |
14+ | ` resource_group_name_prefix ` | Prefix of the resource group name that's combined with a random number so name is unique in your Azure subscription. |
15+ | ` resource_group_location ` | The Azure Region to deploy these resources in |
1816
1917## Example
2018
Original file line number Diff line number Diff line change 1- variable "resource_group_name" {
2- default = " myResourceGroup"
1+ variable "resource_group_name_prefix" {
2+ default = " rg"
3+ description = " Prefix of the resource group name that's combined with a random number so name is unique in your Azure subscription."
34}
45
56variable "resource_group_location" {
You can’t perform that action at this time.
0 commit comments