diff --git a/examples/backup_target_v2/main.tf b/examples/backup_target_v2/main.tf new file mode 100644 index 000000000..aaf3cdde1 --- /dev/null +++ b/examples/backup_target_v2/main.tf @@ -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 = "" + location { + cluster_location { + config { + ext_id = "cluster uuid" + } + } + } +} + +// using object_store_location +resource "nutanix_backup_target_v2" "example-2" { + domain_manager_ext_id = "" + 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 = "" +} + +// get backup target +data "nutanix_backup_target_v2" "backup-target" { + domain_manager_ext_id = "" + ext_id = "" +} + + diff --git a/examples/backup_target_v2/terraform.tfvars b/examples/backup_target_v2/terraform.tfvars new file mode 100644 index 000000000..867888ffc --- /dev/null +++ b/examples/backup_target_v2/terraform.tfvars @@ -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 diff --git a/examples/backup_target_v2/variables.tf b/examples/backup_target_v2/variables.tf new file mode 100644 index 000000000..dcd130ec8 --- /dev/null +++ b/examples/backup_target_v2/variables.tf @@ -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 +} diff --git a/website/docs/r/backup_target_v2.html.markdown b/website/docs/r/backup_target_v2.html.markdown index e88636440..ea2403dbd 100644 --- a/website/docs/r/backup_target_v2.html.markdown +++ b/website/docs/r/backup_target_v2.html.markdown @@ -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 = "" location { @@ -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 = "" + location { object_store_location { provider_config { bucket_name = "bucket name"