-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tf
62 lines (55 loc) · 1.86 KB
/
main.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
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
# Configure the OCI provider with an API Key
# tenancy_ocid is the compartment OCID for the root compartment
provider "oci" {
tenancy_ocid = var.tenancy_ocid
user_ocid = var.user_ocid
fingerprint = var.fingerprint
private_key_path = var.private_key_path
region = var.region
}
# Get a list of Availability Domains
data "oci_identity_availability_domains" "ads" {
compartment_id = var.tenancy_ocid
}
# Output the result
/* output "show-ads" {
value = data.oci_identity_availability_domains.ads.availability_domains
} */
data "template_file" "setup-vaultwarden" {
template = file("./user_data/vaultwarden.yaml")
vars = {
tailscale_key = var.tailscale_key
caddy_domain_name = var.caddy_domain_name
caddy_acme_reg_email = var.caddy_acme_reg_email
duckdns_token = var.duckdns_token
duckdns_domain = var.duckdns_domain
}
}
resource "oci_core_instance" "ampere_instance" {
# Required
availability_domain = data.oci_identity_availability_domains.ads.availability_domains[0].name
compartment_id = var.tenancy_ocid
# Display name of instance
display_name = "vaultwarden-ampere"
shape = "VM.Standard.A1.Flex"
shape_config {
# baseline_ocpu_utilization = var.instance_shape_config_baseline_ocpu_utilization
memory_in_gbs = var.instance_shape_config_memory_in_gbs
ocpus = var.instance_shape_config_ocpus
}
source_details {
source_id = var.os_image_source_id
source_type = "image"
}
# Optional - Public Subnet of VNIC that has already been created.
create_vnic_details {
assign_public_ip = true
hostname_label = "vaultwarden"
subnet_id = var.vnic_subnetid
}
metadata = {
user_data = base64encode(data.template_file.setup-vaultwarden.rendered)
ssh_authorized_keys = var.ssh_public_key
}
preserve_boot_volume = false
}