Repository navigation
Expand file tree
/
Copy pathinstance.tf
More file actions
120 lines (105 loc) · 3.59 KB
/
Copy pathinstance.tf
File metadata and controls
120 lines (105 loc) · 3.59 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
resource "oci_core_instance_configuration" "self" {
compartment_id = oci_identity_compartment.self.id
display_name = local.unique_resource_name
instance_details {
instance_type = "compute"
launch_details {
availability_domain = var.availability_domain
compartment_id = oci_identity_compartment.self.id
is_pv_encryption_in_transit_enabled = true
metadata = {
"ssh_authorized_keys" = var.pub_key
"user_data" = data.template_cloudinit_config.self.rendered
}
shape = var.vm_shape
agent_config {
are_all_plugins_disabled = false
is_management_disabled = false
is_monitoring_disabled = false
plugins_config {
desired_state = "DISABLED"
name = "Vulnerability Scanning"
}
plugins_config {
desired_state = "DISABLED"
name = "Oracle Java Management Service"
}
plugins_config {
desired_state = "ENABLED"
name = "OS Management Service Agent"
}
plugins_config {
desired_state = "ENABLED"
name = "Compute Instance Run Command"
}
plugins_config {
desired_state = "ENABLED"
name = "Compute Instance Monitoring"
}
plugins_config {
desired_state = "DISABLED"
name = "Block Volume Management"
}
plugins_config {
desired_state = "DISABLED"
name = "Bastion"
}
}
availability_config {
recovery_action = "RESTORE_INSTANCE"
}
create_vnic_details {
assign_private_dns_record = true
assign_public_ip = true
defined_tags = {}
freeform_tags = {}
nsg_ids = []
skip_source_dest_check = false
subnet_id = var.existing_pub_subnet == "" ? oci_core_subnet.public[0].id : var.existing_pub_subnet
}
instance_options {
are_legacy_imds_endpoints_disabled = false
}
# Only use this if we are using the Free Tier Image Size
dynamic "shape_config" {
for_each = var.vm_shape == "VM.Standard.A1.Flex" ? ["1"] : []
content {
memory_in_gbs = var.vm_specs["memory"]
ocpus = var.vm_specs["cpus"]
}
}
# Only use this if we are NOT using the Free Tier Image
dynamic "shape_config" {
for_each = var.vm_shape != "VM.Standard.A1.Flex" ? ["1"] : []
content {
memory_in_gbs = var.vm_specs["memory"]
ocpus = var.vm_specs["cpus"]
baseline_ocpu_utilization = "BASELINE_1_8"
}
}
source_details {
image_id = var.vm_image
source_type = "image"
}
}
}
freeform_tags = {
project = var.project_name
}
lifecycle {
create_before_destroy = true
}
}
resource "oci_core_instance_pool" "self" {
compartment_id = oci_identity_compartment.self.id
display_name = local.unique_resource_name
size = 1
instance_configuration_id = oci_core_instance_configuration.self.id
placement_configurations {
availability_domain = var.availability_domain
primary_subnet_id = var.existing_pub_subnet == "" ? oci_core_subnet.public[0].id : var.existing_pub_subnet
}
freeform_tags = {
project = var.project_name
}
}