mirror of
https://github.com/kittywitch/nixfiles.git
synced 2026-02-09 04:19:19 -08:00
feat(oci): attempt to make servers provisioned
This commit is contained in:
parent
0505f506d2
commit
e5b2f39e99
6 changed files with 71 additions and 18 deletions
|
|
@ -6,3 +6,11 @@ resource "oci_core_subnet" "this" {
|
|||
display_name = oci_core_vcn.this.display_name
|
||||
dns_label = "subnet"
|
||||
}
|
||||
|
||||
locals {
|
||||
subnet = oci_core_subnet.this
|
||||
}
|
||||
|
||||
output "subnet_id" {
|
||||
value = local.subnet.id
|
||||
}
|
||||
|
|
@ -1,3 +1,15 @@
|
|||
variable "kat_pgp_ssh_public_key" {
|
||||
type = string
|
||||
}
|
||||
|
||||
module "oci_servers" {
|
||||
source = "./oci_servers"
|
||||
|
||||
micro_display_names = ["Mei", "Mai"]
|
||||
flex_display_name = "Daiyousei"
|
||||
|
||||
tenancy_ocid = module.oci_compartment_bootstrap.child_compartment_id
|
||||
nsg_id = module.oci_common_private_network.nsg_id
|
||||
ssh_authorized_keys = [var.kat_pgp_ssh_public_key]
|
||||
subnet_id = module.oci_common_private_network.subnet_id
|
||||
}
|
||||
|
|
@ -20,6 +20,10 @@ locals {
|
|||
)
|
||||
}
|
||||
|
||||
variable "tenancy_ocid" {
|
||||
type = string
|
||||
}
|
||||
|
||||
data "oci_identity_availability_domains" "this" {
|
||||
compartment_id = var.tenancy_ocid
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,9 @@
|
|||
locals {
|
||||
takeover_oracle = yamlencode({
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
data "oci_core_images" "that" {
|
||||
compartment_id = var.tenancy_ocid
|
||||
|
||||
|
|
@ -10,20 +16,28 @@ data "oci_core_images" "that" {
|
|||
|
||||
data "cloudinit_config" "that" {
|
||||
part {
|
||||
content = file("user-data-that.yaml")
|
||||
content = local.takeover_oracle
|
||||
}
|
||||
}
|
||||
|
||||
variable "flex_display_name" {
|
||||
type = string
|
||||
}
|
||||
|
||||
locals {
|
||||
flex_hostname = lower(var.flex_display_name)
|
||||
}
|
||||
|
||||
resource "oci_core_instance" "that" {
|
||||
availability_domain = data.oci_identity_availability_domains.this.availability_domains.0.name
|
||||
compartment_id = var.tenancy_ocid
|
||||
shape = local.shapes.flex
|
||||
|
||||
display_name = "Oracle Linux"
|
||||
display_name = var.flex_display_name
|
||||
preserve_boot_volume = false
|
||||
|
||||
metadata = {
|
||||
ssh_authorized_keys = var.ssh_public_key
|
||||
ssh_authorized_keys = var.ssh_authorized_keys
|
||||
user_data = data.cloudinit_config.that.rendered
|
||||
}
|
||||
|
||||
|
|
@ -39,10 +53,10 @@ resource "oci_core_instance" "that" {
|
|||
|
||||
create_vnic_details {
|
||||
assign_public_ip = true
|
||||
display_name = "Oracle Linux"
|
||||
hostname_label = "oracle-linux"
|
||||
nsg_ids = [oci_core_network_security_group.this.id]
|
||||
subnet_id = oci_core_subnet.this.id
|
||||
display_name = var.flex_display_name
|
||||
hostname_label = local.flex_hostname
|
||||
nsg_ids = [var.nsg_id]
|
||||
subnet_id = var.subnet_id
|
||||
}
|
||||
|
||||
shape_config {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
locals {
|
||||
display_name = ["Mei", "Mai"]
|
||||
takeover_ubuntu = yamlencode({
|
||||
|
||||
})
|
||||
|
|
@ -27,6 +26,22 @@ data "cloudinit_config" "this" {
|
|||
}
|
||||
}
|
||||
|
||||
variable "micro_display_names" {
|
||||
type = list(string)
|
||||
}
|
||||
|
||||
variable "ssh_authorized_keys" {
|
||||
type = list(string)
|
||||
}
|
||||
|
||||
variable "nsg_id" {
|
||||
type = any
|
||||
}
|
||||
|
||||
variable "subnet_id" {
|
||||
type = any
|
||||
}
|
||||
|
||||
resource "oci_core_instance" "this" {
|
||||
count = 2
|
||||
|
||||
|
|
@ -34,11 +49,11 @@ resource "oci_core_instance" "this" {
|
|||
compartment_id = var.tenancy_ocid
|
||||
shape = local.shapes.micro
|
||||
|
||||
display_name = local.display_name[count.index]
|
||||
display_name = var.micro_display_names[count.index]
|
||||
preserve_boot_volume = false
|
||||
|
||||
metadata = {
|
||||
ssh_authorized_keys = var.ssh_public_key
|
||||
ssh_authorized_keys = var.ssh_authorized_keys
|
||||
user_data = data.cloudinit_config.this.rendered
|
||||
}
|
||||
|
||||
|
|
@ -53,10 +68,10 @@ resource "oci_core_instance" "this" {
|
|||
}
|
||||
|
||||
create_vnic_details {
|
||||
display_name = format("Ubuntu %d", count.index + 1)
|
||||
hostname_label = format("ubuntu-%d", count.index + 1)
|
||||
nsg_ids = [oci_core_network_security_group.this.id]
|
||||
subnet_id = oci_core_subnet.this.id
|
||||
display_name = var.micro_display_names[count.index]
|
||||
hostname_label = lower(var.micro_display_names[count.index])
|
||||
nsg_ids = [var.nsg_id]
|
||||
subnet_id = var.subnet_id
|
||||
}
|
||||
|
||||
source_details {
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ terraform {
|
|||
}
|
||||
}
|
||||
|
||||
#/*
|
||||
/*
|
||||
# Settings for local applies
|
||||
backend "remote" {
|
||||
hostname = "app.terraform.io"
|
||||
|
|
@ -33,9 +33,9 @@ terraform {
|
|||
name = "nixfiles-tf"
|
||||
}
|
||||
}
|
||||
#*/
|
||||
*/
|
||||
|
||||
/*
|
||||
#/*
|
||||
# Settings for remote applies
|
||||
cloud {
|
||||
organization = "kittywitch"
|
||||
|
|
@ -46,5 +46,5 @@ terraform {
|
|||
name = "nixfiles-tf"
|
||||
}
|
||||
}
|
||||
*/
|
||||
#*/
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue