101-create-resource-group

This commit is contained in:
Tom Archer 2021-07-27 18:25:12 -07:00
parent cefacf9966
commit d699082efb
3 changed files with 72 additions and 0 deletions

View File

@ -0,0 +1,17 @@
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>2.0"
}
}
}
provider "azurerm" {
features {}
}
resource "azurerm_resource_group" "rg" {
name = "${var.name}-${var.environment}-rg"
location = "${var.location}"
}

View File

@ -0,0 +1,44 @@
# Create Azure resource group
This template deploys an Azure resource group.
## Resources
| Terraform Resource Type | Description |
| - | - |
| `azurerm_resource_group` | The resource group all resources are deployed into |
## Variables
| Name | Description |
|-|-|
| `name` | Name of the deployment |
| `environment` | The depolyment environment name (used for postfixing resource names) |
| `location` | The Azure Region to deploy these resources in |
## Example
```bash
terraform plan -out main.tfplan
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_resource_group.rg will be created
+ resource "azurerm_resource_group" "rg" {
+ id = (known after apply)
+ location = "eastus"
+ name = "sample-dev-rg"
}
Plan: 1 to add, 0 to change, 0 to destroy.
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Saved the plan to: main.tfplan
To perform exactly these actions, run the following command to apply:
terraform apply "main.tfplan"
```

View File

@ -0,0 +1,11 @@
variable "environment" {
default = "dev"
}
variable "name" {
default = "sample"
}
variable "location" {
default = "eastus"
}