|
| 1 | +// Copyright (c) 2017, 2023, 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 "fingerprint" { |
| 11 | +} |
| 12 | + |
| 13 | +variable "private_key_path" { |
| 14 | +} |
| 15 | + |
| 16 | +variable "region" { |
| 17 | +} |
| 18 | + |
| 19 | +variable "compartment_id" { |
| 20 | +} |
| 21 | + |
| 22 | +variable "subnet_id" { |
| 23 | +} |
| 24 | + |
| 25 | +variable "bds_instance_cluster_admin_password" { |
| 26 | + default = "T3JhY2xlVGVhbVVTQSExMjM=" |
| 27 | +} |
| 28 | + |
| 29 | +variable "kms_key_id" { |
| 30 | +} |
| 31 | + |
| 32 | +variable "cluster_profile" { |
| 33 | +} |
| 34 | + |
| 35 | +variable "bds_instance_cluster_public_key" { |
| 36 | + default = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDpUa4zUZKyU3AkW9yoJTBDO550wpWZOXdHswfRq75gbJ2ZYlMtifvwiO3qUL/RIZSC6e1wA5OL2LQ97UaHrLLPXgjvKGVIDRHqPkzTOayjJ4ZA7NPNhcu6f/OxhKkCYF3TAQObhMJmUSMrWSUeufaRIujDz1HHqazxOgFk09fj4i2dcGnfPcm32t8a9MzlsHSmgexYCUwxGisuuWTsnMgxbqsj6DaY51l+SEPi5tf10iFmUWqziF0eKDDQ/jHkwLJ8wgBJef9FSOmwJReHcBY+NviwFTatGj7Cwtnks6CVomsFD+rAMJ9uzM8SCv5agYunx07hnEXbR9r/TXqgXGfN [email protected]" |
| 37 | +} |
| 38 | + |
| 39 | +variable "bds_instance_cluster_version" { |
| 40 | + default = "ODH1" |
| 41 | +} |
| 42 | + |
| 43 | +variable "bds_instance_defined_tags_value" { |
| 44 | + default = "value" |
| 45 | +} |
| 46 | + |
| 47 | +variable "bds_instance_display_name" { |
| 48 | + default = "displayName2" |
| 49 | +} |
| 50 | + |
| 51 | +variable "bds_instance_freeform_tags" { |
| 52 | + default = { |
| 53 | + "bar-key" = "value" |
| 54 | + } |
| 55 | +} |
| 56 | + |
| 57 | +variable "bds_instance_is_high_availability" { |
| 58 | + default = false |
| 59 | +} |
| 60 | + |
| 61 | +variable "bds_instance_is_secure" { |
| 62 | + default = false |
| 63 | +} |
| 64 | + |
| 65 | +variable "bds_instance_network_config_cidr_block" { |
| 66 | + default = "111.112.0.0/16" |
| 67 | +} |
| 68 | + |
| 69 | +variable "bds_instance_network_config_is_nat_gateway_required" { |
| 70 | + default = false |
| 71 | +} |
| 72 | + |
| 73 | +variable "bds_instance_nodes_block_volume_size_in_gbs" { |
| 74 | + default = 150 |
| 75 | +} |
| 76 | + |
| 77 | +variable "bds_instance_worker_nodes_block_volume_size_in_gbs" { |
| 78 | + default = 150 |
| 79 | +} |
| 80 | + |
| 81 | +variable "bds_instance_nodes_shape" { |
| 82 | + default = "VM.Standard2.4" |
| 83 | +} |
| 84 | + |
| 85 | +variable "bds_instance_worker_node_shape" { |
| 86 | + default = "VM.Standard2.4" |
| 87 | +} |
| 88 | + |
| 89 | +variable "bds_instance_compute_only_worker_node_shape" { |
| 90 | + default = "VM.Standard.E4.Flex" |
| 91 | +} |
| 92 | + |
| 93 | +variable "bds_instance_compute_only_worker_memory_per_node" { |
| 94 | + default = 32 |
| 95 | +} |
| 96 | + |
| 97 | +variable "bds_instance_compute_only_worker_ocpu_per_node" { |
| 98 | + default = 3 |
| 99 | +} |
| 100 | + |
| 101 | +variable "bds_instance_edge_node_shape" { |
| 102 | + default = "VM.Standard.E4.Flex" |
| 103 | +} |
| 104 | + |
| 105 | +variable "bds_instance_edge_memory_per_node" { |
| 106 | + default = 32 |
| 107 | +} |
| 108 | + |
| 109 | +variable "bds_instance_edge_ocpu_per_node" { |
| 110 | + default = 3 |
| 111 | +} |
| 112 | + |
| 113 | +variable "bds_instance_state" { |
| 114 | + default = "ACTIVE" |
| 115 | +} |
| 116 | + |
| 117 | +data "oci_core_services" "test_bds_services" { |
| 118 | +} |
| 119 | + |
| 120 | +#Uncomment this when running in home region (PHX) |
| 121 | +#variable "tag_namespace_description" { |
| 122 | +# default = "Just a test" |
| 123 | +#} |
| 124 | + |
| 125 | +#Uncomment this when running in home region (PHX) |
| 126 | +#variable "tag_namespace_name" { |
| 127 | +# default = "testexamples-tag-namespace" |
| 128 | +#} |
| 129 | + |
| 130 | +provider "oci" { |
| 131 | + tenancy_ocid = var.tenancy_ocid |
| 132 | +# user_ocid = var.user_ocid |
| 133 | +# fingerprint = var.fingerprint |
| 134 | +# private_key_path = var.private_key_path |
| 135 | + auth = "SecurityToken" |
| 136 | + config_file_profile = "terraform-federation-test" |
| 137 | + region = var.region |
| 138 | +} |
| 139 | + |
| 140 | +#Uncomment this when running in home region (PHX) |
| 141 | +#resource "oci_identity_tag_namespace" "tag-namespace1" { |
| 142 | +# #Required |
| 143 | +# compartment_id = var.tenancy_ocid |
| 144 | +# description = var.tag_namespace_description |
| 145 | +# name = var.tag_namespace_name |
| 146 | +#} |
| 147 | + |
| 148 | +#Uncomment this when running in home region (PHX) |
| 149 | +#resource "oci_identity_tag" "tag1" { |
| 150 | +# #Required |
| 151 | +# description = "tf example tag" |
| 152 | +# name = "tf-example-tag" |
| 153 | +# tag_namespace_id = oci_identity_tag_namespace.tag-namespace1.id |
| 154 | +#} |
| 155 | + |
| 156 | +resource "oci_core_vcn" "vcn_bds" { |
| 157 | + cidr_block = "111.111.0.0/16" |
| 158 | + compartment_id = var.compartment_id |
| 159 | + display_name = "BDS_VCN" |
| 160 | + dns_label = "bdsvcn" |
| 161 | +} |
| 162 | + |
| 163 | +resource "oci_core_service_gateway" "export_sgw" { |
| 164 | + compartment_id = var.compartment_id |
| 165 | + display_name = "sgw" |
| 166 | + |
| 167 | + services { |
| 168 | + service_id = data.oci_core_services.test_bds_services.services[0]["id"] |
| 169 | + } |
| 170 | + |
| 171 | + vcn_id = oci_core_vcn.vcn_bds.id |
| 172 | +} |
| 173 | + |
| 174 | +resource "oci_core_route_table" "private_rt" { |
| 175 | + compartment_id = var.compartment_id |
| 176 | + display_name = "private-rt" |
| 177 | + |
| 178 | + route_rules { |
| 179 | + destination = data.oci_core_services.test_bds_services.services[0]["cidr_block"] |
| 180 | + destination_type = "SERVICE_CIDR_BLOCK" |
| 181 | + network_entity_id = oci_core_service_gateway.export_sgw.id |
| 182 | + } |
| 183 | + |
| 184 | + vcn_id = oci_core_vcn.vcn_bds.id |
| 185 | +} |
| 186 | + |
| 187 | +resource "oci_core_subnet" "regional_subnet_bds" { |
| 188 | + cidr_block = "111.111.0.0/24" |
| 189 | + display_name = "regionalSubnetBds" |
| 190 | + dns_label = "regionalbds" |
| 191 | + compartment_id = var.compartment_id |
| 192 | + vcn_id = oci_core_vcn.vcn_bds.id |
| 193 | + security_list_ids = [oci_core_vcn.vcn_bds.default_security_list_id] |
| 194 | + route_table_id = oci_core_vcn.vcn_bds.default_route_table_id |
| 195 | + dhcp_options_id = oci_core_vcn.vcn_bds.default_dhcp_options_id |
| 196 | +} |
| 197 | + |
| 198 | +resource "oci_bds_bds_instance" "test_bds_instance" { |
| 199 | + #Required |
| 200 | + cluster_admin_password = var.bds_instance_cluster_admin_password |
| 201 | + cluster_public_key = var.bds_instance_cluster_public_key |
| 202 | + cluster_version = var.bds_instance_cluster_version |
| 203 | + compartment_id = var.compartment_id |
| 204 | + display_name = var.bds_instance_display_name |
| 205 | + is_high_availability = var.bds_instance_is_high_availability |
| 206 | + is_secure = var.bds_instance_is_secure |
| 207 | + kms_key_id = var.kms_key_id |
| 208 | + cluster_profile = var.cluster_profile |
| 209 | + #bootstrap_script_url = "https://objectstorage.us-ashburn-1.oraclecloud.com/p/5cwJG7AZBnrZsbTCOVc2TacwIcvND6pCxRwSm-Te7GmOY5TkS8zV9FpVgSuLCH4W/n/idpbwtq1b3ta/b/bucket-20230214-1316/o/execute_bootstrap_script.sh" |
| 210 | + |
| 211 | + master_node { |
| 212 | + #Required |
| 213 | + shape = var.bds_instance_nodes_shape |
| 214 | + |
| 215 | + subnet_id = var.subnet_id |
| 216 | + block_volume_size_in_gbs = var.bds_instance_nodes_block_volume_size_in_gbs |
| 217 | + number_of_nodes = 1 |
| 218 | + } |
| 219 | + |
| 220 | + util_node { |
| 221 | + #Required |
| 222 | + shape = var.bds_instance_nodes_shape |
| 223 | + |
| 224 | + subnet_id = var.subnet_id |
| 225 | + block_volume_size_in_gbs = var.bds_instance_nodes_block_volume_size_in_gbs |
| 226 | + number_of_nodes = 1 |
| 227 | + } |
| 228 | + |
| 229 | + worker_node { |
| 230 | + #Required |
| 231 | + shape = var.bds_instance_worker_node_shape |
| 232 | + |
| 233 | + subnet_id = var.subnet_id |
| 234 | + block_volume_size_in_gbs = var.bds_instance_worker_nodes_block_volume_size_in_gbs |
| 235 | + number_of_nodes = 3 |
| 236 | + } |
| 237 | + |
| 238 | + #edge_node { |
| 239 | + #Required |
| 240 | + # shape = var.bds_instance_edge_node_shape |
| 241 | + |
| 242 | + # subnet_id = var.subnet_id |
| 243 | + # block_volume_size_in_gbs = var.bds_instance_worker_nodes_block_volume_size_in_gbs |
| 244 | + # number_of_nodes = 1 |
| 245 | + # shape_config { |
| 246 | + #memory_in_gbs = var.bds_instance_edge_memory_per_node |
| 247 | + # ocpus = var.bds_instance_edge_ocpu_per_node |
| 248 | + # } |
| 249 | + #} |
| 250 | + |
| 251 | + #compute_only_worker_node { |
| 252 | + #Required |
| 253 | + # shape = var.bds_instance_compute_only_worker_node_shape |
| 254 | + |
| 255 | + # subnet_id = var.subnet_id |
| 256 | + # block_volume_size_in_gbs = var.bds_instance_worker_nodes_block_volume_size_in_gbs |
| 257 | + # number_of_nodes = 1 |
| 258 | + # shape_config { |
| 259 | + # memory_in_gbs = var.bds_instance_compute_only_worker_memory_per_node |
| 260 | + # ocpus = var.bds_instance_compute_only_worker_ocpu_per_node |
| 261 | + # } |
| 262 | + #} |
| 263 | + |
| 264 | + |
| 265 | + |
| 266 | + |
| 267 | + # cloud_sql_details { |
| 268 | + # shape = "VM.Standard2.4" |
| 269 | + # block_volume_size_in_gbs = 1000 |
| 270 | + # } |
| 271 | + |
| 272 | + is_cloud_sql_configured = false |
| 273 | + |
| 274 | + |
| 275 | + #Change value to true for use of Kafka cluster |
| 276 | + is_kafka_configured = false |
| 277 | + |
| 278 | + #Uncomment kafka_broker_node block for use of Kafka cluster |
| 279 | + #kafka_broker_node { |
| 280 | + #Required |
| 281 | + # shape = var.bds_instance_compute_only_worker_node_shape |
| 282 | + |
| 283 | + # subnet_id = var.subnet_id |
| 284 | + # block_volume_size_in_gbs = var.bds_instance_worker_nodes_block_volume_size_in_gbs |
| 285 | + # number_of_nodes = 1 |
| 286 | + # shape_config { |
| 287 | + # memory_in_gbs = var.bds_instance_compute_only_worker_memory_per_node |
| 288 | + # ocpus = var.bds_instance_compute_only_worker_ocpu_per_node |
| 289 | + # } |
| 290 | + #} |
| 291 | + |
| 292 | + #Optional |
| 293 | + #Uncomment this when running in home region (PHX) |
| 294 | + # defined_tags = { |
| 295 | + # "${oci_identity_tag_namespace.tag-namespace1.name}.${oci_identity_tag.tag1.name}" = var.bds_instance_defined_tags_value |
| 296 | + # } |
| 297 | + freeform_tags = var.bds_instance_freeform_tags |
| 298 | + network_config { |
| 299 | + #Optional |
| 300 | + cidr_block = var.bds_instance_network_config_cidr_block |
| 301 | + is_nat_gateway_required = var.bds_instance_network_config_is_nat_gateway_required |
| 302 | + } |
| 303 | +} |
| 304 | + |
| 305 | +data "oci_bds_bds_instances" "test_bds_instances" { |
| 306 | + #Required |
| 307 | + compartment_id = var.compartment_id |
| 308 | + |
| 309 | + #Optional |
| 310 | + display_name = oci_bds_bds_instance.test_bds_instance.display_name |
| 311 | + state = "ACTIVE" |
| 312 | +} |
| 313 | + |
| 314 | +data "oci_bds_bds_instance" "test_bds_instance" { |
| 315 | + #Required |
| 316 | + bds_instance_id = oci_bds_bds_instance.test_bds_instance.id |
| 317 | +} |
| 318 | + |
| 319 | +resource "oci_bds_bds_instance_operation_certificate_managements_management" "test_bds_instance_operation_certificate_managements_management" { |
| 320 | + bds_instance_id = oci_bds_bds_instance.test_bds_instance.id |
| 321 | + cluster_admin_password = var.bds_instance_cluster_admin_password |
| 322 | + enable_operation_certificate_management = "true" |
| 323 | + renew_operation_certificate_management = "false" |
| 324 | + services = ["OOZIE"] |
| 325 | +} |
0 commit comments