-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.tf
More file actions
79 lines (63 loc) · 1.76 KB
/
main.tf
File metadata and controls
79 lines (63 loc) · 1.76 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
variable "compartment_id" { type = string }
variable "compute_name" { type = string }
variable "compute_subnet_id" { type = string }
variable "compute_image_id" { type = string }
variable "compute_ssh_authorized_keys" { type = string }
variable "zone_id" { type = string }
variable "record_name" { type = string }
variable "compute_shape" {
type = string
default = "VM.Standard.E2.1.Micro"
}
variable "compute_cpus" {
type = string
default = "1"
}
variable "compute_memory_in_gbs" {
type = string
default = "1"
}
data "oci_identity_availability_domains" "ads" {
compartment_id = var.compartment_id
}
resource "oci_core_instance" "tf_compute" {
availability_domain = data.oci_identity_availability_domains.ads.availability_domains[0].name
compartment_id = var.compartment_id
shape = var.compute_shape
source_details {
source_id = var.compute_image_id
source_type = "image"
}
display_name = var.compute_name
shape_config {
ocpus = var.compute_cpus
memory_in_gbs = var.compute_memory_in_gbs
}
create_vnic_details {
subnet_id = var.compute_subnet_id
assign_public_ip = true
}
metadata = {
ssh_authorized_keys = file(var.compute_ssh_authorized_keys)
}
preserve_boot_volume = false
}
resource "cloudflare_record" "tf_compute" {
zone_id = var.zone_id
name = var.record_name
type = "A"
value = oci_core_instance.tf_compute.public_ip
proxied = true
}
output "compute_state" {
value = oci_core_instance.tf_compute.state
}
output "compute_public_ip" {
value = oci_core_instance.tf_compute.public_ip
}
output "cloudflare_record_name" {
value = cloudflare_record.tf_compute.name
}
output "cloudflare_record_value" {
value = cloudflare_record.tf_compute.value
}