-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatasources.tf
More file actions
executable file
·77 lines (64 loc) · 2.31 KB
/
datasources.tf
File metadata and controls
executable file
·77 lines (64 loc) · 2.31 KB
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
/*Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
The Universal Permissive License (UPL), Version 1.0*/
# Get list of Availability Domains
data "oci_identity_availability_domains" "ADs" {
compartment_id = "${var.tenancy_ocid}"
}
# Get name of Availability Domains
data "template_file" "deployment_ad" {
count = "${length(var.AD)}"
template = "${lookup(data.oci_identity_availability_domains.ADs.availability_domains[var.AD[count.index] - 1], "name")}"
}
# Get list of Fault Domains
data "oci_identity_fault_domains" "fds" {
count = "${length(var.AD)}"
availability_domain = "${element(data.template_file.deployment_ad.*.rendered, count.index)}"
compartment_id = "${var.compartment_ocid}"
}
locals {
fault_domains = "${flatten(concat(data.oci_identity_fault_domains.fds.*.fault_domains))}"
faultdomains_per_ad = 3
}
# Get name of Fault Domains
data "template_file" "deployment_fd" {
template = "$${name}"
count = "${length(var.AD) * (local.faultdomains_per_ad) }"
vars = {
name = "${lookup(local.fault_domains[count.index], "name")}"
}
}
# Get latest Oracle Linux image
data "oci_core_images" "InstanceImageOCID" {
compartment_id = "${var.tenancy_ocid}"
operating_system = "${var.instance_os}"
operating_system_version = "${var.linux_os_version}"
filter {
name = "display_name"
values = ["^.*Oracle[^G]*$"]
regex = true
}
}
# Get Windows image
data "oci_core_images" "WinInstanceImageOCID" {
compartment_id = "${var.tenancy_ocid}"
operating_system = "${var.WinInstanceOS}"
operating_system_version = "${var.WinInstanceOSVersion}"
}
# Get swift object storage name for Service Gateway
data "oci_core_services" "svcgtw_services" {
filter {
name = "name"
values = [".*Object.*Storage"]
regex = true
}
}
# Render inputs for mounting Filesystem storage service
data "template_file" "bootstrap" {
template = "${file("${path.module}/userdata/bootstrap.tpl")}"
vars {
timezone = "${var.timezone}"
fss_mount_path = "${var.psft_stage_filesystem_path}/"
fss_export_path = "${element(module.create_fss.FilesystemExports, 0)}"
fss_mount_target_private_ip = "${element(module.create_fss.FilesystemPrivateIPs, 0)}"
}
}