Skip to content

Commit d699082

Browse files
committed
101-create-resource-group
1 parent cefacf9 commit d699082

File tree

3 files changed

+72
-0
lines changed

3 files changed

+72
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
terraform {
2+
required_providers {
3+
azurerm = {
4+
source = "hashicorp/azurerm"
5+
version = "~>2.0"
6+
}
7+
}
8+
}
9+
10+
provider "azurerm" {
11+
features {}
12+
}
13+
14+
resource "azurerm_resource_group" "rg" {
15+
name = "${var.name}-${var.environment}-rg"
16+
location = "${var.location}"
17+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Create Azure resource group
2+
3+
This template deploys an Azure resource group.
4+
5+
## Resources
6+
7+
| Terraform Resource Type | Description |
8+
| - | - |
9+
| `azurerm_resource_group` | The resource group all resources are deployed into |
10+
11+
## Variables
12+
13+
| Name | Description |
14+
|-|-|
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 |
18+
19+
## Example
20+
21+
```bash
22+
terraform plan -out main.tfplan
23+
24+
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
25+
+ create
26+
27+
Terraform will perform the following actions:
28+
29+
# azurerm_resource_group.rg will be created
30+
+ resource "azurerm_resource_group" "rg" {
31+
+ id = (known after apply)
32+
+ location = "eastus"
33+
+ name = "sample-dev-rg"
34+
}
35+
36+
Plan: 1 to add, 0 to change, 0 to destroy.
37+
38+
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
39+
40+
Saved the plan to: main.tfplan
41+
42+
To perform exactly these actions, run the following command to apply:
43+
terraform apply "main.tfplan"
44+
```
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
variable "environment" {
2+
default = "dev"
3+
}
4+
5+
variable "name" {
6+
default = "sample"
7+
}
8+
9+
variable "location" {
10+
default = "eastus"
11+
}

0 commit comments

Comments
 (0)