Skip to content

Commit 200cd33

Browse files
authored
sample for site-recovery
1 parent 53a4e5e commit 200cd33

File tree

5 files changed

+95
-0
lines changed

5 files changed

+95
-0
lines changed
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)