-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcompute.tf
128 lines (113 loc) · 4.22 KB
/
compute.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# Powercenter Compute Resources
# Master Powercenter Server
resource "oci_core_instance" "pc_instance" {
depends_on = ["oci_database_db_system.domain_db_system"]
availability_domain = "${lookup(data.oci_identity_availability_domains.availability_domains.availability_domains[0], "name")}"
compartment_id = "${var.compartment_ocid}"
shape = "${var.pcvm["instance_shape"]}"
display_name = "${var.pcvm["instance_display_name"]}"
create_vnic_details {
subnet_id = "${oci_core_subnet.subnet.id}"
hostname_label ="${var.pcvm["instance_display_name"]}"
}
metadata {
ssh_authorized_keys = "${tls_private_key.key.public_key_openssh}"
}
source_details {
source_id = "${var.pcvm["instance_imageid"]}"
source_type = "image"
}
preserve_boot_volume = false
# Upload configuration scripts and set executable
provisioner "file" {
source = "./scripts"
destination = "/home/opc"
connection {
host = "${oci_core_instance.pc_instance.public_ip}"
type = "ssh"
user = "opc"
private_key = "${tls_private_key.key.private_key_pem}"
timeout = "5m"
}
}
# Setup scripts to be executable as well as
# mount FSS on the instance.
provisioner "remote-exec" {
inline = [
"chmod -R 755 /home/opc/scripts",
"export mount_target_ip=${lookup(data.oci_core_private_ips.fss1_mt_1_ip.private_ips[0], "ip_address")}",
"export export_name=${var.fss_config["export_path"]}",
"export mount_point=${var.fss_config["mountpoint"]}",
"/home/opc/scripts/mount-fss.sh"
]
connection {
host = "${oci_core_instance.pc_instance.public_ip}"
type = "ssh"
user = "opc"
private_key = "${tls_private_key.key.private_key_pem}"
timeout = "5m"
}
}
}
# # Optional Power Center instances
# resource "oci_core_instance" "pc_instance_worker" {
# depends_on = ["oci_database_db_system.domain_db_system", "oci_core_instance.pc_instance"]
# count = "${var.pc_instance_worker_node_count}"
# availability_domain = "${lookup(data.oci_identity_availability_domains.availability_domains.availability_domains[0], "name")}"
# compartment_id = "${var.compartment_ocid}"
# shape = "${var.pc_instance_shape}"
# display_name = "${var.pc_instance_worker_display_name}-${count.index}"
# create_vnic_details {
# subnet_id = "${oci_core_subnet.subnet.id}"
# }
# metadata {
# ssh_authorized_keys = "${tls_private_key.key.public_key_openssh}"
# }
# source_details {
# source_id = "${var.pc_instance_imageid}"
# source_type = "image"
# }
# preserve_boot_volume = false
# # Upload configuration scripts and set executable
# provisioner "file" {
# source = "./scripts"
# destination = "/home/opc"
# connection {
# host = "${oci_core_instance.pc_instance_worker.public_ip}"
# type = "ssh"
# user = "opc"
# private_key = "${tls_private_key.key.private_key_pem}"
# timeout = "5m"
# }
# }
# provisioner "remote-exec" {
# inline = [
# "chmod -R 755 /home/opc/scripts"
# ]
# connection {
# host = "${oci_core_instance.pc_instance.public_ip}"
# type = "ssh"
# user = "opc"
# private_key = "${tls_private_key.key.private_key_pem}"
# timeout = "5m"
# }
# }
# # Setup scripts to be executable as well as
# # mount FSS on the instance.
# provisioner "remote-exec" {
# inline = [
# "chmod -R 755 /home/opc/scripts",
# "export mount_target_ip=${lookup(data.oci_core_private_ips.fss1_mt_1_ip.private_ips[0], "ip_address")}",
# "export export_name=${var.fss_export_path}",
# "export mount_point=${var.fss_mountpoint}",
# "/home/opc/scripts/mount-fss.sh"
# ]
# connection {
# host = "${oci_core_instance.pc_instance.public_ip}"
# type = "ssh"
# user = "opc"
# private_key = "${tls_private_key.key.private_key_pem}"
# timeout = "5m"
# }
# }
# }