-
Notifications
You must be signed in to change notification settings - Fork 1
/
compute.tf
82 lines (69 loc) · 2.17 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
data "oci_core_images" "OSImages" {
compartment_id = var.compartment_ocid
display_name = var.instance_shape
}
resource "tls_private_key" "opc_key" {
algorithm = "RSA"
rsa_bits = 4096
}
### BASTION HOST
resource "oci_core_instance" "bastion" {
availability_domain = data.oci_identity_availability_domains.ads.availability_domains[1].name
compartment_id = var.compartment_ocid
display_name = "bastion_host"
shape = var.instance_shape
create_vnic_details {
subnet_id = oci_core_subnet.vcn_moodle_public_subnet.id
display_name = "bastion_vnic"
assign_public_ip = true
}
source_details {
source_type = "image"
source_id = var.instance_image_ocid[var.region]
boot_volume_size_in_gbs = "50"
}
metadata = {
ssh_authorized_keys = file("id_rsa.pub")
user_data = data.template_cloudinit_config.bastion_cloud_init.rendered
}
}
## APP SERVER 1
resource "oci_core_instance" "moodle_main1" {
availability_domain = data.oci_identity_availability_domains.ads.availability_domains[0].name
fault_domain = data.oci_identity_fault_domains.test_fault_domains.fault_domains[0].name
compartment_id = var.compartment_ocid
display_name = var.instance_name1
shape = var.instance_shape
create_vnic_details {
subnet_id = oci_core_subnet.vcn_moodle_private_subnet.id
assign_public_ip = false
}
source_details {
source_type = "image"
source_id = var.instance_image_ocid[var.region]
boot_volume_size_in_gbs = "50"
}
metadata = {
ssh_authorized_keys = file("id_rsa.pub")
}
}
## APP SERVER 2
resource "oci_core_instance" "moodle_main2" {
availability_domain = data.oci_identity_availability_domains.ads.availability_domains[0].name
fault_domain = data.oci_identity_fault_domains.test_fault_domains.fault_domains[2].name
compartment_id = var.compartment_ocid
display_name = var.instance_name2
shape = var.instance_shape
create_vnic_details {
subnet_id = oci_core_subnet.vcn_moodle_private_subnet.id
assign_public_ip = false
}
source_details {
source_type = "image"
source_id = var.instance_image_ocid[var.region]
boot_volume_size_in_gbs = "50"
}
metadata = {
ssh_authorized_keys = file("id_rsa.pub")
}
}