Skip to content

Commit fa0ee0b

Browse files
authored
Merge pull request microsoft#69 from TomArcherMsft/UserStory1866077-Code
User Story 1866077 Code
2 parents 22cf568 + 01c7abe commit fa0ee0b

File tree

4 files changed

+20
-13
lines changed

4 files changed

+20
-13
lines changed

quickstart/101-resource-group/main.tf

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ provider "azurerm" {
1414
features {}
1515
}
1616

17+
resource "random_pet" "rg-name" {
18+
prefix = var.resource_group_name_prefix
19+
}
20+
1721
resource "azurerm_resource_group" "rg" {
18-
name = var.resource_group_name
19-
location = var.resource_group_location
20-
}
22+
name = random_pet.rg-name.id
23+
location = var.resource_group_location
24+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
output "resource_group_name" {
2+
value = azurerm_resource_group.rg.name
3+
}

quickstart/101-resource-group/readme.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
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_pet](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/pet)
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` | (Optional) Prefix of the resource group name that's combined with a random ID so name is unique in your Azure subscription. Value defaults to: rg|
15+
| `resource_group_location` | (Optional) Azure Region in which to deploy these resources. Value defaults to: eastus |
1816

1917
## Example
2018

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
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 ID so name is unique in your Azure subscription."
34
}
45

56
variable "resource_group_location" {
67
default = "eastus"
8+
description = "Location of the resource group."
79
}

0 commit comments

Comments
 (0)