Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions 10_migration-backup/backup/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Terraform Template - Azure Data Protection Backup Vault

Costa Rica

[![GitHub](https://img.shields.io/badge/--181717?logo=github&logoColor=ffffff)](https://github.com/)
[brown9804](https://github.com/brown9804)

Last updated: 2025-06-13

----------

> This template contains Terraform configurations to create and manage an Azure Data Protection Backup Vault.

<p align="center">
<img width="700" alt="image" src="https://github.com/user-attachments/assets/31b1d21a-2f0d-43d6-8898-22524685e425">
</p>

## File Descriptions

- **main.tf**: Contains the main configuration for creating the Data Protection Backup Vault.
- **variables.tf**: Defines the input variables used in the Terraform configuration.
- **terraform.tfvars**: Provides default values for the variables defined in `variables.tf`.
- **outputs.tf**: Defines the outputs such as the Backup Vault ID.

## Variables

| Variable Name | Description | Type | Example Value |
|---------------------- |--------------------------------------------------|--------|-----------------------------|
| `resource_group_name` | The name of the resource group | string | `"my-backup-rg"` |
| `location` | The Azure region to deploy resources | string | `"eastus"` |
| `backup_vault_name` | The name of the Data Protection Backup Vault | string | `"my-backup-vault"` |
| `redundancy` | The redundancy setting for the backup vault | string | `"LocallyRedundant"` |
| `tags` | A map of tags to assign to resources | map | `{ Environment = "Backup", Owner = "IT" }` |

## Usage

1. Clone the repository and navigate to the backup directory.
2. Update the `terraform.tfvars` file with your values.
3. Initialize and apply the Terraform configuration:

```bash
terraform init
terraform plan
terraform apply
```

## Outputs

| Output Name | Description |
|------------------|---------------------------------------------|
| `backup_vault_id`| The ID of the Data Protection Backup Vault |

<div align="center">
<h3 style="color: #4CAF50;">Total Visitors</h3>
<img src="https://profile-counter.glitch.me/brown9804/count.svg" alt="Visitor Count" style="border: 2px solid #4CAF50; border-radius: 5px; padding: 5px;"/>
</div>
16 changes: 16 additions & 0 deletions 10_migration-backup/backup/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# main.tf
# This file contains the main configuration for creating an Azure Data Protection Backup Vault.

resource "azurerm_resource_group" "backup" {
name = var.resource_group_name
location = var.location
}

resource "azurerm_data_protection_backup_vault" "backup" {
name = var.backup_vault_name
resource_group_name = azurerm_resource_group.backup.name
location = azurerm_resource_group.backup.location
datastore_type = "VaultStore"
redundancy = var.redundancy
tags = var.tags
}
7 changes: 7 additions & 0 deletions 10_migration-backup/backup/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# outputs.tf
# This file defines the outputs for the Azure Data Protection Backup Vault configuration.

output "backup_vault_id" {
description = "The ID of the Data Protection Backup Vault"
value = azurerm_data_protection_backup_vault.backup.id
}
19 changes: 19 additions & 0 deletions 10_migration-backup/backup/provider.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# provider.tf
# This file configures the Azure provider to interact with Azure resources.
# It specifies the required provider and its version, along with provider-specific configurations.

terraform {
required_version = ">= 1.8, < 2.0"
# Specify the required provider and its version
required_providers {
azurerm = {
source = "hashicorp/azurerm" # Source of the AzureRM provider
version = "~> 4.16.0" # Version of the AzureRM provider
}
}
}

provider "azurerm" {
features {} # Enable all features for the AzureRM provider
subscription_id = var.subscription_id # Use the subscription ID variable
}
18 changes: 18 additions & 0 deletions 10_migration-backup/backup/terraform.tfvars
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# terraform.tfvars
# This file provides default values for the variables defined in variables.tf.
# These values can be overridden by specifying different values during Terraform execution.

# Azure Subscription
subscription_id = "" # "your-subscription-id"

# Resource Group
resource_group_name = "RG-backupvault-test"
location = "eastus"

# Backup Vault
backup_vault_name = "my-backup-vault"
redundancy = "LocallyRedundant"
tags = {
Environment = "Backup"
Owner = "IT"
}
34 changes: 34 additions & 0 deletions 10_migration-backup/backup/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# variables.tf
# This file defines the input variables used in the Terraform configuration.

variable "subscription_id" {
description = "The Azure subscription ID"
type = string
}

variable "resource_group_name" {
description = "The name of the resource group"
type = string
}

variable "location" {
description = "The Azure region to deploy resources"
type = string
}

variable "backup_vault_name" {
description = "The name of the Data Protection Backup Vault"
type = string
}

variable "redundancy" {
description = "The redundancy setting for the backup vault (LocallyRedundant, GeoRedundant)"
type = string
default = "LocallyRedundant"
}

variable "tags" {
description = "A map of tags to assign to resources"
type = map(string)
default = {}
}