Skip to content

Commit c47fe9f

Browse files
author
Rene Schönfelder
committed
refactoring
1 parent 8eeb945 commit c47fe9f

File tree

13 files changed

+37
-14
lines changed

13 files changed

+37
-14
lines changed

modules/cloud-init/simple-setup-init.tftpl

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ runcmd:
4141
%{endif}
4242

4343
# install s3 access
44-
44+
%{if aws_access_key_id != ""}
4545
- snap install aws-cli --classic
4646

4747
%{ for user in users}
@@ -65,3 +65,12 @@ runcmd:
6565
- echo "region = eu-north1" >> /root/.aws/config
6666

6767

68+
# install s3 mount
69+
70+
%{if mount_bucket != "" }
71+
- wget https://s3.amazonaws.com/mountpoint-s3-release/1.14.0/x86_64/mount-s3-1.14.0-x86_64.deb
72+
- dpkg -i mount-s3-1.14.0-x86_64.deb
73+
- mkdir -p ${s3_mount_path}
74+
- mount-s3 --upload-checksums=off --maximum-throughput-gbps=200 --allow-delete --allow-overwrite --allow-other --endpoint-url=https://storage.eu-north1.nebius.cloud:443 ${mount_bucket} ${s3_mount_path}
75+
%{endif}
76+
%{endif}

modules/instance/main.tf

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
resource "nebius_compute_v1_disk" "boot-disk" {
22
parent_id = var.parent_id
3-
name = join("-", ["nfs-boot-disk", var.instance_name])
3+
name = join("-", ["instance-boot-disk", var.instance_name])
44
block_size_bytes = 4096
55
size_bytes = 1024 * 1024 * 1024 * var.boot_disk_size_gb
66
type = "NETWORK_SSD"
@@ -13,7 +13,7 @@ resource "nebius_compute_v1_disk" "extra-storage-disk" {
1313
name = join("-", ["extra-storage-disk", var.instance_name])
1414
block_size_bytes = 4096
1515
size_bytes = 1024 * 1024 * 1024 * var.extra_storage_size_gb
16-
type = "NETWORK_SSD"
16+
type = var.extra_storage_class
1717
}
1818

1919

@@ -60,14 +60,16 @@ resource "nebius_compute_v1_instance" "instance" {
6060
] : []
6161

6262

63-
cloud_init_user_data = templatefile("../../modules/cloud-init/simple-setup-init.tftpl", {
63+
cloud_init_user_data = templatefile("../modules/cloud-init/simple-setup-init.tftpl", {
6464
users = local.users,
6565
extra_path = local.extra_path,
6666
extra_disk_id = local.extra_disk_id,
6767
shared_filesystem_id = var.shared_filesystem_id,
6868
shared_filesystem_mount = var.shared_filesystem_mount,
6969
aws_access_key_id = var.aws_access_key_id,
70-
aws_secret_access_key = var.aws_secret_access_key
70+
aws_secret_access_key = var.aws_secret_access_key,
71+
mount_bucket = var.mount_bucket,
72+
s3_mount_path = var.s3_mount_path
7173
})
7274
}
7375

modules/instance/provider.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
terraform {
22
required_providers {
33
nebius = {
4-
source = "terraform-provider-nebius.storage.ai.nebius.cloud/nebius/nebius"
4+
source = "terraform-provider.storage.eu-north1.nebius.cloud/nebius/nebius"
55
version= ">= 0.4.24"
66
}
77
}

modules/instance/variables.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,13 @@ variable "extra_storage_size_gb" {
9292
description = "size of the newly created nfs storage"
9393
}
9494

95+
variable "extra_storage_class" {
96+
type = string
97+
default = "NETWORK_SSD"
98+
description = "Network type of additional disk being added"
99+
}
100+
101+
95102
variable "public_ip" {
96103
type = bool
97104
default = true
File renamed without changes.
Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
module "instance-module" {
2-
providers = {
3-
nebius = nebius
4-
}
5-
source = "../../modules/instance"
2+
source = "../modules/instance"
63
parent_id = var.parent_id
74
subnet_id = var.subnet_id
85
count = var.instance_count
@@ -16,6 +13,7 @@ module "instance-module" {
1613
extra_path = var.extra_path
1714
add_extra_storage = var.add_extra_storage
1815
extra_storage_size_gb = var.extra_storage_size_gb
16+
extra_storage_class = var.extra_storage_class
1917
public_ip = var.public_ip
2018
mount_bucket = var.mount_bucket
2119
s3_mount_path = var.s3_mount_path
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
terraform {
22
required_providers {
33
nebius = {
4-
source = "terraform-provider-nebius.storage.ai.nebius.cloud/nebius/nebius"
4+
source = "terraform-provider.storage.eu-north1.nebius.cloud/nebius/nebius"
55
version= ">= 0.4.24"
66
}
77
}

0 commit comments

Comments
 (0)