Skip to content

Commit fd8fefa

Browse files
Yash Makhejasankhsin
authored andcommitted
Added - Support for New OCI Native Service - Lustre File Service (LFS)
1 parent 8e58b38 commit fd8fefa

19 files changed

+2331
-4
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
// Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved.
2+
// Licensed under the Mozilla Public License v2.0
3+
4+
resource "oci_lustre_file_storage_lustre_file_system" "test_lustre_file_system" {
5+
#Required
6+
availability_domain = data.oci_identity_availability_domain.ad.name
7+
capacity_in_gbs = var.lustre_file_system_capacity_in_gbs
8+
compartment_id = var.compartment_ocid
9+
file_system_name = var.lustre_file_system_name
10+
performance_tier = var.lustre_file_system_performance_tier
11+
root_squash_configuration {
12+
13+
#Optional
14+
client_exceptions = var.lustre_file_system_root_squash_configuration_client_exceptions
15+
identity_squash = var.lustre_file_system_root_squash_configuration_identity_squash
16+
squash_gid = var.lustre_file_system_root_squash_configuration_squash_gid
17+
squash_uid = var.lustre_file_system_root_squash_configuration_squash_uid
18+
}
19+
subnet_id = oci_core_subnet.my_subnet.id
20+
21+
#Optional
22+
cluster_placement_group_id = oci_cluster_placement_groups_cluster_placement_group.test_cpg.id
23+
# defined_tags = map(oci_identity_tag_namespace.tag-namespace1.name.oci_identity_tag.tag1.name, var.lustre_file_system_defined_tags_value)
24+
display_name = var.lustre_file_system_display_name
25+
file_system_description = var.lustre_file_system_file_system_description
26+
27+
freeform_tags = {
28+
"Department" = "Finance"
29+
}
30+
}
31+
32+
data "oci_lustre_file_storage_lustre_file_system" "lustre_file_system" {
33+
lustre_file_system_id = oci_lustre_file_storage_lustre_file_system.test_lustre_file_system.id
34+
#Optional
35+
# availability_domain = var.lustre_file_system_availability_domain
36+
# compartment_id = var.compartment_id
37+
# display_name = var.lustre_file_system_display_name
38+
# state = var.lustre_file_system_state
39+
}
40+
41+
data "oci_lustre_file_storage_lustre_file_systems" "lustre_file_systems" {
42+
compartment_id = var.compartment_ocid
43+
#Optional
44+
# availability_domain = var.lustre_file_system_availability_domain
45+
# display_name = var.lustre_file_system_display_name
46+
# id = var.lustre_file_system_id
47+
# state = var.lustre_file_system_state
48+
}
49+
50+
data "oci_identity_availability_domain" "ad" {
51+
compartment_id = var.tenancy_ocid
52+
ad_number = 1
53+
}g
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
// Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved.
2+
// Licensed under the Mozilla Public License v2.0
3+
4+
resource "oci_core_vcn" "my_vcn" {
5+
cidr_block = var.my_vcn-cidr
6+
compartment_id = var.compartment_ocid
7+
display_name = "myvcn"
8+
dns_label = "myvcn"
9+
}
10+
11+
resource "oci_core_internet_gateway" "my_internet_gateway" {
12+
compartment_id = var.compartment_ocid
13+
display_name = "my internet gateway"
14+
vcn_id = oci_core_vcn.my_vcn.id
15+
}
16+
17+
resource "oci_core_route_table" "my_route_table" {
18+
compartment_id = var.compartment_ocid
19+
vcn_id = oci_core_vcn.my_vcn.id
20+
display_name = "my route table"
21+
}
22+
23+
resource "oci_core_subnet" "my_subnet" {
24+
depends_on = [oci_core_network_security_group.test_network_security_group]
25+
availability_domain = data.oci_identity_availability_domain.ad.name
26+
cidr_block = var.my_subnet_cidr
27+
display_name = "mysubnet"
28+
dns_label = "mysubnet"
29+
compartment_id = var.compartment_ocid
30+
vcn_id = oci_core_vcn.my_vcn.id
31+
security_list_ids = [oci_core_security_list.my_security_list.id]
32+
route_table_id = oci_core_route_table.my_route_table.id
33+
}
34+
35+
resource "oci_core_network_security_group" "test_network_security_group" {
36+
#Required
37+
compartment_id = var.compartment_ocid
38+
vcn_id = oci_core_vcn.my_vcn.id
39+
}
40+
41+
resource "oci_cluster_placement_groups_cluster_placement_group" "test_cpg" {
42+
#Required
43+
compartment_id = var.compartment_ocid
44+
description = "cpg for lustre file system"
45+
name = "test_cpg"
46+
availability_domain = data.oci_identity_availability_domain.ad.name
47+
cluster_placement_group_type = "STANDARD"
48+
49+
#Optional
50+
# defined_tags = {
51+
# "${oci_identity_tag_namespace.tag-namespace1.name}.${oci_identity_tag.tag1.name}" = "value"
52+
# }
53+
#
54+
# freeform_tags = {
55+
# "Department" = "Finance"
56+
# }
57+
}
58+
59+
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved.
2+
// Licensed under the Mozilla Public License v2.0
3+
4+
provider "oci" {
5+
tenancy_ocid = var.tenancy_ocid
6+
user_ocid = var.user_ocid
7+
fingerprint = var.fingerprint
8+
private_key_path = var.private_key_path
9+
region = var.region
10+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
// Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved.
2+
// Licensed under the Mozilla Public License v2.0
3+
4+
resource "oci_core_security_list" "my_security_list" {
5+
compartment_id = var.compartment_ocid
6+
display_name = "my_security_list"
7+
vcn_id = oci_core_vcn.my_vcn.id
8+
9+
// Allow all outbound requests
10+
egress_security_rules {
11+
destination = "0.0.0.0/0"
12+
protocol = "all"
13+
}
14+
15+
ingress_security_rules {
16+
// Allowing inbound SSH traffic to instances in the subnet from any source
17+
protocol = "6"
18+
source = "0.0.0.0/0"
19+
20+
tcp_options {
21+
min = 22
22+
max = 22
23+
}
24+
}
25+
26+
ingress_security_rules {
27+
// Allowing inbound ICMP traffic of a specific type and code from any source
28+
protocol = 1
29+
source = "0.0.0.0/0"
30+
31+
icmp_options {
32+
type = 3
33+
code = 4
34+
}
35+
}
36+
37+
ingress_security_rules {
38+
// Allowing inbound ICMP traffic of a specific type and code from any source
39+
protocol = 1
40+
source = "10.0.0.0/16"
41+
}
42+
43+
ingress_security_rules {
44+
protocol = "6"
45+
source = "10.0.0.0/16"
46+
}
47+
}
48+
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
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_ocid" {}
10+
variable "subnet_id" {}
11+
12+
13+
variable "lustre_file_system_availability_domain" {
14+
default = "availabilityDomain"
15+
}
16+
17+
variable "lustre_file_system_capacity_in_gbs" {
18+
default = 31200
19+
}
20+
21+
variable "lustre_file_system_defined_tags_value" {
22+
default = "value"
23+
}
24+
25+
variable "lustre_file_system_display_name" {
26+
default = "testDisplayName"
27+
}
28+
29+
variable "lustre_file_system_file_system_description" {
30+
default = "testFileSystemDescription"
31+
}
32+
33+
variable "lustre_file_system_freeform_tags" {
34+
default = { "Department" = "Finance" }
35+
}
36+
37+
variable "lustre_file_system_id" {
38+
default = "id"
39+
}
40+
41+
variable "lustre_file_system_nsg_ids" {
42+
default = []
43+
}
44+
45+
variable "lustre_file_system_performance_tier" {
46+
default = "MBPS_PER_TB_125"
47+
}
48+
49+
variable "lustre_file_system_root_squash_configuration_client_exceptions" {
50+
default = []
51+
}
52+
53+
variable "lustre_file_system_root_squash_configuration_identity_squash" {
54+
default = "NONE"
55+
}
56+
57+
variable "lustre_file_system_root_squash_configuration_squash_gid" {
58+
default = null
59+
}
60+
61+
variable "lustre_file_system_root_squash_configuration_squash_uid" {
62+
default = null
63+
}
64+
65+
variable "lustre_file_system_state" {
66+
default = "AVAILABLE"
67+
}
68+
69+
variable "cluster_placement_group_id" {
70+
default = null
71+
}
72+
73+
variable "lustre_file_system_name" {
74+
default = "lustre"
75+
}
76+
77+
variable "my_vcn-cidr" {
78+
default = "10.0.0.0/16"
79+
}
80+
81+
variable "my_subnet_cidr" {
82+
default = "10.0.0.0/24"
83+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved.
2+
// Licensed under the Mozilla Public License v2.0
3+
4+
package client
5+
6+
import (
7+
oci_lustre_file_storage "github.com/oracle/oci-go-sdk/v65/lustrefilestorage"
8+
9+
oci_common "github.com/oracle/oci-go-sdk/v65/common"
10+
)
11+
12+
func init() {
13+
RegisterOracleClient("oci_lustre_file_storage.LustreFileStorageClient", &OracleClient{InitClientFn: initLustrefilestorageLustreFileStorageClient})
14+
}
15+
16+
func initLustrefilestorageLustreFileStorageClient(configProvider oci_common.ConfigurationProvider, configureClient ConfigureClient, serviceClientOverrides ServiceClientOverrides) (interface{}, error) {
17+
client, err := oci_lustre_file_storage.NewLustreFileStorageClientWithConfigurationProvider(configProvider)
18+
if err != nil {
19+
return nil, err
20+
}
21+
err = configureClient(&client.BaseClient)
22+
if err != nil {
23+
return nil, err
24+
}
25+
26+
if serviceClientOverrides.HostUrlOverride != "" {
27+
client.Host = serviceClientOverrides.HostUrlOverride
28+
}
29+
return &client, nil
30+
}
31+
32+
func (m *OracleClients) LustreFileStorageClient() *oci_lustre_file_storage.LustreFileStorageClient {
33+
return m.GetClient("oci_lustre_file_storage.LustreFileStorageClient").(*oci_lustre_file_storage.LustreFileStorageClient)
34+
}

0 commit comments

Comments
 (0)