-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs and examples for get protected resource datasource
- Loading branch information
1 parent
7749c1e
commit eedcab6
Showing
4 changed files
with
180 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
terraform{ | ||
required_providers { | ||
nutanix = { | ||
source = "nutanix/nutanix" | ||
version = "2.0.0" | ||
} | ||
} | ||
} | ||
|
||
#defining nutanix configuration | ||
provider "nutanix"{ | ||
username = var.nutanix_username | ||
password = var.nutanix_password | ||
endpoint = var.nutanix_endpoint | ||
port = 9440 | ||
insecure = true | ||
} | ||
|
||
resource "nutanix_protection_policy_v2" "pp_1"{ | ||
name = "pp_example_1" | ||
|
||
replication_configurations { | ||
source_location_label = "source" | ||
remote_location_label = "target" | ||
schedule { | ||
recovery_point_objective_time_seconds = 0 | ||
recovery_point_type = "CRASH_CONSISTENT" | ||
sync_replication_auto_suspend_timeout_seconds = 10 | ||
} | ||
} | ||
replication_configurations { | ||
source_location_label = "target" | ||
remote_location_label = "source" | ||
schedule { | ||
recovery_point_objective_time_seconds = 0 | ||
recovery_point_type = "CRASH_CONSISTENT" | ||
sync_replication_auto_suspend_timeout_seconds = 10 | ||
} | ||
} | ||
|
||
replication_locations { | ||
domain_manager_ext_id = "domain_manager_ext_id_local" | ||
label = "source" | ||
is_primary = true | ||
} | ||
replication_locations { | ||
domain_manager_ext_id = "domain_manager_ext_id_remote" | ||
label = "target" | ||
is_primary = false | ||
} | ||
|
||
category_ids = ["<category_ids>"] | ||
} | ||
|
||
resource "nutanix_virtual_machine_v2" "vm" { | ||
name = "%[2]s" | ||
description = "%[3]s" | ||
num_cores_per_socket = 1 | ||
num_sockets = 1 | ||
cluster { | ||
ext_id = data.nutanix_clusters_v2.clusters.cluster_entities.0.ext_id | ||
} | ||
categories { | ||
ext_id = local.category1 | ||
} | ||
power_state = "OFF" | ||
depends_on = [nutanix_protection_policy_v2.test] | ||
} | ||
|
||
data "nutanix_protected_resource_v2" "pr" { | ||
ext_id = nutanix_virtual_machine_v2.vm.id | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
--- | ||
layout: "nutanix" | ||
page_title: "NUTANIX: protected_resource_v2" | ||
sidebar_current: "docs-nutanix-datasource-protected-resource-v2" | ||
description: |- | ||
Get a protected resource | ||
--- | ||
|
||
# protected_resource_v2 | ||
|
||
Get the details of the specified protected resource such as the restorable time ranges available on the local Prism Central and the state of replication to the targets specified in the applied protection policies. This applies only if the entity is protected in a minutely or synchronous schedule. Other protection schedules are not served by this endpoint yet, and are considered not protected. | ||
|
||
|
||
## Example | ||
|
||
```hcl | ||
resource "nutanix_protection_policy_v2" "pp_1"{ | ||
name = "pp_example_1" | ||
replication_configurations { | ||
source_location_label = "source" | ||
remote_location_label = "target" | ||
schedule { | ||
recovery_point_objective_time_seconds = 0 | ||
recovery_point_type = "CRASH_CONSISTENT" | ||
sync_replication_auto_suspend_timeout_seconds = 10 | ||
} | ||
} | ||
replication_configurations { | ||
source_location_label = "target" | ||
remote_location_label = "source" | ||
schedule { | ||
recovery_point_objective_time_seconds = 0 | ||
recovery_point_type = "CRASH_CONSISTENT" | ||
sync_replication_auto_suspend_timeout_seconds = 10 | ||
} | ||
} | ||
replication_locations { | ||
domain_manager_ext_id = "domain_manager_ext_id_local" | ||
label = "source" | ||
is_primary = true | ||
} | ||
replication_locations { | ||
domain_manager_ext_id = "domain_manager_ext_id_remote" | ||
label = "target" | ||
is_primary = false | ||
} | ||
category_ids = ["<category_ids>"] | ||
} | ||
resource "nutanix_virtual_machine_v2" "vm"{ | ||
name = "%[2]s" | ||
description = "%[3]s" | ||
num_cores_per_socket = 1 | ||
num_sockets = 1 | ||
cluster { | ||
ext_id = data.nutanix_clusters_v2.clusters.cluster_entities.0.ext_id | ||
} | ||
categories { | ||
ext_id = local.category1 | ||
} | ||
power_state = "OFF" | ||
depends_on = [nutanix_protection_policy_v2.test] | ||
} | ||
data "nutanix_protected_resource_v2" "pr"{ | ||
ext_id = nutanix_virtual_machine_v2.vm.id | ||
} | ||
``` | ||
|
||
## Argument Reference | ||
|
||
The following arguments are supported: | ||
|
||
* `ext_id`: -(Required) The external identifier of a protected VM or volume group that can be used to retrieve the protected resource. | ||
|
||
|
||
## Attributes Reference | ||
The following attributes are exported: | ||
|
||
|
||
|
||
See detailed information in [Nutanix Get Protected Resource v4](https://developers.nutanix.com/api-reference?namespace=dataprotection&version=v4.0#tag/ProtectedResources/operation/getProtectedResourceById). | ||
|