Skip to content

Commit

Permalink
backup target example
Browse files Browse the repository at this point in the history
  • Loading branch information
Haroon-Dweikat-Ntx committed Dec 25, 2024
1 parent 0a416d5 commit fe5209c
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 1 deletion.
62 changes: 62 additions & 0 deletions examples/backup_target_v2/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
terraform {
required_providers {
nutanix = {
source = "nutanix/nutanix"
version = "2.1"
}
}
}

#defining nutanix configuration
provider "nutanix" {
username = var.nutanix_username
password = var.nutanix_password
endpoint = var.nutanix_endpoint
port = 9440
insecure = true
}

// using cluster_location
resource "nutanix_backup_target_v2" "example-1" {
domain_manager_ext_id = "<domain_manager_uuid>"
location {
cluster_location {
config {
ext_id = "cluster uuid"
}
}
}
}

// using object_store_location
resource "nutanix_backup_target_v2" "example-2" {
domain_manager_ext_id = "<domain_manager_uuid>"
location {
object_store_location {
provider_config {
bucket_name = "bucket name"
region = "region"
credentials {
access_key_id = "id"
secret_access_key = "key"
}
}
backup_policy {
rpo_in_minutes = 0
}
}
}
}

// list backup targets
data "nutanix_backup_targets_v2" "backup-targets" {
domain_manager_ext_id = "<domain_manager_uuid>"
}

// get backup target
data "nutanix_backup_target_v2" "backup-target" {
domain_manager_ext_id = "<domain_manager_uuid>"
ext_id = "<backup_target_uuid>"
}


5 changes: 5 additions & 0 deletions examples/backup_target_v2/terraform.tfvars
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#define values to the variables to be used in terraform file
nutanix_username = "admin"
nutanix_password = "password"
nutanix_endpoint = "10.xx.xx.xx"
nutanix_port = 9440
13 changes: 13 additions & 0 deletions examples/backup_target_v2/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#define the type of variables to be used in terraform file
variable "nutanix_username" {
type = string
}
variable "nutanix_password" {
type = string
}
variable "nutanix_endpoint" {
type = string
}
variable "nutanix_port" {
type = string
}
15 changes: 14 additions & 1 deletion website/docs/r/backup_target_v2.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Create a cluster or object store as the backup target. For a given Prism Central
## Example Usage

```hcl
// using cluster location
resource "nutanix_backup_target_v2" "example"{
domain_manager_ext_id = "<domain_manager_uuid>"
location {
Expand All @@ -24,6 +24,19 @@ resource "nutanix_backup_target_v2" "example"{
ext_id = "cluster uuid"
}
}
}
}
```


## Example Usage

```hcl
// using object store location
resource "nutanix_backup_target_v2" "example"{
domain_manager_ext_id = "<domain_manager_uuid>"
location {
object_store_location {
provider_config {
bucket_name = "bucket name"
Expand Down

0 comments on commit fe5209c

Please sign in to comment.