|
1 | 1 | ## Copyright 2017, 2019, Oracle Corporation and/or affiliates. All rights reserved. |
2 | 2 | ## Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl |
3 | 3 |
|
4 | | -#data "template_file" "install_calico" { |
5 | | -# template = file("${path.module}/scripts/install_calico.template.sh") |
6 | | - |
7 | | -# vars = { |
8 | | -# calico_version = var.calico.calico_version |
9 | | -# number_of_nodes = var.node_pools.nodepool_topology * var.node_pools.node_pools * var.node_pools.node_pool_quantity_per_subnet |
10 | | -# pod_cidr = var.oke_cluster.cluster_options_kubernetes_network_config_pods_cidr |
11 | | -# number_of_replicas = min(20,max((var.node_pools.nodepool_topology * var.node_pools.node_pools * var.node_pools.node_pool_quantity_per_subnet)/200,3)) |
12 | | -# user_ocid = var.oke_identity.user_ocid |
13 | | -# } |
14 | | - |
15 | | -# count = var.calico.install_calico == true ? 1 : 0 |
16 | | -#} |
17 | | - |
18 | | -#resource null_resource "install_calico" { |
19 | | -# connection { |
20 | | -# host = var.oke_bastion.bastion_public_ip |
21 | | -# private_key = file(var.oke_ssh_keys.ssh_private_key_path) |
22 | | -# timeout = "40m" |
23 | | -# type = "ssh" |
24 | | -# user = var.oke_bastion.image_operating_system == "Canonical Ubuntu" ? "ubuntu" : "opc" |
25 | | -# } |
26 | | - |
27 | | -# depends_on = ["null_resource.install_kubectl_bastion", "null_resource.write_kubeconfig_bastion"] |
28 | | - |
29 | | -# provisioner "file" { |
30 | | -# content = data.template_file.install_calico[0].rendered |
31 | | -# destination = "~/install_calico.sh" |
32 | | -# } |
33 | | - |
34 | | -# provisioner "remote-exec" { |
35 | | -# inline = [ |
36 | | -# "chmod +x $HOME/install_calico.sh", |
37 | | -# "$HOME/install_calico.sh", |
38 | | -# "rm -f $HOME/install_calico.sh" |
39 | | -# ] |
40 | | -# } |
41 | | - |
42 | | -# count = var.oke_bastion.create_bastion == true && var.calico.install_calico == true ? 1 : 0 |
43 | | -#} |
| 4 | +data "template_file" "install_calico" { |
| 5 | + template = file("${path.module}/scripts/install_calico.template.sh") |
| 6 | + |
| 7 | + vars = { |
| 8 | + calico_version = var.calico.calico_version |
| 9 | + number_of_nodes = local.total_nodes |
| 10 | + pod_cidr = var.oke_cluster.cluster_options_kubernetes_network_config_pods_cidr |
| 11 | + number_of_replicas = min(20,max((local.total_nodes)/200,3)) |
| 12 | + user_ocid = var.oke_identity.user_ocid |
| 13 | + } |
| 14 | + |
| 15 | + count = var.calico.install_calico == true ? 1 : 0 |
| 16 | +} |
| 17 | + |
| 18 | +resource null_resource "install_calico" { |
| 19 | + connection { |
| 20 | + host = var.oke_bastion.bastion_public_ip |
| 21 | + private_key = file(var.oke_ssh_keys.ssh_private_key_path) |
| 22 | + timeout = "40m" |
| 23 | + type = "ssh" |
| 24 | + user = var.oke_bastion.image_operating_system == "Canonical Ubuntu" ? "ubuntu" : "opc" |
| 25 | + } |
| 26 | + |
| 27 | + depends_on = ["null_resource.install_kubectl_bastion", "null_resource.write_kubeconfig_bastion"] |
| 28 | + |
| 29 | + provisioner "file" { |
| 30 | + content = data.template_file.install_calico[0].rendered |
| 31 | + destination = "~/install_calico.sh" |
| 32 | + } |
| 33 | + |
| 34 | + provisioner "remote-exec" { |
| 35 | + inline = [ |
| 36 | + "chmod +x $HOME/install_calico.sh", |
| 37 | + "$HOME/install_calico.sh", |
| 38 | + "rm -f $HOME/install_calico.sh" |
| 39 | + ] |
| 40 | + } |
| 41 | + |
| 42 | + count = var.oke_bastion.create_bastion == true && var.calico.install_calico == true ? 1 : 0 |
| 43 | +} |
0 commit comments