-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path03_instance_ol7.tf
More file actions
67 lines (49 loc) · 1.73 KB
/
03_instance_ol7.tf
File metadata and controls
67 lines (49 loc) · 1.73 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
# --------- Get the OCID for the more recent for Oracle Linux 7.5 disk image
data "oci_core_images" "OLImageOCID-ol7" {
compartment_id = "${var.compartment_ocid}"
operating_system = "Oracle Linux"
operating_system_version = "7.5"
}
# Create image from exported image via direct access to object store
resource "oci_core_image" "test_image" {
#Required
compartment_id = "${var.compartment_ocid}"
#Optional
# display_name = "${var.image_display_name}"
# launch_mode = "${var.image_launch_mode}"
image_source_details {
source_type = "objectStorageTuple"
bucket_name = "${oci_objectstorage_bucket.bucket1.name}"
namespace_name = "${var.oci_objectstorage_namespace}"
object_name = "${var.ObjectName}" # exported image name
#Optional
#source_image_type = "${var.source_image_type}"
}
}
# ------ Create a compute instance from the more recent Oracle Linux 7.5 image
resource "oci_core_instance" "AppServer" {
availability_domain = "${lookup(data.oci_identity_availability_domains.ADs.availability_domains[0],"name")}"
compartment_id = "${var.compartment_ocid}"
display_name = "AppServer"
hostname_label = "AppServer"
# image = "ocid1.image.oc1.iad.aaaaaaaa2tq67tvbeavcmioghquci6p3pvqwbneq3vfy7fe7m7geiga4cnxa"
shape = "VM.Standard2.1"
subnet_id = "${oci_core_subnet.public-subnet.id}"
metadata {
ssh_authorized_keys = "${file(var.ssh_public_key_file_ol7)}"
#user_data = "${base64encode(file(var.BootStrapFile_ol7))}"
}
source_details {
#Required
source_id = "${oci_core_image.test_image.id}"
source_type = "image"
#Optional
boot_volume_size_in_gbs = "60"
}
timeouts {
create = "30m"
}
}
# output " Public IP of instance " {
# value = ["${oci_core_instance.testImage.public_ip}"]
# }