Files
hunfabric/modules/backup-dr
Hemanand eaa420534b Add agent engine BYOC support (#3885)
* feat(agent-engine): add support for container and custom image specs

- Add container_config to deployment_files.
- Add image_spec with build_args to source_config.
- Make agent_framework optional and document supported values.
- Implement dynamic specs for container and source deployments.
- Add examples and automated tests for new deployment types.

* chore: update Google provider version to 7.28.0 across modules

Mechanical update of versions.tf and versions.tofu files using tools/versions.py.

* feat(agent-engine): refactor for container deployments and API alignment

- Group deployment settings under 'deployment_config' (renamed from 'deployment_files').
- Support container-based deployments via 'container_config' and 'image_spec'.
- Refactor 'source_files_config' (renamed from 'source_config') to include mutually exclusive 'python_spec' and 'image_spec'.
- Support 'developer_connect_config' as a source code type.
- Group engine settings (framework, env, secrets) under 'agent_engine_config'.
- Add support for 'memory_bank_config' persistent memory.
- Overhaul reasoning engine resources with dynamic blocks to match provider schema.
- Update all documentation examples, add TOC, and refresh test inventories.

* Update dynamic python_spec block and related example yamls

* Ignore changes setting for developer_connect_source under lifecycle management

* fixing review comments for `try` and default path for `source_path`

---------

Co-authored-by: Hemanand <hemr@google.com>
Co-authored-by: Julio Castillo <jccb@google.com>
2026-04-21 17:46:20 +00:00
..
2026-04-18 10:07:14 +02:00
2026-04-18 10:07:14 +02:00
2026-04-18 10:07:14 +02:00

Terraform Google Backup DR Plan

This Terraform module creates a Google Cloud Backup and DR backup plan and, optionally, a backup vault.

Description

This module allows you to define a backup plan for your Google Cloud resources. You can specify backup rules, including schedules and retention policies. The module can also create a new backup vault or use an existing one.

Examples

Create backup vault (basic usage)

module "dr_example" {
  source     = "./fabric/modules/backup-dr"
  project_id = "your-gcp-project-id"
  location   = "us-central1"
  name       = "backup-vault-01"
}
# tftest modules=1 resources=1

Create backup vault (extended options)

module "dr_example" {
  source     = "./fabric/modules/backup-dr"
  project_id = "your-gcp-project-id"
  location   = "us-central1"
  name       = "backup-vault"
  vault_config = {
    access_restriction = "WITHIN_ORGANIZATION"
    annotations = {
      "key" = "value"
    }
    backup_minimum_enforced_retention_duration = "100000s"
    backup_retention_inheritance               = "INHERIT_VAULT_RETENTION"
    description                                = "Backup Vault managed by Terraform IAC."
    allow_missing                              = false
    force_update                               = false
    ignore_backup_plan_references              = false
    ignore_inactive_datasources                = false
    labels = {
      "key" = "value"
    }
  }
}
# tftest inventory=extended.yaml

Create vault and plan

module "dr_example" {
  source     = "./fabric/modules/backup-dr"
  project_id = "your-gcp-project-id"
  location   = "us-central1"
  name       = "backup-vault"

  backup_plans = {
    my-backup-plan = {
      resource_type = "compute.googleapis.com/Instance"
      description   = "Backup Plan for GCE Instances."
      backup_rules = [
        {
          rule_id               = "daily-backup-rule"
          backup_retention_days = 30
          standard_schedule = {
            recurrence_type  = "HOURLY"
            hourly_frequency = 6
            time_zone        = "America/Los_Angeles"
            backup_window = {
              start_hour_of_day = 1
              end_hour_of_day   = 5
            }
          }
        },
        {
          rule_id               = "monthly-backup-rule"
          backup_retention_days = 30
          standard_schedule = {
            recurrence_type = "MONTHLY"
            time_zone       = "America/Los_Angeles"
            week_day_of_month = {
              week_of_month = "FIRST"
              day_of_week   = "MONDAY"
            }
            backup_window = {
              start_hour_of_day = 1
              end_hour_of_day   = 5
            }
          }
        }
      ]
    }
  }
}
# tftest inventory=vault-plan.yaml

Create only backup plan with existing vault

module "dr_example" {
  source     = "./fabric/modules/backup-dr"
  project_id = "your-gcp-project-id"
  location   = "us-central1"

  vault_reuse = {
    vault_id = "backup-vault-test"
  }

  backup_plans = {
    "my-backup-plan" = {
      resource_type = "compute.googleapis.com/Instance"
      description   = "Backup Plan for GCE Instances."
      backup_rules = [
        {
          rule_id               = "daily-backup-rule"
          backup_retention_days = 30
          standard_schedule = {
            recurrence_type  = "HOURLY"
            hourly_frequency = 6
            time_zone        = "America/Los_Angeles"
            backup_window = {
              start_hour_of_day = 1
              end_hour_of_day   = 5
            }
          }
        },
        {
          rule_id               = "monthly-backup-rule"
          backup_retention_days = 30
          standard_schedule = {
            recurrence_type = "MONTHLY"
            time_zone       = "America/Los_Angeles"
            week_day_of_month = {
              week_of_month = "FIRST"
              day_of_week   = "MONDAY"
            }
            backup_window = {
              start_hour_of_day = 1
              end_hour_of_day   = 5
            }
          }
        }
      ]
    }
  }
}
# tftest inventory=reuse.yaml

Create management_server

module "dr_example" {
  source     = "./fabric/modules/backup-dr"
  project_id = "your-gcp-project-id"
  location   = "us-central1"

  management_server_config = {
    name     = "backup-dr-mgmt-server"
    location = "us-central1"
    type     = "BACKUP_RESTORE"
    network_config = {
      network      = "default"
      peering_mode = "PRIVATE_SERVICE_ACCESS"
    }
  }
}
# tftest inventory=server.yaml

Variables

name description type required default
location Location for the Backup Vault and Plans (e.g. us-central1). string
project_id Project ID. string
backup_plans Map of Backup Plans to create in this Vault. map(object({…})) {}
management_server_config Configuration to create a Management Server. If null, no server is created. object({…}) null
name Name of the Backup Vault to create. Leave null if reusing an existing vault via vault_reuse. string null
vault_config Configuration for the Backup Vault. Only used if vault_reuse is null. object({…}) {}
vault_reuse Configuration to reuse an existing Backup Vault. object({…}) null

Outputs

name description sensitive
backup_plans The ID of the created Backup Plans.
backup_vault_id The ID of the Backup Vault.
management_server The Management Server created.
management_server_uri The Management Server ID created.