1- variable "cluster_kubernetes_version" {
2- default = " v1.8.11"
3- }
4-
5- variable "cluster_name" {
6- default = " tfTestCluster"
7- }
8-
9- variable "availability_domain" {
10- default = 3
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.8.11"
39- }
40-
41- variable "node_pool_name" {
42- default = " tfPool"
43- }
44-
45- variable "node_pool_node_image_name" {
46- default = " Oracle-Linux-7.4"
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- default = " ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDOuBJgh6lTmQvQJ4BA3RCJdSmxRtmiXAQEEIP68/G4gF3XuZdKEYTFeputacmRq9yO5ZnNXgO9akdUgePpf8+CfFtveQxmN5xo3HVCDKxu/70lbMgeu7+wJzrMOlzj+a4zNq2j0Ww2VWMsisJ6eV3bJTnO/9VLGCOC8M9noaOlcKcLgIYy4aDM724MxFX2lgn7o6rVADHRxkvLEXPVqYT4syvYw+8OVSnNgE4MJLxaw8/2K0qp19YlQyiriIXfQpci3ThxwLjymYRPj+kjU1xIxv6qbFQzHR7ds0pSWp1U06cIoKPfCazU9hGWW8yIe/vzfTbWrt2DK6pLwBn/G0x3 sample"
59- }
60-
61- data "oci_identity_availability_domains" "test_availability_domains" {
62- compartment_id = " ${ var . compartment_ocid } "
63- }
64-
65- resource "oci_core_virtual_network" "test_vcn" {
66- cidr_block = " 10.0.0.0/16"
67- compartment_id = " ${ var . compartment_ocid } "
68- display_name = " tfVcnForClusters"
69- }
70-
71- resource "oci_core_internet_gateway" "test_ig" {
72- compartment_id = " ${ var . compartment_ocid } "
73- display_name = " tfClusterInternetGateway"
74- vcn_id = " ${ oci_core_virtual_network . test_vcn . id } "
75- }
76-
77- resource "oci_core_route_table" "test_route_table" {
78- compartment_id = " ${ var . compartment_ocid } "
79- vcn_id = " ${ oci_core_virtual_network . test_vcn . id } "
80- display_name = " tfClustersRouteTable"
81-
82- route_rules {
83- destination = " 0.0.0.0/0"
84- destination_type = " CIDR_BLOCK"
85- network_entity_id = " ${ oci_core_internet_gateway . test_ig . id } "
86- }
87- }
88-
89- resource "oci_core_subnet" "clusterSubnet_1" {
90- # Required
91- availability_domain = " ${ lookup (data. oci_identity_availability_domains . test_availability_domains . availability_domains [var . availability_domain - 2 ]," name" )} "
92- cidr_block = " 10.0.20.0/24"
93- compartment_id = " ${ var . compartment_ocid } "
94- vcn_id = " ${ oci_core_virtual_network . test_vcn . id } "
95-
96- # Provider code tries to maintain compatibility with old versions.
97- security_list_ids = [" ${ oci_core_virtual_network . test_vcn . default_security_list_id } " ]
98- display_name = " tfSubNet1ForClusters"
99- route_table_id = " ${ oci_core_route_table . test_route_table . id } "
100- }
101-
102- resource "oci_core_subnet" "clusterSubnet_2" {
103- # Required
104- availability_domain = " ${ lookup (data. oci_identity_availability_domains . test_availability_domains . availability_domains [var . availability_domain - 1 ]," name" )} "
105- cidr_block = " 10.0.21.0/24"
106- compartment_id = " ${ var . compartment_ocid } "
107- vcn_id = " ${ oci_core_virtual_network . test_vcn . id } "
108- display_name = " tfSubNet1ForClusters"
109-
110- # Provider code tries to maintain compatibility with old versions.
111- security_list_ids = [" ${ oci_core_virtual_network . test_vcn . default_security_list_id } " ]
112- route_table_id = " ${ oci_core_route_table . test_route_table . id } "
113- }
114-
115- resource "oci_core_subnet" "nodePool_Subnet_1" {
116- # Required
117- availability_domain = " ${ lookup (data. oci_identity_availability_domains . test_availability_domains . availability_domains [var . availability_domain - 2 ]," name" )} "
118- cidr_block = " 10.0.22.0/24"
119- compartment_id = " ${ var . compartment_ocid } "
120- vcn_id = " ${ oci_core_virtual_network . test_vcn . id } "
121-
122- # Provider code tries to maintain compatibility with old versions.
123- security_list_ids = [" ${ oci_core_virtual_network . test_vcn . default_security_list_id } " ]
124- display_name = " tfSubNet1ForNodePool"
125- route_table_id = " ${ oci_core_route_table . test_route_table . id } "
126- }
127-
128- resource "oci_core_subnet" "nodePool_Subnet_2" {
129- # Required
130- availability_domain = " ${ lookup (data. oci_identity_availability_domains . test_availability_domains . availability_domains [var . availability_domain - 1 ]," name" )} "
131- cidr_block = " 10.0.23.0/24"
132- compartment_id = " ${ var . compartment_ocid } "
133- vcn_id = " ${ oci_core_virtual_network . test_vcn . id } "
134-
135- # Provider code tries to maintain compatibility with old versions.
136- security_list_ids = [" ${ oci_core_virtual_network . test_vcn . default_security_list_id } " ]
137- display_name = " tfSubNet2ForNodePool"
138- route_table_id = " ${ oci_core_route_table . test_route_table . id } "
139- }
140-
1411resource "oci_containerengine_cluster" "test_cluster" {
1422 # Required
1433 compartment_id = " ${ var . compartment_ocid } "
144- kubernetes_version = " ${ var . cluster_kubernetes_version } "
4+ kubernetes_version = " ${ data . oci_containerengine_cluster_option . test_cluster_option . kubernetes_versions . 0 } "
1455 name = " ${ var . cluster_name } "
1466 vcn_id = " ${ oci_core_virtual_network . test_vcn . id } "
1477
@@ -168,7 +28,7 @@ resource "oci_containerengine_node_pool" "test_node_pool" {
16828 # Required
16929 cluster_id = " ${ oci_containerengine_cluster . test_cluster . id } "
17030 compartment_id = " ${ var . compartment_ocid } "
171- kubernetes_version = " ${ var . node_pool_kubernetes_version } "
31+ kubernetes_version = " ${ data . oci_containerengine_node_pool_option . test_node_pool_option . kubernetes_versions . 0 } "
17232 name = " ${ var . node_pool_name } "
17333 node_image_name = " ${ var . node_pool_node_image_name } "
17434 node_shape = " ${ var . node_pool_node_shape } "
0 commit comments