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+ }
6+
7+ variable "user_ocid" {
8+ }
9+
10+ variable "compartment_ocid" {
11+ }
12+
13+ variable "region" {
14+ default = " us-ashburn-1"
15+ }
16+
17+ variable "kms_vault_id" {
18+ }
19+
20+ variable "compartment_id" {
21+ }
22+
23+ variable "cluster_cluster_pod_network_options_cni_type" {
24+ default = " OCI_VCN_IP_NATIVE"
25+ }
26+
27+ variable "cluster_defined_tags_value" {
28+ default = " value"
29+ }
30+
31+ variable "cluster_endpoint_config_is_public_ip_enabled" {
32+ default = false
33+ }
34+
35+ variable "cluster_endpoint_config_nsg_ids" {
36+ default = []
37+ }
38+
39+ variable "cluster_freeform_tags" {
40+ default = { " Department" = " Finance" }
41+ }
42+
43+ variable "cluster_image_policy_config_is_policy_enabled" {
44+ default = false
45+ }
46+
47+ variable "cluster_kubernetes_version" {
48+ default = " kubernetesVersion"
49+ }
50+
51+ variable "cluster_name" {
52+ default = " name"
53+ }
54+
55+ variable "cluster_options_add_ons_is_kubernetes_dashboard_enabled" {
56+ default = true
57+ }
58+
59+ variable "cluster_options_add_ons_is_tiller_enabled" {
60+ default = true
61+ }
62+
63+ variable "cluster_options_admission_controller_options_is_pod_security_policy_enabled" {
64+ default = false
65+ }
66+
67+ variable "cluster_options_kubernetes_network_config_pods_cidr" {
68+ default = " 10.1.0.0/16"
69+ }
70+
71+ variable "cluster_options_kubernetes_network_config_services_cidr" {
72+ default = " 10.2.0.0/16"
73+ }
74+
75+ variable "cluster_options_open_id_connect_token_authentication_config_is_open_id_connect_auth_enabled" {
76+ default = true
77+ }
78+
79+ variable "cluster_options_open_id_connect_token_authentication_config_configuration_file" {
80+ default = "YXBpVmVyc2lvbjogYXBpc2VydmVyLmNvbmZpZy5rOHMuaW8vdjFiZXRhMQpraW5kOiBBdXRoZW50aWNhdGlvbkNvbmZpZ3VyYXRpb24Kand0OgogIC0gaXNzdWVyOgogICAgICB1cmw6IGh0dHBzOi8vYWNjb3VudHMuZ29vZ2xlLmNvbQogICAgICBhdWRpZW5jZXM6CiAgICAgICAgLSA3OTc3NjQ0NDY1NjctMjZycTVrdDMzMTYyMWozdXJzdGQwZDVyODFkNnJkZDAuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20KICAgICAgYXVkaWVuY2VNYXRjaFBvbGljeTogTWF0Y2hBbnkKICAgIGNsYWltTWFwcGluZ3M6CiAgICAgIHVzZXJuYW1lOgogICAgICAgIGNsYWltOiAic3ViIgogICAgICAgIHByZWZpeDogIiIKICAgICAgZ3JvdXBzOgogICAgICAgIGNsYWltOiAiZ3JvdXBzIgogICAgICAgIHByZWZpeDogIiIKICAgICAgdWlkOgogICAgICAgIGNsYWltOiAic3ViIgogIC0gaXNzdWVyOgogICAgICB1cmw6IGh0dHBzOi8vZGV2LWQ4Y21qeXcydm1rMm1qY24udXMuYXV0aDAuY29tLwogICAgICBhdWRpZW5jZXM6CiAgICAgICAgLSBWM2YxeTJ4WVFvTFdXYmhUcXY4SGE3azltQ1FwSDg0aAogICAgICBhdWRpZW5jZU1hdGNoUG9saWN5OiBNYXRjaEFueQogICAgY2xhaW1NYXBwaW5nczoKICAgICAgdXNlcm5hbWU6CiAgICAgICAgY2xhaW06ICJzdWIiCiAgICAgICAgcHJlZml4OiAiIgogICAgICBncm91cHM6CiAgICAgICAgY2xhaW06ICJncm91cHMiCiAgICAgICAgcHJlZml4OiAiIgogICAgICB1aWQ6CiAgICAgICAgY2xhaW06ICJzdWIiCg=="
81+ }
82+
83+ variable "cluster_options_persistent_volume_config_defined_tags_value" {
84+ default = " value"
85+ }
86+
87+ variable "cluster_options_persistent_volume_config_freeform_tags" {
88+ default = { " Department" = " Finance" }
89+ }
90+
91+ variable "cluster_options_service_lb_config_defined_tags_value" {
92+ default = " value"
93+ }
94+
95+ variable "cluster_options_service_lb_config_freeform_tags" {
96+ default = { " Department" = " Finance" }
97+ }
98+
99+ variable "cluster_options_service_lb_subnet_ids" {
100+ default = []
101+ }
102+
103+ variable "cluster_state" {
104+ default = []
105+ }
106+
107+ variable "cluster_type" {
108+ default = " ENHANCED_CLUSTER"
109+ }
110+
111+
112+
113+ provider "oci" {
114+ region = var. region
115+ auth = " SecurityToken"
116+ config_file_profile = " terraform-federation-test"
117+ }
118+
119+ # variable defined_tag_namespace_name {
120+ # default = "test"
121+ # }
122+
123+ resource "oci_core_vcn" "test_vcn" {
124+ cidr_block = " 10.0.0.0/16"
125+ compartment_id = var. compartment_ocid
126+ display_name = " tfVcnForClusters"
127+ }
128+
129+ resource "oci_core_internet_gateway" "test_ig" {
130+ compartment_id = var. compartment_ocid
131+ display_name = " tfClusterInternetGateway"
132+ vcn_id = oci_core_vcn. test_vcn . id
133+ }
134+
135+ # resource "oci_identity_tag_namespace" "tag-namespace1" {
136+ # #Required
137+ # compartment_id = var.tenancy_ocid
138+ # description = "example tag namespace"
139+ # name = var.defined_tag_namespace_name != "" ? var.defined_tag_namespace_name : "example-tag-namespace-all"
140+ #
141+ # is_retired = false
142+ # }
143+
144+ resource "oci_core_route_table" "test_route_table" {
145+ compartment_id = var. compartment_ocid
146+ vcn_id = oci_core_vcn. test_vcn . id
147+ display_name = " tfClustersRouteTable"
148+
149+ route_rules {
150+ destination = " 0.0.0.0/0"
151+ destination_type = " CIDR_BLOCK"
152+ network_entity_id = oci_core_internet_gateway. test_ig . id
153+ }
154+ }
155+
156+ data "oci_identity_availability_domains" "test_availability_domains" {
157+ compartment_id = var. tenancy_ocid
158+ }
159+
160+ data "oci_identity_availability_domain" "ad1" {
161+ compartment_id = var. tenancy_ocid
162+ ad_number = 1
163+ }
164+
165+ data "oci_identity_availability_domain" "ad2" {
166+ compartment_id = var. tenancy_ocid
167+ ad_number = 2
168+ }
169+
170+ resource "oci_core_subnet" "clusterSubnet_2" {
171+ # Required
172+ availability_domain = data. oci_identity_availability_domain . ad2 . name
173+ cidr_block = " 10.0.21.0/24"
174+ compartment_id = var. compartment_ocid
175+ vcn_id = oci_core_vcn. test_vcn . id
176+ display_name = " tfSubNet1ForClusters"
177+
178+ # Provider code tries to maintain compatibility with old versions.
179+ security_list_ids = [oci_core_vcn . test_vcn . default_security_list_id ]
180+ route_table_id = oci_core_route_table. test_route_table . id
181+ }
182+
183+ resource "oci_containerengine_cluster" "test_cluster_multi_issuer" {
184+ # Required
185+ compartment_id = var. compartment_ocid
186+ kubernetes_version = " v1.30.1"
187+ name = " tfTestMultiIssuer"
188+ vcn_id = oci_core_vcn. test_vcn . id
189+
190+ # Optional
191+ # defined_tags = map(oci_identity_tag_namespace.tag-namespace1.name.oci_identity_tag.tag1.name, var.cluster_defined_tags_value)
192+
193+ freeform_tags = var. cluster_freeform_tags
194+ options {
195+
196+ # Optional
197+ add_ons {
198+
199+ # Optional
200+ is_kubernetes_dashboard_enabled = var. cluster_options_add_ons_is_kubernetes_dashboard_enabled
201+ is_tiller_enabled = var. cluster_options_add_ons_is_tiller_enabled
202+ }
203+ admission_controller_options {
204+
205+ # Optional
206+ is_pod_security_policy_enabled = var. cluster_options_admission_controller_options_is_pod_security_policy_enabled
207+ }
208+ kubernetes_network_config {
209+
210+ # Optional
211+ pods_cidr = var. cluster_options_kubernetes_network_config_pods_cidr
212+ services_cidr = var. cluster_options_kubernetes_network_config_services_cidr
213+ }
214+ open_id_connect_token_authentication_config {
215+ # Required
216+ is_open_id_connect_auth_enabled = var. cluster_options_open_id_connect_token_authentication_config_is_open_id_connect_auth_enabled
217+
218+ # Optional
219+ configuration_file = var. cluster_options_open_id_connect_token_authentication_config_configuration_file
220+ }
221+ }
222+ type = var. cluster_type
223+ }
224+
225+ data "oci_containerengine_clusters" "test_clusters" {
226+ # Required
227+ compartment_id = var. compartment_ocid
228+
229+ # Optional
230+ name = var. cluster_name
231+ state = var. cluster_state
232+ }
0 commit comments