Skip to content

Commit 243bdee

Browse files
authored
updates OKE ver and provider (#746)
* updates OKE ver and provider
1 parent 53a1b89 commit 243bdee

File tree

6 files changed

+85
-73
lines changed

6 files changed

+85
-73
lines changed

grabdish/terraform/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.terraform.lock.hcl
2+
.terraform/
3+
terraform.tfstate
4+
terraform.tfstate.backup

grabdish/terraform/containerengine.tf

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
resource "oci_containerengine_cluster" "okell_cluster" {
22
#Required
3-
compartment_id = var.ociCompartmentOcid
3+
compartment_id = var.ociCompartmentOcid
44
endpoint_config {
55
is_public_ip_enabled = "true"
66
nsg_ids = [
77
]
88
subnet_id = oci_core_subnet.endpoint_Subnet.id
99
}
10-
kubernetes_version = "v1.26.2"
10+
kubernetes_version = var.kubernetes_version
1111
name = "grabdish"
1212
vcn_id = oci_core_vcn.okell_vcn.id
1313
#Optional
@@ -34,20 +34,20 @@ resource "oci_containerengine_node_pool" "okell_node_pool" {
3434
#Required
3535
cluster_id = oci_containerengine_cluster.okell_cluster.id
3636
compartment_id = var.ociCompartmentOcid
37-
kubernetes_version = "v1.26.2"
37+
kubernetes_version = var.kubernetes_version
3838
name = "Pool"
39-
# node_shape="VM.Standard2.4"
40-
# node_shape = "VM.Standard.B2.1"
41-
node_shape = "VM.Standard.E2.1"
42-
# node_shape = "VM.Standard2.2"
39+
# node_shape="VM.Standard2.4"
40+
# node_shape = "VM.Standard.B2.1"
41+
node_shape = "VM.Standard.E2.1"
42+
# node_shape = "VM.Standard2.2"
4343
#subnet_ids = [oci_core_subnet.nodePool_Subnet_1.id]
4444
#Optional
4545
node_config_details {
4646
placement_configs {
4747
availability_domain = data.oci_identity_availability_domain.ad1.name
4848
subnet_id = oci_core_subnet.nodePool_Subnet.id
4949
}
50-
/* placement_configs {
50+
/* placement_configs {
5151
availability_domain = data.oci_identity_availability_domain.ad2.name
5252
subnet_id = oci_core_subnet.nodePool_Subnet.id
5353
}
@@ -76,8 +76,8 @@ data "oci_containerengine_node_pool_option" "okell_node_pool_option" {
7676
node_pool_option_id = "all"
7777
}
7878
locals {
79-
all_sources = data.oci_containerengine_node_pool_option.okell_node_pool_option.sources
80-
oracle_linux_images = [for source in local.all_sources : source.image_id if length(regexall("Oracle-Linux-[0-9]*.[0-9]*-20[0-9]*",source.source_name)) > 0]
79+
all_sources = data.oci_containerengine_node_pool_option.okell_node_pool_option.sources
80+
oracle_linux_images = [for source in local.all_sources : source.image_id if length(regexall("Oracle-Linux-[0-9]*.[0-9]*-20[0-9]*", source.source_name)) > 0]
8181
}
8282
/*
8383
output "cluster_kubernetes_versions" {
@@ -107,4 +107,4 @@ variable "InstanceImageOCID" {
107107
uk-london-1 = "ocid1.image.oc1.uk-london-1.aaaaaaaajwtut4l7fo3cvyraate6erdkyf2wdk5vpk6fp6ycng3dv2y3ymvq"
108108
}
109109
}
110-
*/
110+
*/

grabdish/terraform/core.tf

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ resource "oci_core_vcn" "okell_vcn" {
22
cidr_block = "10.0.0.0/16"
33
compartment_id = var.ociCompartmentOcid
44
display_name = "grabdish"
5-
dns_label = "grabdish"
5+
dns_label = "grabdish"
66
}
77
resource "oci_core_internet_gateway" "ig" {
8-
compartment_id = var.ociCompartmentOcid
9-
display_name = "ClusterInternetGateway"
10-
vcn_id = oci_core_vcn.okell_vcn.id
8+
compartment_id = var.ociCompartmentOcid
9+
display_name = "ClusterInternetGateway"
10+
vcn_id = oci_core_vcn.okell_vcn.id
1111
}
1212
/*resource "oci_core_dhcp_options" "grabdish" {
1313
#Required
@@ -54,18 +54,18 @@ resource oci_core_public_ip puip {
5454
#public_ip_pool_id = <<Optional value not found in discovery>>
5555
}
5656
*/
57-
resource oci_core_nat_gateway ngw {
57+
resource "oci_core_nat_gateway" "ngw" {
5858
block_traffic = "false"
5959
compartment_id = var.ociCompartmentOcid
60-
display_name = "ngw"
60+
display_name = "ngw"
6161
freeform_tags = {
6262
}
6363
#public_ip_id = oci_core_public_ip.puip.id
64-
vcn_id = oci_core_vcn.okell_vcn.id
64+
vcn_id = oci_core_vcn.okell_vcn.id
6565
}
66-
resource oci_core_service_gateway sg {
66+
resource "oci_core_service_gateway" "sg" {
6767
compartment_id = var.ociCompartmentOcid
68-
display_name = "grabdish"
68+
display_name = "grabdish"
6969
freeform_tags = {
7070
}
7171
#route_table_id = <<Optional value not found in discovery>>
@@ -74,9 +74,9 @@ resource oci_core_service_gateway sg {
7474
}
7575
vcn_id = oci_core_vcn.okell_vcn.id
7676
}
77-
resource oci_core_route_table private {
77+
resource "oci_core_route_table" "private" {
7878
compartment_id = var.ociCompartmentOcid
79-
display_name = "private"
79+
display_name = "private"
8080
freeform_tags = {
8181
}
8282
route_rules {
@@ -101,7 +101,7 @@ resource oci_core_route_table private {
101101
*/
102102
vcn_id = oci_core_vcn.okell_vcn.id
103103
}
104-
resource oci_core_default_route_table public {
104+
resource "oci_core_default_route_table" "public" {
105105
display_name = "public"
106106
freeform_tags = {
107107
}
@@ -116,46 +116,46 @@ resource oci_core_default_route_table public {
116116
resource "oci_core_subnet" "endpoint_Subnet" {
117117
#Required
118118
#availability_domain = data.oci_identity_availability_domain.ad1.name
119-
cidr_block = "10.0.0.0/28"
120-
compartment_id = var.ociCompartmentOcid
121-
vcn_id = oci_core_vcn.okell_vcn.id
119+
cidr_block = "10.0.0.0/28"
120+
compartment_id = var.ociCompartmentOcid
121+
vcn_id = oci_core_vcn.okell_vcn.id
122122
# Provider code tries to maintain compatibility with old versions.
123-
security_list_ids = [oci_core_security_list.endpoint.id]
124-
display_name = "SubNet1ForEndpoint"
123+
security_list_ids = [oci_core_security_list.endpoint.id]
124+
display_name = "SubNet1ForEndpoint"
125125
prohibit_public_ip_on_vnic = "false"
126-
route_table_id = oci_core_vcn.okell_vcn.default_route_table_id
127-
dns_label = "endpoint"
126+
route_table_id = oci_core_vcn.okell_vcn.default_route_table_id
127+
dns_label = "endpoint"
128128
}
129129
resource "oci_core_subnet" "nodePool_Subnet" {
130130
#Required
131131
#availability_domain = data.oci_identity_availability_domain.ad1.name
132-
cidr_block = "10.0.10.0/24"
133-
compartment_id = var.ociCompartmentOcid
134-
vcn_id = oci_core_vcn.okell_vcn.id
132+
cidr_block = "10.0.10.0/24"
133+
compartment_id = var.ociCompartmentOcid
134+
vcn_id = oci_core_vcn.okell_vcn.id
135135
# Provider code tries to maintain compatibility with old versions.
136-
security_list_ids = [oci_core_security_list.nodePool.id]
137-
display_name = "SubNet1ForNodePool"
136+
security_list_ids = [oci_core_security_list.nodePool.id]
137+
display_name = "SubNet1ForNodePool"
138138
prohibit_public_ip_on_vnic = "true"
139-
route_table_id = oci_core_route_table.private.id
140-
dns_label = "nodepool"
139+
route_table_id = oci_core_route_table.private.id
140+
dns_label = "nodepool"
141141
}
142142
resource "oci_core_subnet" "svclb_Subnet" {
143143
#Required
144144
#availability_domain = data.oci_identity_availability_domain.ad1.name
145-
cidr_block = "10.0.20.0/24"
146-
compartment_id = var.ociCompartmentOcid
147-
vcn_id = oci_core_vcn.okell_vcn.id
145+
cidr_block = "10.0.20.0/24"
146+
compartment_id = var.ociCompartmentOcid
147+
vcn_id = oci_core_vcn.okell_vcn.id
148148
# Provider code tries to maintain compatibility with old versions.
149-
security_list_ids = [oci_core_default_security_list.svcLB.id]
150-
display_name = "SubNet1ForSvcLB"
151-
route_table_id = oci_core_vcn.okell_vcn.default_route_table_id
152-
dhcp_options_id = oci_core_vcn.okell_vcn.default_dhcp_options_id
149+
security_list_ids = [oci_core_default_security_list.svcLB.id]
150+
display_name = "SubNet1ForSvcLB"
151+
route_table_id = oci_core_vcn.okell_vcn.default_route_table_id
152+
dhcp_options_id = oci_core_vcn.okell_vcn.default_dhcp_options_id
153153
prohibit_public_ip_on_vnic = "false"
154-
dns_label = "svclb"
154+
dns_label = "svclb"
155155
}
156-
resource oci_core_security_list nodePool {
156+
resource "oci_core_security_list" "nodePool" {
157157
compartment_id = var.ociCompartmentOcid
158-
display_name = "nodepool"
158+
display_name = "nodepool"
159159
egress_security_rules {
160160
description = "Allow pods on one worker node to communicate with pods on other worker nodes"
161161
destination = "10.0.10.0/24"
@@ -221,7 +221,7 @@ resource oci_core_security_list nodePool {
221221
}
222222
#udp_options = <<Optional value not found in discovery>>
223223
}
224-
/*
224+
/*
225225
egress_security_rules {
226226
description = "Allow nodes to communicate with OKE to ensure correct start-up and continued functioning (1)"
227227
destination = data.oci_core_services.services.services.1.cidr_block
@@ -309,7 +309,7 @@ resource oci_core_security_list nodePool {
309309
}
310310
#udp_options = <<Optional value not found in discovery>>
311311
}
312-
/*
312+
/*
313313
ingress_security_rules {
314314
#description = <<Optional value not found in discovery>>
315315
#icmp_options = <<Optional value not found in discovery>>
@@ -342,9 +342,9 @@ resource oci_core_security_list nodePool {
342342
vcn_id = oci_core_vcn.okell_vcn.id
343343
}
344344

345-
resource oci_core_security_list endpoint {
345+
resource "oci_core_security_list" "endpoint" {
346346
compartment_id = var.ociCompartmentOcid
347-
display_name = "endpoint"
347+
display_name = "endpoint"
348348
egress_security_rules {
349349
description = "Allow Kubernetes Control Plane to communicate with OKE"
350350
destination = data.oci_core_services.services.services.0.cidr_block
@@ -442,8 +442,8 @@ resource oci_core_security_list endpoint {
442442
vcn_id = oci_core_vcn.okell_vcn.id
443443
}
444444

445-
resource oci_core_default_security_list svcLB {
446-
display_name = "svcLB"
445+
resource "oci_core_default_security_list" "svcLB" {
446+
display_name = "svcLB"
447447
manage_default_resource_id = oci_core_vcn.okell_vcn.default_security_list_id
448448
}
449449
data "oci_core_services" "services" {

grabdish/terraform/database.tf

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ resource "random_string" "autonomous_database_wallet_password" {
88
special = true
99
}
1010
resource "random_password" "database_admin_password" {
11-
length = 12
12-
upper = true
13-
lower = true
14-
numeric = true
15-
special = false
16-
min_lower = "1"
17-
min_upper = "1"
11+
length = 12
12+
upper = true
13+
lower = true
14+
numeric = true
15+
special = false
16+
min_lower = "1"
17+
min_upper = "1"
1818
min_numeric = "1"
1919
}
2020
resource "oci_database_autonomous_database" "autonomous_database_atp" {
@@ -25,10 +25,10 @@ resource "oci_database_autonomous_database" "autonomous_database_atp" {
2525
data_storage_size_in_tbs = "1"
2626
db_name = var.orderDbName
2727
# is_free_tier = true , if there exists sufficient service limit
28-
is_free_tier = false
28+
is_free_tier = false
2929
#Optional #db_workload = "${var.autonomous_database_db_workload}"
3030
db_workload = var.autonomous_database_db_workload
31-
display_name ="ORDERDB"
31+
display_name = "ORDERDB"
3232
is_auto_scaling_enabled = "false"
3333
is_preview_version_with_service_terms_accepted = "false"
3434
}
@@ -40,17 +40,17 @@ resource "oci_database_autonomous_database" "autonomous_database_atp2" {
4040
data_storage_size_in_tbs = "1"
4141
db_name = var.inventoryDbName
4242
is_free_tier = false
43-
db_workload = var.autonomous_database_db_workload
43+
db_workload = var.autonomous_database_db_workload
4444
// Autonomous Database name cannot be longer than 14 characters.
45-
display_name = "INVENTORYDB"
45+
display_name = "INVENTORYDB"
4646
is_auto_scaling_enabled = "false"
4747
is_preview_version_with_service_terms_accepted = "false"
4848
}
4949
data "oci_database_autonomous_databases" "autonomous_databases_atp" {
5050
#Required
5151
compartment_id = var.ociCompartmentOcid
5252
#Optional
53-
display_name = "ORDERDB"
53+
display_name = "ORDERDB"
5454
db_workload = var.autonomous_database_db_workload
5555
}
5656
data "oci_database_autonomous_databases" "autonomous_databases_atp2" {
@@ -66,9 +66,9 @@ data "oci_objectstorage_namespace" "test_namespace" {
6666
compartment_id = var.ociCompartmentOcid
6767
}
6868
//========= Outputs ===========================
69-
output "ns_objectstorage_namespace" {
70-
value = [ data.oci_objectstorage_namespace.test_namespace.namespace ]
69+
output "ns_objectstorage_namespace" {
70+
value = [data.oci_objectstorage_namespace.test_namespace.namespace]
7171
}
7272
output "autonomous_database_admin_password" {
73-
value = [ "Welcome12345" ]
73+
value = ["Welcome12345"]
7474
}

grabdish/terraform/main_var.tf

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,11 @@ variable "ociCompartmentOcid" {}
66
variable "ociRegionIdentifier" {}
77
variable "runName" {}
88
variable "orderDbName" {}
9-
variable "inventoryDbName" {}
9+
variable "inventoryDbName" {}
10+
11+
variable "kubernetes_version" {
12+
description = "OKE Version"
13+
type = string
14+
default = "v1.27.2"
15+
}
16+

grabdish/terraform/provider.tf

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
terraform {
22
required_providers {
33
oci = {
4-
source = "oracle/oci"
5-
version = "4.42.0"
4+
source = "oracle/oci"
5+
version = "~> 5"
66
}
77
}
8+
required_version = "~> 1.2"
89
}
910

1011
provider "oci" {
11-
region = var.ociRegionIdentifier
12-
}
12+
region = var.ociRegionIdentifier
13+
}

0 commit comments

Comments
 (0)