-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.tf
49 lines (41 loc) · 1.29 KB
/
main.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
# Create SSH keys
resource "tls_private_key" "fvtt-instance-ssh-key" {
algorithm = "RSA"
rsa_bits = 4096
}
resource "local_file" "fvtt-instance-ssh-key" {
filename = "${path.module}/fvtt-instance-ssh-key.pem"
content = tls_private_key.fvtt-instance-ssh-key.private_key_pem
file_permission = 0600
}
# Computing resources
resource "oci_core_instance" "fvtt-instance-1" {
availability_domain = local.availability_domain[0]
compartment_id = oci_identity_compartment.fvtt-compartment.id
display_name = "fvtt-instance-1"
shape = local.instance_shape
freeform_tags = local.common_tags
create_vnic_details {
subnet_id = oci_core_subnet.fvtt-subnet.id
display_name = "primaryvnic"
assign_public_ip = true
hostname_label = "fvtt-instance-1"
}
source_details {
source_type = "image"
source_id = local.images[var.region]
boot_volume_size_in_gbs = var.boot_volume_size_in_gbs
}
metadata = {
ssh_authorized_keys = tls_private_key.fvtt-instance-ssh-key.public_key_openssh
}
state = var.instance_state
}
resource "local_file" "AnsibleInventory" {
content = templatefile("templates/ansible-inventory.tmpl",
{
fvtt-instance-1-ip = oci_core_instance.fvtt-instance-1.public_ip
}
)
filename = "ansible/inventory"
}