-
Notifications
You must be signed in to change notification settings - Fork 0
/
outputs.tf
32 lines (28 loc) · 1.25 KB
/
outputs.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
# The "name" of the availability domain to be used for the compute instance.
output "name-of-first-availability-domain" {
value = data.oci_identity_availability_domains.ads.availability_domains[0]
}
output "objectstorage-namesace" {
value = data.oci_objectstorage_namespace.state_namespace
}
#output "vcn_id" {
# value = data.oci_core_vcns.main_vcns
#}
output "vm_list" {
value = [
for instance in [oci_core_instance.instance1, oci_core_instance.instance2, oci_core_instance.instance3] : {
hostname = instance.display_name
ip_address = instance.public_ip
user = "ubuntu"
}
]
}
resource "local_file" "ansible_inventory" {
filename = "ansible/inventory.ini"
content = <<-EOT
[oracl-inst]
${oci_core_instance.instance1.display_name} ansible_host=${oci_core_instance.instance1.public_ip} ansible_user=ubuntu ansible_ssh_private_key_file=${local.ssh_pubkey_path}
${oci_core_instance.instance2.display_name} ansible_host=${oci_core_instance.instance2.public_ip} ansible_user=ubuntu ansible_ssh_private_key_file=${local.ssh_pubkey_path}
${oci_core_instance.instance3.display_name} ansible_host=${oci_core_instance.instance3.public_ip} ansible_user=ubuntu ansible_ssh_private_key_file=${local.ssh_pubkey_path}
EOT
}