Skip to content

Commit 4d6dfe5

Browse files
Merge pull request #128 from oci-hpc/2.10.3_an_bastion_boot_vol_bkup
2.10.3 bastion boot volume backup
2 parents 3675953 + 7ba21f9 commit 4d6dfe5

File tree

3 files changed

+54
-2
lines changed

3 files changed

+54
-2
lines changed

bastion.tf

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,25 @@ resource "oci_core_volume_attachment" "bastion_volume_attachment" {
1717
device = "/dev/oracleoci/oraclevdb"
1818
}
1919

20+
resource "oci_core_volume_backup_policy" "bastion_boot_volume_backup_policy" {
21+
count = var.bastion_boot_volume_backup ? 1 : 0
22+
compartment_id = var.targetCompartment
23+
display_name = "${local.cluster_name}-bastion_boot_volume_daily"
24+
schedules {
25+
backup_type = var.bastion_boot_volume_backup_type
26+
period = var.bastion_boot_volume_backup_period
27+
retention_seconds = var.bastion_boot_volume_backup_retention_seconds
28+
time_zone = var.bastion_boot_volume_backup_time_zone
29+
}
30+
}
31+
32+
resource "oci_core_volume_backup_policy_assignment" "boot_volume_backup_policy" {
33+
count = var.bastion_boot_volume_backup ? 1 : 0
34+
depends_on = [oci_core_volume_backup_policy.bastion_boot_volume_backup_policy]
35+
asset_id = oci_core_instance.bastion.boot_volume_id
36+
policy_id = oci_core_volume_backup_policy.bastion_boot_volume_backup_policy[0].id
37+
}
38+
2039
resource "oci_resourcemanager_private_endpoint" "rms_private_endpoint" {
2140
count = var.private_deployment ? 1 : 0
2241
compartment_id = var.targetCompartment
@@ -26,6 +45,13 @@ resource "oci_resourcemanager_private_endpoint" "rms_private_endpoint" {
2645
subnet_id = local.subnet_id
2746
}
2847

48+
resource "null_resource" "boot_volume_backup_policy" {
49+
depends_on = [oci_core_instance.bastion, oci_core_volume_backup_policy.bastion_boot_volume_backup_policy, oci_core_volume_backup_policy_assignment.boot_volume_backup_policy]
50+
triggers = {
51+
bastion = oci_core_instance.bastion.id
52+
}
53+
}
54+
2955
resource "oci_core_instance" "bastion" {
3056
depends_on = [local.bastion_subnet]
3157
availability_domain = var.bastion_ad
@@ -150,6 +176,16 @@ resource "null_resource" "bastion" {
150176
private_key = tls_private_key.ssh.private_key_pem
151177
}
152178
}
179+
provisioner "file" {
180+
source = "scripts"
181+
destination = "/opt/oci-hpc/"
182+
connection {
183+
host = local.host
184+
type = "ssh"
185+
user = var.bastion_username
186+
private_key = tls_private_key.ssh.private_key_pem
187+
}
188+
}
153189
provisioner "file" {
154190
content = templatefile("${path.module}/configure.tpl", {
155191
configure = var.configure
@@ -256,7 +292,6 @@ resource "null_resource" "cluster" {
256292
}
257293
}
258294

259-
260295
provisioner "file" {
261296
content = var.node_count > 0 ? join("\n",local.cluster_instances_ips) : "\n"
262297
destination = "/tmp/hosts"
@@ -444,4 +479,4 @@ provisioner "file" {
444479
private_key = tls_private_key.ssh.private_key_pem
445480
}
446481
}
447-
}
482+
}

schema.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ variableGroups:
3434
- ${bastion_custom_memory}
3535
- ${bastion_memory}
3636
- ${bastion_boot_volume_size}
37+
- ${bastion_boot_volume_backup}
3738
- title: "Compute node options"
3839
variables:
3940
- ${use_multiple_ads}
@@ -188,6 +189,10 @@ variableGroups:
188189
- ${ssh_cidr}
189190
- ${marketplace_source_images}
190191
- ${marketplace_version_id}
192+
- ${bastion_boot_volume_backup_period}
193+
- ${bastion_boot_volume_backup_retention_seconds}
194+
- ${bastion_boot_volume_backup_time_zone}
195+
- ${bastion_boot_volume_backup_type}
191196
visible: false
192197
- title: "Debug"
193198
variables:
@@ -433,6 +438,13 @@ variables:
433438
minimum: 50
434439
title: "Size of the boot volume in GB"
435440
default: 50
441+
442+
bastion_boot_volume_backup:
443+
type: boolean
444+
title: "Enable boot volume backup"
445+
description: "Schedule: Daily, Type: Incremental, Start Time: 00:00 Regional Time, Retention: 90 days."
446+
default: true
447+
436448
bastion_block:
437449
type: boolean
438450
title: Additional block volume for shared space

variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ variable "custom_login_image" {
2626
default = "image.ocid"
2727
}
2828
variable "bastion_boot_volume_size" {}
29+
variable "bastion_boot_volume_backup" {}
30+
variable "bastion_boot_volume_backup_type" {default = "INCREMENTAL"}
31+
variable "bastion_boot_volume_backup_period" {default = "ONE_DAY"}
32+
variable "bastion_boot_volume_backup_retention_seconds" {default = "7776000"}
33+
variable "bastion_boot_volume_backup_time_zone" {default = "REGIONAL_DATA_CENTER_TIME"}
2934
variable "cluster_network_shape" { default = "BM.HPC2.36" }
3035
variable "instance_pool_shape" { default = "VM.Standard2.4" }
3136
variable "node_count" { default = 2 }

0 commit comments

Comments
 (0)