-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcompute-ampere.tf
61 lines (49 loc) · 1.66 KB
/
compute-ampere.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
resource "oci_core_instance" "vm_instance_ampere" {
count = 2
availability_domain = data.oci_identity_availability_domains.ads.availability_domains[0].name
compartment_id = oci_identity_compartment.homelab.id
shape = "VM.Standard.A1.Flex"
display_name = join("", [var.vm_name, "0", count.index + 1])
preserve_boot_volume = false
is_pv_encryption_in_transit_enabled = true
freeform_tags = var.tags
shape_config {
memory_in_gbs = 12
ocpus = 2
}
metadata = {
ssh_authorized_keys = var.ssh_public_key
}
connection {
type = "ssh"
host = "${self.public_ip}"
user = "ubuntu"
private_key = file("~/.ssh/id_rsa")
}
provisioner "file" {
source = "./scripts/apache2.sh"
destination = "/tmp/apache2.sh"
}
provisioner "remote-exec" {
inline = [
"chmod +x /tmp/apache2.sh",
"/tmp/apache2.sh",
]
}
source_details {
source_id = var.vm_image_ocid_ampere
source_type = "image"
}
availability_config {
is_live_migration_preferred = true
}
create_vnic_details {
assign_public_ip = true
subnet_id = oci_core_subnet.vcn-public-subnet.id
assign_private_dns_record = true
hostname_label = join("", [var.vm_name, "0", count.index + 1])
private_ip = join(".", ["10", "0", "0", count.index + 101])
nsg_ids = [oci_core_network_security_group.homelab-network-security-group.id]
freeform_tags = var.tags
}
}