-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathmain_ai_gpu.tf
More file actions
129 lines (115 loc) · 3.1 KB
/
main_ai_gpu.tf
File metadata and controls
129 lines (115 loc) · 3.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
provider "oci" {}
resource "tls_private_key" "public_private_key_pair" {
algorithm = "RSA"
}
data "oci_core_images" "gpu_images" {
compartment_id = var.compartment_ocid
operating_system = "Oracle Linux"
operating_system_version = "8"
shape = var.shape
state = "AVAILABLE"
sort_by = "TIMECREATED"
sort_order = "DESC"
filter {
name = "launch_mode"
values = ["NATIVE"]
}
filter {
name = "display_name"
values = ["\\w*GPU\\w*"]
regex = true
}
}
resource "oci_core_instance" "this" {
agent_config {
is_management_disabled = "false"
is_monitoring_disabled = "false"
plugins_config {
desired_state = "DISABLED"
name = "Vulnerability Scanning"
}
plugins_config {
desired_state = "DISABLED"
name = "Oracle Java Management Service"
}
plugins_config {
desired_state = "DISABLED"
name = "OS Management Service Agent"
}
plugins_config {
desired_state = "DISABLED"
name = "OS Management Hub Agent"
}
plugins_config {
desired_state = "DISABLED"
name = "Management Agent"
}
plugins_config {
desired_state = "ENABLED"
name = "Custom Logs Monitoring"
}
plugins_config {
desired_state = "DISABLED"
name = "Compute RDMA GPU Monitoring"
}
plugins_config {
desired_state = "ENABLED"
name = "Compute Instance Run Command"
}
plugins_config {
desired_state = "ENABLED"
name = "Compute Instance Monitoring"
}
plugins_config {
desired_state = "DISABLED"
name = "Compute HPC RDMA Auto-Configuration"
}
plugins_config {
desired_state = "DISABLED"
name = "Compute HPC RDMA Authentication"
}
plugins_config {
desired_state = "ENABLED"
name = "Cloud Guard Workload Protection"
}
plugins_config {
desired_state = "DISABLED"
name = "Block Volume Management"
}
plugins_config {
desired_state = "DISABLED"
name = "Bastion"
}
}
availability_config {
is_live_migration_preferred = "false"
recovery_action = "RESTORE_INSTANCE"
}
availability_domain = var.ad
compartment_id = var.compartment_ocid
create_vnic_details {
assign_ipv6ip = "false"
assign_private_dns_record = "true"
#assign_public_ip = "true"
assign_public_ip = local.is_sn_private ? "false" : "true"
subnet_id = var.use_existent_vcn ? var.subnet_id : oci_core_subnet.subnets[0].id
}
display_name = var.vm_display_name
instance_options {
are_legacy_imds_endpoints_disabled = "false"
}
# does not works for BM
is_pv_encryption_in_transit_enabled = length(regexall("BM",var.shape)) > 0 ? false : true
metadata = {
ssh_authorized_keys = tls_private_key.public_private_key_pair.public_key_openssh
user_data = data.cloudinit_config.config.rendered
}
shape = var.shape
source_details {
boot_volume_size_in_gbs = "250"
boot_volume_vpus_per_gb = "10"
source_id = data.oci_core_images.gpu_images.images[0].id
source_type = "image"
}
freeform_tags = {"GPU_TAG" = var.gpu_tag_val}
}