Skip to content

Commit 715c808

Browse files
Marcel CasadoMaxrovr
authored andcommitted
Added - Desktop as a Service: Shape Flexibility
1 parent acd92ab commit 715c808

15 files changed

+599
-1
lines changed

examples/desktops/desktop_pool/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ data "oci_desktops_desktop_pools" "test_desktop_pools_datasource" {
8080
#Optional
8181
# availability_domain = data.oci_identity_availability_domain.ad.name
8282
# display_name = var.desktop_pool_display_name
83-
# id = var.desktop_pool_id
83+
id = oci_desktops_desktop_pool.test_desktop_pool.id
8484
# state = var.desktop_pool_state
8585
}
8686

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# OCI config profile
2+
config_file_profile="terraform-federation-test"
3+
4+
# region (us-phoenix-1, ca-toronto-1, etc)
5+
region="us-phoenix-1"
6+
7+
# Secure Desktops with Shape Flexibility Example Configuration
8+
9+
compartment_id = "<compartment_ocid>"
10+
11+
desktop_pool_vcn_id = "<vcn_ocid>"
12+
desktop_pool_subnet_id = "<subnet_ocid>"
13+
desktop_pool_image_id = "<image_ocid>"
14+
desktop_pool_image_name = "<image_name>"
15+
desktop_pool_backup_policy_id = "<volume_backup_policy_ocid>"
16+
desktop_pool_contact_details = "test%40example.com"
17+
desktop_pool_shape_config_baseline_ocpu_utilization = "BASELINE_1_2"
18+
desktop_pool_shape_config_memory_in_gbs = 4
19+
desktop_pool_shape_config_ocpus = 2
20+
desktop_pool_use_dedicated_vm_host = "FALSE"
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
// Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved.
2+
// Licensed under the Mozilla Public License v2.0
3+
4+
5+
resource "oci_desktops_desktop_pool" "test_desktop_pool" {
6+
#Required
7+
compartment_id = var.compartment_id
8+
display_name = var.desktop_pool_display_name
9+
contact_details = var.desktop_pool_contact_details
10+
11+
are_privileged_users = var.desktop_pool_are_privileged_users
12+
availability_domain = data.oci_identity_availability_domain.ad.name
13+
14+
network_configuration {
15+
#Required
16+
subnet_id = var.desktop_pool_subnet_id
17+
vcn_id = var.desktop_pool_vcn_id
18+
}
19+
20+
device_policy {
21+
#Required
22+
audio_mode = var.desktop_pool_device_policy_audio_mode
23+
cdm_mode = var.desktop_pool_device_policy_cdm_mode
24+
clipboard_mode = var.desktop_pool_device_policy_clipboard_mode
25+
is_display_enabled = var.desktop_pool_device_policy_is_display_enabled
26+
is_keyboard_enabled = var.desktop_pool_device_policy_is_keyboard_enabled
27+
is_pointer_enabled = var.desktop_pool_device_policy_is_pointer_enabled
28+
is_printing_enabled = var.desktop_pool_device_policy_is_printing_enabled
29+
}
30+
31+
image {
32+
#Required
33+
image_id = var.desktop_pool_image_id
34+
image_name = var.desktop_pool_image_name
35+
}
36+
37+
availability_policy {
38+
#Required
39+
start_schedule {
40+
#Required
41+
cron_expression = var.desktop_pool_start_schedule_cron_expr
42+
timezone = var.desktop_pool_start_schedule_timezone
43+
}
44+
stop_schedule {
45+
#Required
46+
cron_expression = var.desktop_pool_stop_schedule_cron_expr
47+
timezone = var.desktop_pool_stop_schedule_timezone
48+
}
49+
}
50+
51+
is_storage_enabled = var.desktop_pool_is_storage_enabled
52+
storage_backup_policy_id = var.desktop_pool_backup_policy_id
53+
storage_size_in_gbs = var.desktop_pool_storage_size_in_gbs
54+
55+
shape_name = var.desktop_pool_shape_name
56+
standby_size = var.desktop_pool_standby_size
57+
maximum_size = var.desktop_pool_maximum_size
58+
59+
#Optional
60+
# defined_tags = map(oci_identity_tag_namespace.tag-namespace1.name.oci_identity_tag.tag1.name, var.desktop_pool_defined_tags_value)
61+
# description = var.desktop_pool_description
62+
# freeform_tags = var.desktop_pool_freeform_tags
63+
# nsg_ids = var.desktop_pool_nsg_ids
64+
# time_start_scheduled = var.desktop_pool_time_start_scheduled
65+
# time_stop_scheduled = var.desktop_pool_time_stop_scheduled
66+
shape_config {
67+
baseline_ocpu_utilization = var.desktop_pool_shape_config_baseline_ocpu_utilization
68+
memory_in_gbs = var.desktop_pool_shape_config_memory_in_gbs
69+
ocpus = var.desktop_pool_shape_config_ocpus
70+
}
71+
72+
use_dedicated_vm_host = var.desktop_pool_use_dedicated_vm_host
73+
}
74+
75+
data "oci_desktops_desktop_pools" "test_desktop_pools_datasource" {
76+
#Required
77+
compartment_id = var.compartment_id
78+
79+
#Optional
80+
# availability_domain = data.oci_identity_availability_domain.ad.name
81+
# display_name = var.desktop_pool_display_name
82+
id = oci_desktops_desktop_pool.test_desktop_pool.id
83+
# state = var.desktop_pool_state
84+
}
85+
86+
data "oci_desktops_desktop_pool" "test_desktop_pool_datasource" {
87+
#Required
88+
desktop_pool_id = oci_desktops_desktop_pool.test_desktop_pool.id
89+
}
90+
91+
data "oci_desktops_desktop_pool_desktops" "test_desktop_pool_desktops_datasource" {
92+
availability_domain = data.oci_identity_availability_domain.ad.name
93+
compartment_id = var.compartment_id
94+
desktop_pool_id = oci_desktops_desktop_pool.test_desktop_pool.id
95+
}
96+
97+
data "oci_desktops_desktop_pool_volumes" "test_desktop_pool_volumes_datasource" {
98+
availability_domain = data.oci_identity_availability_domain.ad.name
99+
compartment_id = var.compartment_id
100+
desktop_pool_id = oci_desktops_desktop_pool.test_desktop_pool.id
101+
#Optional
102+
# display_name = var.desktop_pool_display_name
103+
# state = var.desktop_pool_state
104+
}
105+
106+
data "oci_identity_availability_domain" "ad" {
107+
compartment_id = var.tenancy_ocid
108+
ad_number = 1
109+
}
110+
111+
data "oci_desktops_desktops" "test_desktops_datasource" {
112+
availability_domain = data.oci_identity_availability_domain.ad.name
113+
compartment_id = var.compartment_id
114+
desktop_pool_id = oci_desktops_desktop_pool.test_desktop_pool.id
115+
state = "ACTIVE"
116+
}
117+
118+
#data "oci_desktops_desktop" "test_desktop_datasource" {
119+
# desktop_id = data.oci_desktops_desktop_pool_desktops.test_desktop_pool_desktops_datasource.desktop_pool_desktop_collection.0.items.0.desktop_id
120+
#}
121+
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved.
2+
// Licensed under the Mozilla Public License v2.0
3+
4+
output "desktop_pool_id" {
5+
value = [data.oci_desktops_desktop_pools.test_desktop_pools_datasource.desktop_pool_collection.0.items.*.id]
6+
}
7+
8+
# Output the desktop IDs of the desktop pool
9+
output "desktop_pool_desktop_ids" {
10+
value = [data.oci_desktops_desktop_pool_desktops.test_desktop_pool_desktops_datasource.desktop_pool_desktop_collection.0.items.*.desktop_id]
11+
}
12+
13+
# Output the volume IDs of the desktop pool
14+
output "desktop_pool_volume_ids" {
15+
value = [data.oci_desktops_desktop_pool_volumes.test_desktop_pool_volumes_datasource.desktop_pool_volume_collection.0.items.*.id]
16+
}
17+
18+
# Output the desktop IDs of the desktop pool
19+
output "desktop_ids" {
20+
value = [data.oci_desktops_desktops.test_desktops_datasource.desktop_collection.0.items.*.id]
21+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved.
2+
// Licensed under the Mozilla Public License v2.0
3+
4+
variable "config_file_profile" {
5+
}
6+
7+
provider "oci" {
8+
auth = "SecurityToken"
9+
config_file_profile = var.config_file_profile
10+
region = var.region
11+
}
12+
13+
provider "local" {
14+
version = ">=1.3.0" # Need this version of the local provider to support base64 encoded inputs
15+
}
16+
Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
// Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved.
2+
// Licensed under the Mozilla Public License v2.0
3+
4+
variable "tenancy_ocid" {}
5+
variable "user_ocid" {}
6+
variable "fingerprint" {}
7+
variable "private_key_path" {}
8+
variable "region" {}
9+
variable "compartment_id" {}
10+
11+
variable "desktop_pool_are_privileged_users" {
12+
description = ""
13+
default = false
14+
}
15+
16+
variable "desktop_pool_description" {
17+
description = ""
18+
default = "Pool Description"
19+
}
20+
21+
variable "desktop_pool_contact_details" {
22+
description = ""
23+
default = ""
24+
}
25+
26+
variable "desktop_pool_device_policy_audio_mode" {
27+
description = ""
28+
default = "NONE"
29+
}
30+
31+
variable "desktop_pool_device_policy_cdm_mode" {
32+
description = ""
33+
default = "NONE"
34+
}
35+
36+
variable "desktop_pool_device_policy_clipboard_mode" {
37+
description = ""
38+
default = "NONE"
39+
}
40+
41+
variable "desktop_pool_device_policy_is_display_enabled" {
42+
description = ""
43+
default = false
44+
}
45+
46+
variable "desktop_pool_device_policy_is_keyboard_enabled" {
47+
description = ""
48+
default = false
49+
}
50+
51+
variable "desktop_pool_device_policy_is_pointer_enabled" {
52+
description = ""
53+
default = false
54+
}
55+
56+
variable "desktop_pool_device_policy_is_printing_enabled" {
57+
description = ""
58+
default = false
59+
}
60+
61+
variable "desktop_pool_display_name" {
62+
description = ""
63+
default = "testPool1"
64+
}
65+
66+
variable "desktop_pool_freeform_tags" {
67+
description = ""
68+
type = map(string)
69+
70+
default = {
71+
Test = "Test"
72+
}
73+
}
74+
75+
variable "desktop_pool_standby_size" {
76+
description = ""
77+
default = 2
78+
}
79+
80+
variable "desktop_pool_maximum_size" {
81+
description = ""
82+
default = 10
83+
}
84+
85+
variable "desktop_pool_nsg_ids" {
86+
description = ""
87+
type = set(string)
88+
default = null
89+
}
90+
91+
variable "desktop_pool_is_storage_enabled" {
92+
description = ""
93+
default = true
94+
}
95+
96+
variable "desktop_pool_backup_policy_id" {
97+
description = ""
98+
default = ""
99+
}
100+
101+
variable "desktop_pool_storage_size_in_gbs" {
102+
description = ""
103+
default = 50
104+
}
105+
106+
variable "desktop_pool_vcn_id" {
107+
description = ""
108+
}
109+
110+
variable "desktop_pool_subnet_id" {
111+
description = ""
112+
}
113+
114+
variable "desktop_pool_shape_name" {
115+
description = ""
116+
default = "Flex Low"
117+
}
118+
119+
variable "desktop_pool_image_id" {
120+
description = ""
121+
}
122+
123+
variable "desktop_pool_image_name" {
124+
description = ""
125+
}
126+
127+
variable "desktop_pool_start_schedule_cron_expr" {
128+
description = ""
129+
default = "0 10 8 ? * 1"
130+
}
131+
132+
variable "desktop_pool_start_schedule_timezone" {
133+
description = ""
134+
default = "MST"
135+
}
136+
137+
variable "desktop_pool_stop_schedule_cron_expr" {
138+
description = ""
139+
default = "0 20 18 ? * 5"
140+
}
141+
142+
variable "desktop_pool_stop_schedule_timezone" {
143+
description = ""
144+
default = "MST"
145+
}
146+
147+
variable "desktop_pool_shape_config_baseline_ocpu_utilization" {
148+
default = "BASELINE_1_2"
149+
}
150+
151+
variable "desktop_pool_shape_config_memory_in_gbs" {
152+
default = 4
153+
}
154+
155+
variable "desktop_pool_shape_config_ocpus" {
156+
default = 2
157+
}
158+
159+
variable "desktop_pool_use_dedicated_vm_host" {
160+
default = "TRUE"
161+
}
162+
163+
variable "desktop_pool_state" {
164+
description = ""
165+
default = "ACTIVE"
166+
}
167+

examples/desktops/desktop_pool/terraform.tfvars.template

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ config_file_profile="terraform-federation-test"
4141
# region (us-phoenix-1, ca-toronto-1, etc)
4242
region="<your region>"
4343

44+
# needed to get domain availability zone
45+
tenancy_ocid="<your tenancy ocid>"
46+
47+
4448
# To be able to use OCI Secure Desktops it requires to have some customer OCI resources ready in the customer tenancy like a VCN, Subnet and a custom Image.
4549
# Additionally a Dynamic Group, service policies and user policies are required.
4650
# See setting up the Tenancy: https://docs.oracle.com/en-us/iaas/secure-desktops/setup-tenancy.htm for guidance.
@@ -61,3 +65,9 @@ desktop_pool_image_name = "<image_name>"
6165
desktop_pool_backup_policy_id = "<volume_backup_policy_ocid>"
6266
desktop_pool_contact_details = "<admin_contact_details>"
6367

68+
# shape flexibility
69+
desktop_pool_shape_config_baseline_ocpu_utilization = "BASELINE_1_2"
70+
desktop_pool_shape_config_memory_in_gbs = 4
71+
desktop_pool_shape_config_ocpus = 2
72+
desktop_pool_use_dedicated_vm_host = "FALSE"
73+

0 commit comments

Comments
 (0)