Skip to content

Commit 55cdc3c

Browse files
authored
Merge pull request #30 from MicrosoftCloudEssentials-LearningHub/site-recovery
sample for site-recovery
2 parents a745f51 + c67497e commit 55cdc3c

File tree

6 files changed

+151
-0
lines changed

6 files changed

+151
-0
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Terraform Template - Azure Site Recovery (Recovery Services Vault)
2+
3+
Costa Rica
4+
5+
[![GitHub](https://img.shields.io/badge/--181717?logo=github&logoColor=ffffff)](https://github.com/)
6+
[brown9804](https://github.com/brown9804)
7+
8+
Last updated: 2025-06-13
9+
10+
----------
11+
12+
> This template contains Terraform configurations to create and manage an Azure Recovery Services Vault for Site Recovery.
13+
14+
<p align="center">
15+
<img width="700" alt="image" src="https://github.com/user-attachments/assets/05f960ad-18d2-4cc3-9229-21d81354bdd5">
16+
</p>
17+
18+
## File Descriptions
19+
20+
- **main.tf**: Contains the main configuration for creating the Recovery Services Vault.
21+
- **variables.tf**: Defines the input variables used in the Terraform configuration.
22+
- **terraform.tfvars**: Provides default values for the variables defined in `variables.tf`.
23+
- **outputs.tf**: Defines the outputs such as the Recovery Services Vault ID.
24+
25+
## Variables
26+
27+
| Variable Name | Description | Type | Example Value |
28+
|---------------------- |--------------------------------------------------|--------|-----------------------------|
29+
| `resource_group_name` | The name of the resource group | string | `"my-siterecovery-rg"` |
30+
| `location` | The Azure region to deploy resources | string | `"eastus"` |
31+
| `vault_name` | The name of the Recovery Services Vault | string | `"my-siterecovery-vault"` |
32+
| `sku` | The SKU for the Recovery Services Vault | string | `"Standard"` |
33+
| `tags` | A map of tags to assign to resources | map | `{ Environment = "SiteRecovery", Owner = "IT" }` |
34+
35+
## Usage
36+
37+
1. Clone the repository and navigate to the site-recovery directory.
38+
2. Update the `terraform.tfvars` file with your values.
39+
3. Initialize and apply the Terraform configuration:
40+
41+
```bash
42+
terraform init
43+
terraform plan
44+
terraform apply
45+
```
46+
47+
## Outputs
48+
49+
| Output Name | Description |
50+
|----------------------------|---------------------------------------------|
51+
| `recovery_services_vault_id` | The ID of the Recovery Services Vault |
52+
53+
<div align="center">
54+
<h3 style="color: #4CAF50;">Total Visitors</h3>
55+
<img src="https://profile-counter.glitch.me/brown9804/count.svg" alt="Visitor Count" style="border: 2px solid #4CAF50; border-radius: 5px; padding: 5px;"/>
56+
</div>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# main.tf
2+
# This file contains the main configuration for creating an Azure Recovery Services Vault.
3+
4+
# Resource Group for Site Recovery
5+
resource "azurerm_resource_group" "site_recovery" {
6+
name = var.resource_group_name
7+
location = var.location
8+
}
9+
10+
# Azure Recovery Services Vault for Site Recovery
11+
resource "azurerm_recovery_services_vault" "site_recovery" {
12+
name = var.vault_name
13+
location = azurerm_resource_group.site_recovery.location
14+
resource_group_name = azurerm_resource_group.site_recovery.name
15+
sku = var.sku
16+
tags = var.tags
17+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# outputs.tf
2+
# This file defines the outputs for the Azure Migrate configuration.
3+
4+
output "recovery_services_vault_id" {
5+
description = "The ID of the Recovery Services Vault"
6+
value = azurerm_recovery_services_vault.site_recovery.id
7+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# provider.tf
2+
# This file configures the Azure provider to interact with Azure resources.
3+
# It specifies the required provider and its version, along with provider-specific configurations.
4+
5+
terraform {
6+
required_version = ">= 1.8, < 2.0"
7+
# Specify the required provider and its version
8+
required_providers {
9+
azurerm = {
10+
source = "hashicorp/azurerm" # Source of the AzureRM provider
11+
version = "~> 4.16.0" # Version of the AzureRM provider
12+
}
13+
}
14+
}
15+
16+
provider "azurerm" {
17+
features {} # Enable all features for the AzureRM provider
18+
subscription_id = var.subscription_id # Use the subscription ID variable
19+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# terraform.tfvars
2+
# This file provides default values for the variables defined in variables.tf.
3+
# These values can be overridden by specifying different values during Terraform execution.
4+
5+
# Azure Subscription
6+
subscription_id = "" # "your-subscription-id"
7+
8+
# Resource Group
9+
resource_group_name = "RG-siterecorvery-test"
10+
location = "eastus"
11+
12+
# Recovery Services Vault Configuration
13+
vault_name = "my-siterecovery-vault"
14+
sku = "Standard"
15+
tags = {
16+
Environment = "SiteRecovery"
17+
Owner = "IT"
18+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# variables.tf
2+
# This file defines the input variables used in the Terraform configuration.
3+
4+
variable "subscription_id" {
5+
description = "The Azure subscription ID"
6+
type = string
7+
}
8+
9+
variable "resource_group_name" {
10+
description = "The name of the resource group"
11+
type = string
12+
}
13+
14+
variable "location" {
15+
description = "The Azure region to deploy resources"
16+
type = string
17+
}
18+
19+
variable "vault_name" {
20+
description = "The name of the Recovery Services Vault"
21+
type = string
22+
}
23+
24+
variable "sku" {
25+
description = "The SKU for the Recovery Services Vault (Standard or RS0)"
26+
type = string
27+
default = "Standard"
28+
}
29+
30+
variable "tags" {
31+
description = "A map of tags to assign to resources"
32+
type = map(string)
33+
default = {}
34+
}

0 commit comments

Comments
 (0)