Skip to content

Commit cde8cee

Browse files
Marcel CasadoNagaRajuPasunuri
authored andcommitted
Bug Fix - Support for Wwether the volumes are preserved when a desktop pool is deleted
1 parent b3ad66d commit cde8cee

File tree

6 files changed

+22
-4
lines changed

6 files changed

+22
-4
lines changed

examples/desktops/desktop_pool/main.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ resource "oci_desktops_desktop_pool" "test_desktop_pool" {
5252
storage_backup_policy_id = var.desktop_pool_backup_policy_id
5353
storage_size_in_gbs = var.desktop_pool_storage_size_in_gbs
5454

55+
are_volumes_preserved = var.desktop_pool_are_volumes_preserved
56+
5557
shape_name = var.desktop_pool_shape_name
5658
standby_size = var.desktop_pool_standby_size
5759
maximum_size = var.desktop_pool_maximum_size

examples/desktops/desktop_pool/session_lifecycle_management/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ resource "oci_desktops_desktop_pool" "test_desktop_pool" {
3737
# Important: Availability policy can not be set when DISCONNECT Session Lifecycle Action is being set but
3838
# "availability_policy" element without start nor stop schedules needs to be present
3939
availability_policy {
40+
4041
}
4142

4243
is_storage_enabled = var.desktop_pool_is_storage_enabled

examples/desktops/desktop_pool/variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,11 @@ variable "desktop_pool_storage_size_in_gbs" {
103103
default = 50
104104
}
105105

106+
variable "desktop_pool_are_volumes_preserved" {
107+
description = "Indicates whether the volumes are preserved when a desktop pool is deleted"
108+
default = false
109+
}
110+
106111
variable "desktop_pool_vcn_id" {
107112
description = ""
108113
}

internal/integrationtest/desktops_desktop_pool_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ var (
6363
"standby_size": acctest.Representation{RepType: acctest.Required, Create: `2`, Update: `3`},
6464
"storage_backup_policy_id": acctest.Representation{RepType: acctest.Required, Create: `${var.test_storage_backup_policy_id}`},
6565
"storage_size_in_gbs": acctest.Representation{RepType: acctest.Required, Create: `50`},
66+
"are_volumes_preserved": acctest.Representation{RepType: acctest.Optional, Create: `true`, Update: `false`},
6667
"description": acctest.Representation{RepType: acctest.Optional, Create: `description`, Update: `description2`},
6768
"freeform_tags": acctest.Representation{RepType: acctest.Optional, Create: map[string]string{"Department": "Finance"}, Update: map[string]string{"Department": "Accounting"}},
6869
"nsg_ids": acctest.Representation{RepType: acctest.Optional, Create: []string{`${var.test_nsg_id}`}},
@@ -392,6 +393,7 @@ func TestDesktopsDesktopPoolResource_basic(t *testing.T) {
392393
resource.TestCheckResourceAttr(resourceName, "standby_size", "2"),
393394
resource.TestCheckResourceAttrSet(resourceName, "state"),
394395
resource.TestCheckResourceAttrSet(resourceName, "storage_backup_policy_id"),
396+
resource.TestCheckResourceAttrSet(resourceName, "are_volumes_preserved"),
395397
resource.TestCheckResourceAttr(resourceName, "storage_size_in_gbs", "50"),
396398
resource.TestCheckResourceAttrSet(resourceName, "time_created"),
397399
resource.TestCheckResourceAttrSet(resourceName, "use_dedicated_vm_host"),
@@ -526,6 +528,7 @@ func TestDesktopsDesktopPoolResource_basic(t *testing.T) {
526528
resource.TestCheckResourceAttrSet(resourceName, "state"),
527529
resource.TestCheckResourceAttrSet(resourceName, "storage_backup_policy_id"),
528530
resource.TestCheckResourceAttr(resourceName, "storage_size_in_gbs", "50"),
531+
resource.TestCheckResourceAttrSet(resourceName, "are_volumes_preserved"),
529532
resource.TestCheckResourceAttrSet(resourceName, "time_created"),
530533
resource.TestCheckResourceAttrSet(resourceName, "use_dedicated_vm_host"),
531534

internal/service/desktops/desktops_desktop_pool_resource.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,11 @@ func DesktopsDesktopPoolResource() *schema.Resource {
247247
ForceNew: true,
248248
},
249249

250+
"are_volumes_preserved": {
251+
Type: schema.TypeBool,
252+
Optional: true,
253+
},
254+
250255
// Optional
251256
"defined_tags": {
252257
Type: schema.TypeMap,

website/docs/r/desktops_desktop_pool.html.markdown

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ resource "oci_desktops_desktop_pool" "test_desktop_pool" {
6767
storage_size_in_gbs = var.desktop_pool_storage_size_in_gbs
6868
6969
#Optional
70+
are_volumes_preserved = var.desktop_pool_are_volumes_preserved
7071
defined_tags = {"Operations.CostCenter"= "42"}
7172
description = var.desktop_pool_description
7273
freeform_tags = {"Department"= "Finance"}
@@ -116,7 +117,7 @@ The following arguments are supported:
116117

117118
* `are_privileged_users` - (Required) Indicates whether desktop pool users have administrative privileges on their desktop.
118119
* `availability_domain` - (Required) The availability domain of the desktop pool.
119-
* `availability_policy` - (Required) (Updatable) Provides the start and stop schedule information for desktop availability of the desktop pool.
120+
* `availability_policy` - (Required) (Updatable) Provides the start and stop schedule information for desktop availability of the desktop pool. Use `availability_policy { }` to not set a schedule.
120121
* `start_schedule` - (Optional) (Updatable) Provides the schedule information for a desktop.
121122
* `cron_expression` - (Required) (Updatable) A cron expression describing the desktop's schedule.
122123
* `timezone` - (Required) (Updatable) The timezone of the desktop's schedule.
@@ -159,11 +160,11 @@ The following arguments are supported:
159160
* `private_ip` - (Optional) The IPv4 address from the provided Oracle Cloud Infrastructure subnet which needs to be assigned to the VNIC. If not provided, it will be auto-assigned with an available IPv4 address from the subnet.
160161
* `subnet_id` - (Required) The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the private subnet in the customer VCN where the connectivity will be established.
161162
* `session_lifecycle_actions` - (Optional) The details of action to be triggered in case of inactivity or disconnect
162-
* `disconnect` - (Optional) (Updatable) Action and grace period for disconnect
163-
* `action` - (Required) (Updatable) a disconnect action to be triggered
163+
* `disconnect` - (Optional) (Updatable) Action and grace period for disconnect. Session disconnect can not be used together with an `availability_policy` schedule.
164+
* `action` - (Required) (Updatable) a disconnect action to be triggered. Could be set to NONE or STOP
164165
* `grace_period_in_minutes` - (Optional) (Updatable) The period of time (in minutes) after disconnect before any action occurs. If the value is not provided, a default value is used.
165166
* `inactivity` - (Optional) (Updatable) Action and grace period for inactivity
166-
* `action` - (Required) (Updatable) an inactivity action to be triggered
167+
* `action` - (Required) (Updatable) an inactivity action to be triggered. Could be set to NONE or DISCONNECT.
167168
* `grace_period_in_minutes` - (Optional) (Updatable) The period of time (in minutes) during which the session must remain inactive before any action occurs. If the value is not provided, a default value is used.
168169
* `shape_name` - (Required) The shape of the desktop pool.
169170
* `standby_size` - (Required) (Updatable) The maximum number of standby desktops available in the desktop pool.
@@ -172,6 +173,7 @@ The following arguments are supported:
172173
* `time_start_scheduled` - (Optional) (Updatable) The start time of the desktop pool.
173174
* `time_stop_scheduled` - (Optional) (Updatable) The stop time of the desktop pool.
174175
* `use_dedicated_vm_host` - (Optional) Indicates whether the desktop pool uses dedicated virtual machine hosts.
176+
* `are_volumes_preserved` - (Optional) (Updatable) Indicates whether the volumes are preserved when a desktop pool is deleted. Default value is false.
175177

176178

177179
** IMPORTANT **

0 commit comments

Comments
 (0)