File tree Expand file tree Collapse file tree 5 files changed +94
-0
lines changed
10_migration-backup/backup Expand file tree Collapse file tree 5 files changed +94
-0
lines changed Original file line number Diff line number Diff line change 1+ # main.tf
2+ # This file contains the main configuration for creating an Azure Data Protection Backup Vault.
3+
4+ resource "azurerm_resource_group" "backup" {
5+ name = var. resource_group_name
6+ location = var. location
7+ }
8+
9+ resource "azurerm_data_protection_backup_vault" "backup" {
10+ name = var. backup_vault_name
11+ resource_group_name = azurerm_resource_group. backup . name
12+ location = azurerm_resource_group. backup . location
13+ datastore_type = " VaultStore"
14+ redundancy = var. redundancy
15+ tags = var. tags
16+ }
Original file line number Diff line number Diff line change 1+ # outputs.tf
2+ # This file defines the outputs for the Azure Data Protection Backup Vault configuration.
3+
4+ output "backup_vault_id" {
5+ description = " The ID of the Data Protection Backup Vault"
6+ value = azurerm_data_protection_backup_vault. backup . id
7+ }
Original file line number Diff line number Diff line change 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+ }
Original file line number Diff line number Diff line change 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-backupvault-test"
10+ location = " eastus"
11+
12+ # Backup Vault
13+ backup_vault_name = " my-backup-vault"
14+ redundancy = " LocallyRedundant"
15+ tags = {
16+ Environment = " Backup"
17+ Owner = " IT"
18+ }
Original file line number Diff line number Diff line change 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 "backup_vault_name" {
20+ description = " The name of the Data Protection Backup Vault"
21+ type = string
22+ }
23+
24+ variable "redundancy" {
25+ description = " The redundancy setting for the backup vault (LocallyRedundant, GeoRedundant)"
26+ type = string
27+ default = " LocallyRedundant"
28+ }
29+
30+ variable "tags" {
31+ description = " A map of tags to assign to resources"
32+ type = map (string )
33+ default = {}
34+ }
You can’t perform that action at this time.
0 commit comments