Skip to content

Commit 0295515

Browse files
authored
Upgraded terraform and terraform oci provider to 0.12.X version (#2353)
* upgrade to ver 0.12 * changed default val
1 parent d997263 commit 0295515

File tree

24 files changed

+1110
-897
lines changed

24 files changed

+1110
-897
lines changed

integration-tests/src/test/resources/oke/terraform/cluster.tf

Lines changed: 77 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -2,62 +2,103 @@
22
# Copyright (c) 2020, 2021, Oracle and/or its affiliates.
33
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
44
*/
5-
variable "cluster_kubernetes_version" { default = "v1.15.7" }
6-
variable "cluster_name" { default = "tfTestCluster" }
7-
variable "cluster_options_add_ons_is_kubernetes_dashboard_enabled" { default = true }
8-
variable "cluster_options_add_ons_is_tiller_enabled" { default = true }
9-
variable "cluster_options_kubernetes_network_config_pods_cidr" { default = "10.1.0.0/16" }
10-
variable "cluster_options_kubernetes_network_config_services_cidr" { default = "10.2.0.0/16" }
11-
variable "node_pool_initial_node_labels_key" { default = "key" }
12-
variable "node_pool_initial_node_labels_value" { default = "value" }
13-
variable "node_pool_kubernetes_version" { default = "v1.11.5" }
14-
variable "node_pool_name" { default = "tfTestCluster_workers" }
15-
variable "node_pool_node_image_name" { default = "Oracle-Linux-7.6" }
16-
variable "node_pool_node_shape" { default = "VM.Standard2.1" }
17-
variable "node_pool_quantity_per_subnet" { default = 2 }
18-
variable "node_pool_ssh_public_key" { }
5+
variable "cluster_kubernetes_version" {
6+
default = "v1.17.9"
7+
}
198

20-
data "oci_identity_availability_domains" "tfsample_availability_domains" {
21-
compartment_id = "${var.compartment_ocid}"
9+
variable "cluster_name" {
10+
default = "tfTestCluster"
11+
}
12+
13+
variable "cluster_options_add_ons_is_kubernetes_dashboard_enabled" {
14+
default = true
15+
}
16+
17+
variable "cluster_options_add_ons_is_tiller_enabled" {
18+
default = true
19+
}
20+
21+
variable "cluster_options_kubernetes_network_config_pods_cidr" {
22+
default = "10.1.0.0/16"
23+
}
24+
25+
variable "cluster_options_kubernetes_network_config_services_cidr" {
26+
default = "10.2.0.0/16"
27+
}
28+
29+
variable "node_pool_initial_node_labels_key" {
30+
default = "key"
31+
}
32+
33+
variable "node_pool_initial_node_labels_value" {
34+
default = "value"
35+
}
36+
37+
variable "node_pool_kubernetes_version" {
38+
default = "v1.17.9"
2239
}
2340

41+
variable "node_pool_name" {
42+
default = "tfTestCluster_workers"
43+
}
44+
45+
variable "node_pool_node_image_name" {
46+
default = "Oracle-Linux-7.6"
47+
}
48+
49+
variable "node_pool_node_shape" {
50+
default = "VM.Standard2.1"
51+
}
52+
53+
variable "node_pool_quantity_per_subnet" {
54+
default = 2
55+
}
56+
57+
variable "node_pool_ssh_public_key" {
58+
}
59+
60+
data "oci_identity_availability_domains" "tfsample_availability_domains" {
61+
compartment_id = var.compartment_ocid
62+
}
2463

2564
resource "oci_containerengine_cluster" "tfsample_cluster" {
2665
#Required
27-
compartment_id = "${var.compartment_ocid}"
28-
kubernetes_version = "${var.cluster_kubernetes_version}"
29-
name = "${var.cluster_name}"
30-
vcn_id = "${oci_core_virtual_network.oke-vcn.id}"
66+
compartment_id = var.compartment_ocid
67+
kubernetes_version = var.cluster_kubernetes_version
68+
name = var.cluster_name
69+
vcn_id = oci_core_virtual_network.oke-vcn.id
3170

3271
#Optional
3372
options {
34-
service_lb_subnet_ids = ["${oci_core_subnet.oke-subnet-loadbalancer-1.id}", "${oci_core_subnet.oke-subnet-loadbalancer-2.id}"]
73+
service_lb_subnet_ids = [oci_core_subnet.oke-subnet-loadbalancer-1.id, oci_core_subnet.oke-subnet-loadbalancer-2.id]
3574

3675
#Optional
3776
add_ons {
3877
#Optional
39-
is_kubernetes_dashboard_enabled = "${var.cluster_options_add_ons_is_kubernetes_dashboard_enabled}"
40-
is_tiller_enabled = "${var.cluster_options_add_ons_is_tiller_enabled}"
78+
is_kubernetes_dashboard_enabled = var.cluster_options_add_ons_is_kubernetes_dashboard_enabled
79+
is_tiller_enabled = var.cluster_options_add_ons_is_tiller_enabled
4180
}
4281
}
4382
}
4483

4584
resource "oci_containerengine_node_pool" "tfsample_node_pool" {
46-
#Required
47-
cluster_id = "${oci_containerengine_cluster.tfsample_cluster.id}"
48-
compartment_id = "${var.compartment_ocid}"
49-
kubernetes_version = "${var.node_pool_kubernetes_version}"
50-
name = "${var.node_pool_name}"
51-
node_image_name = "${var.node_pool_node_image_name}"
52-
node_shape = "${var.node_pool_node_shape}"
53-
#subnet_ids = ["${oci_core_subnet.oke-subnet-worker-1.id}", "${oci_core_subnet.oke-subnet-worker-2.id}","${oci_core_subnet.oke-subnet-worker-3.id}"]
54-
subnet_ids = ["${oci_core_subnet.oke-subnet-worker-1.id}", "${oci_core_subnet.oke-subnet-worker-2.id}"]
85+
#Required
86+
cluster_id = oci_containerengine_cluster.tfsample_cluster.id
87+
compartment_id = var.compartment_ocid
88+
kubernetes_version = var.node_pool_kubernetes_version
89+
name = var.node_pool_name
90+
node_image_name = var.node_pool_node_image_name
91+
node_shape = var.node_pool_node_shape
92+
93+
#subnet_ids = ["${oci_core_subnet.oke-subnet-worker-1.id}", "${oci_core_subnet.oke-subnet-worker-2.id}","${oci_core_subnet.oke-subnet-worker-3.id}"]
94+
subnet_ids = [oci_core_subnet.oke-subnet-worker-1.id, oci_core_subnet.oke-subnet-worker-2.id]
5595

56-
#Optional
57-
quantity_per_subnet = "${var.node_pool_quantity_per_subnet}"
58-
ssh_public_key = "${var.node_pool_ssh_public_key}"
96+
#Optional
97+
quantity_per_subnet = var.node_pool_quantity_per_subnet
98+
ssh_public_key = var.node_pool_ssh_public_key
5999
}
60100

61101
output "cluster_id" {
62-
value = "${oci_containerengine_cluster.tfsample_cluster.id}"
102+
value = oci_containerengine_cluster.tfsample_cluster.id
63103
}
104+

integration-tests/src/test/resources/oke/terraform/export.tf

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
*/
55
resource "oci_file_storage_export" "oketest_export" {
66
#Required
7-
export_set_id = "${oci_file_storage_export_set.oketest_export_set.id}"
8-
file_system_id = "${oci_file_storage_file_system.oketest_fs.id}"
7+
export_set_id = oci_file_storage_export_set.oketest_export_set.id
8+
file_system_id = oci_file_storage_file_system.oketest_fs.id
99
path = "/oketest"
1010
}
11+

integration-tests/src/test/resources/oke/terraform/export_set.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@
55

66
resource "oci_file_storage_export_set" "oketest_export_set" {
77
# Required
8-
mount_target_id = "${oci_file_storage_mount_target.oketest_mount_target.id}"
8+
mount_target_id = oci_file_storage_mount_target.oketest_mount_target.id
99
}
10+

integration-tests/src/test/resources/oke/terraform/file_system.tf

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
resource "oci_file_storage_file_system" "oketest_fs" {
77
#Required
8-
availability_domain = "${lookup(data.oci_identity_availability_domains.ADs.availability_domains[1],"name")}"
9-
compartment_id = "${var.compartment_ocid}"
8+
availability_domain = data.oci_identity_availability_domains.ADs.availability_domains[1]["name"]
9+
compartment_id = var.compartment_ocid
1010
}
11+

integration-tests/src/test/resources/oke/terraform/kube_config.tf

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,21 @@
33
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
44
*/
55

6-
variable "cluster_kube_config_expiration" { default = 2592000 }
7-
variable "cluster_kube_config_token_version" { default = "1.0.0" }
6+
variable "cluster_kube_config_expiration" {
7+
default = 2592000
8+
}
9+
10+
variable "cluster_kube_config_token_version" {
11+
default = "2.0.0"
12+
}
813

914
data "oci_containerengine_cluster_kube_config" "tfsample_cluster_kube_config" {
1015
#Required
11-
cluster_id = "${oci_containerengine_cluster.tfsample_cluster.id}"
16+
cluster_id = oci_containerengine_cluster.tfsample_cluster.id
1217
}
1318

1419
resource "local_file" "tfsample_cluster_kube_config_file" {
15-
content = "${data.oci_containerengine_cluster_kube_config.tfsample_cluster_kube_config.content}"
20+
content = data.oci_containerengine_cluster_kube_config.tfsample_cluster_kube_config.content
1621
filename = "${path.module}/${var.cluster_name}_kubeconfig"
1722
}
23+

integration-tests/src/test/resources/oke/terraform/mount_target.tf

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@
44
*/
55
resource "oci_file_storage_mount_target" "oketest_mount_target" {
66
#Required
7-
availability_domain = "${lookup(data.oci_identity_availability_domains.ADs.availability_domains[1],"name")}"
8-
9-
compartment_id = "${var.compartment_ocid}"
10-
subnet_id = "${oci_core_subnet.oke-subnet-worker-2.id}"
7+
availability_domain = data.oci_identity_availability_domains.ADs.availability_domains[1]["name"]
8+
9+
compartment_id = var.compartment_ocid
10+
subnet_id = oci_core_subnet.oke-subnet-worker-2.id
1111

1212
#Optional
1313
display_name = "${var.cluster_name}-mt"
1414
}
15+

integration-tests/src/test/resources/oke/terraform/provider.tf

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,28 @@
55
*/
66

77
// These variables would commonly be defined as environment variables or sourced in a .env file
8-
variable "tenancy_ocid" {}
9-
variable "user_ocid" {}
10-
variable "fingerprint" {}
11-
variable "private_key_path" {}
12-
variable "region" { default = "us-phoenix-1" }
8+
variable "tenancy_ocid" {
9+
}
10+
11+
variable "user_ocid" {
12+
}
13+
14+
variable "fingerprint" {
15+
}
16+
17+
variable "private_key_path" {
18+
}
19+
20+
variable "region" {
21+
default = "us-phoenix-1"
22+
}
1323

1424
provider "oci" {
1525
version = ">= 3.0.0"
16-
region = "${var.region}"
17-
tenancy_ocid = "${var.tenancy_ocid}"
18-
user_ocid = "${var.user_ocid}"
19-
fingerprint = "${var.fingerprint}"
20-
private_key_path = "${var.private_key_path}"
26+
region = var.region
27+
tenancy_ocid = var.tenancy_ocid
28+
user_ocid = var.user_ocid
29+
fingerprint = var.fingerprint
30+
private_key_path = var.private_key_path
2131
}
32+

0 commit comments

Comments
 (0)