feat: move from terraform to opentofu. hashicorp sucks

This commit is contained in:
Kat Inskip 2025-10-12 06:32:17 -07:00
parent 9a499d2f80
commit c3f8606e6f
Signed by: kat
GPG key ID: 465E64DECEA8CF0F
10 changed files with 47 additions and 41 deletions

2
.gitignore vendored
View file

@ -10,3 +10,5 @@ data/
.terraform.lock.hcl
.idea/
__pycache__/
tf/terraform.tfvars
tf/terraform.tfstate.backup

View file

@ -8,6 +8,7 @@ with pkgs; let
git-hooks = systemless-git-hooks pkgs.system;
repoShell = mkShell {
nativeBuildInputs = [
opentofu
nf-build-system
nf-update
pkgs.lix

View file

@ -1,2 +1,2 @@
sops -d ./tf.tfvars.sops > tf.tfvars
export TF_CLI_ARGS="--var-file=tf.tfvars"
sops -d ./terraform.tfvars.sops > terraform.tfvars
use flake

View file

@ -4,13 +4,13 @@ locals {
micro : "VM.Standard.E2.1.Micro",
}
availability_domain_micro = one(
/*availability_domain_micro = one(
[
for m in data.oci_core_shapes.this :
m.availability_domain
if contains(m.shapes[*].name, local.shapes.micro)
]
)
)*/
}
variable "tenancy_ocid" {
@ -29,6 +29,7 @@ variable "subnet_id" {
type = any
}
/*
data "oci_identity_availability_domains" "this" {
compartment_id = var.tenancy_ocid
}
@ -40,3 +41,4 @@ data "oci_core_shapes" "this" {
availability_domain = each.key
}
*/

View file

@ -23,7 +23,7 @@ locals {
}
resource "oci_core_instance" "that" {
availability_domain = data.oci_identity_availability_domains.this.availability_domains.0.name
availability_domain = "dBWL:CA-TORONTO-1-AD-1" #data.oci_identity_availability_domains.this.availability_domains.0.name
compartment_id = var.tenancy_ocid
shape = local.shapes.flex
@ -65,10 +65,13 @@ resource "oci_core_instance" "that" {
}
lifecycle {
ignore_changes = [source_details.0.source_id]
ignore_changes = [
metadata,
source_details.0.source_id
]
}
}
locals {
flex = oci_core_instance.that
}
}

View file

@ -27,7 +27,7 @@ variable "micro_display_names" {
resource "oci_core_instance" "this" {
count = 2
availability_domain = local.availability_domain_micro
availability_domain = "dBWL:CA-TORONTO-1-AD-1"
compartment_id = var.tenancy_ocid
shape = local.shapes.micro
@ -64,10 +64,13 @@ resource "oci_core_instance" "this" {
}
lifecycle {
ignore_changes = [source_details.0.source_id]
ignore_changes = [
metadata,
source_details.0.source_id
]
}
}
locals {
micros = oci_core_instance.this
}
}

View file

@ -1,3 +1,7 @@
variable "passphrase" {
sensitive = true
}
terraform {
required_providers {
# Vendor: Hashicorp
@ -23,28 +27,23 @@ terraform {
version = "4.4.0"
}
}
encryption {
method "unencrypted" "migrate" {}
/*
# Settings for local applies
backend "remote" {
hostname = "app.terraform.io"
organization = "kittywitch"
workspaces {
name = "nixfiles"
key_provider "pbkdf2" "kw" {
passphrase = var.passphrase
}
method "aes_gcm" "kw" {
keys = key_provider.pbkdf2.kw
}
state {
method = method.aes_gcm.kw
fallback {
method = method.unencrypted.migrate
}
}
}
*/
#/*
# Settings for remote applies
cloud {
organization = "kittywitch"
## Required for Terraform Enterprise; Defaults to app.terraform.io for Terraform Cloud
hostname = "app.terraform.io"
workspaces {
name = "nixfiles"
}
}
#*/
}

1
tf/terraform.tfstate Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file