77data "oci_core_images" "images" {
88 compartment_id = var. compartment_id
99 operating_system = " Oracle Linux"
10- shape = var . compute_cpu_shape
10+ shape = local . vm_compute_shape
1111
1212 filter {
13- name = " display_name"
14- values = [" Oracle-Linux-${ var . compute_os_ver } -.*" ]
15- regex = true
13+ name = " display_name"
14+ values = [
15+ var . vm_is_gpu_shape ? " Oracle-Linux-${ var . compute_os_ver } -.*(GPU|NVIDIA|A10).*" : " Oracle-Linux-${ var . compute_os_ver } -.*"
16+ ]
17+ regex = true
1618 }
1719
1820 sort_by = " TIMECREATED"
@@ -29,4 +31,38 @@ data "oci_core_services" "core_services" {
2931 values = [" All .* Services In Oracle Services Network" ]
3032 regex = true
3133 }
34+ }
35+
36+ data "cloudinit_config" "workers" {
37+ gzip = true
38+ base64_encode = true
39+
40+ # Expand root filesystem to fill available space on volume
41+ part {
42+ content_type = " text/cloud-config"
43+ content = jsonencode ({
44+ # https://cloudinit.readthedocs.io/en/latest/reference/modules.html#growpart
45+ growpart = {
46+ mode = " auto"
47+ devices = [" /" ]
48+ ignore_growroot_disabled = false
49+ }
50+
51+ # https://cloudinit.readthedocs.io/en/latest/reference/modules.html#resizefs
52+ resize_rootfs = true
53+
54+ # Resize logical LVM root volume when utility is present
55+ bootcmd = [" if [[ -f /usr/libexec/oci-growfs ]]; then /usr/libexec/oci-growfs -y; fi" ]
56+ })
57+ filename = " 10-growpart.yml"
58+ merge_type = " list(append)+dict(no_replace,recurse_list)+str(append)"
59+ }
60+
61+ # Startup Initialisation
62+ part {
63+ content_type = " text/x-shellscript"
64+ content = local. cloud_init
65+ filename = " 50-custom-init.sh"
66+ merge_type = " list(append)+dict(no_replace,recurse_list)+str(append)"
67+ }
3268}
0 commit comments