What I do
Help create and manage Azure Resource Groups:
- •Define resource group configurations
- •Apply proper naming conventions
- •Configure tags and locations
- •Handle resource group dependencies
When to use me
Use this skill when:
- •Creating a new Azure resource group
- •Organizing resources by environment or project
- •Setting up the foundation for other Azure resources
Resource Template
hcl
# Basic Resource Group
resource "azurerm_resource_group" "main" {
name = "${var.project_name}-${var.environment}-rg"
location = var.location
tags = {
Environment = var.environment
Project = var.project_name
ManagedBy = "Terraform"
}
}
# With lifecycle protection
resource "azurerm_resource_group" "protected" {
name = "${var.project_name}-${var.environment}-rg"
location = var.location
tags = local.common_tags
lifecycle {
prevent_destroy = true
}
}
Variables Needed
hcl
variable "location" {
description = "Azure region"
type = string
default = "eastus"
}
Outputs
hcl
output "resource_group_name" {
description = "The name of the resource group"
value = azurerm_resource_group.main.name
}
output "resource_group_id" {
description = "The ID of the resource group"
value = azurerm_resource_group.main.id
}
output "resource_group_location" {
description = "The location of the resource group"
value = azurerm_resource_group.main.location
}
Best Practices
- •Use consistent naming:
{project}-{environment}-rg - •Always apply tags for cost management
- •Group related resources together
- •Consider region for compliance requirements