mirror of
https://github.com/kittywitch/nixfiles.git
synced 2026-02-09 12:29:19 -08:00
feat: move from terraform to opentofu. hashicorp sucks
This commit is contained in:
parent
9a499d2f80
commit
c3f8606e6f
10 changed files with 47 additions and 41 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -10,3 +10,5 @@ data/
|
||||||
.terraform.lock.hcl
|
.terraform.lock.hcl
|
||||||
.idea/
|
.idea/
|
||||||
__pycache__/
|
__pycache__/
|
||||||
|
tf/terraform.tfvars
|
||||||
|
tf/terraform.tfstate.backup
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ with pkgs; let
|
||||||
git-hooks = systemless-git-hooks pkgs.system;
|
git-hooks = systemless-git-hooks pkgs.system;
|
||||||
repoShell = mkShell {
|
repoShell = mkShell {
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs = [
|
||||||
|
opentofu
|
||||||
nf-build-system
|
nf-build-system
|
||||||
nf-update
|
nf-update
|
||||||
pkgs.lix
|
pkgs.lix
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,2 @@
|
||||||
sops -d ./tf.tfvars.sops > tf.tfvars
|
sops -d ./terraform.tfvars.sops > terraform.tfvars
|
||||||
export TF_CLI_ARGS="--var-file=tf.tfvars"
|
use flake
|
||||||
|
|
|
||||||
|
|
@ -4,13 +4,13 @@ locals {
|
||||||
micro : "VM.Standard.E2.1.Micro",
|
micro : "VM.Standard.E2.1.Micro",
|
||||||
}
|
}
|
||||||
|
|
||||||
availability_domain_micro = one(
|
/*availability_domain_micro = one(
|
||||||
[
|
[
|
||||||
for m in data.oci_core_shapes.this :
|
for m in data.oci_core_shapes.this :
|
||||||
m.availability_domain
|
m.availability_domain
|
||||||
if contains(m.shapes[*].name, local.shapes.micro)
|
if contains(m.shapes[*].name, local.shapes.micro)
|
||||||
]
|
]
|
||||||
)
|
)*/
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "tenancy_ocid" {
|
variable "tenancy_ocid" {
|
||||||
|
|
@ -29,6 +29,7 @@ variable "subnet_id" {
|
||||||
type = any
|
type = any
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
data "oci_identity_availability_domains" "this" {
|
data "oci_identity_availability_domains" "this" {
|
||||||
compartment_id = var.tenancy_ocid
|
compartment_id = var.tenancy_ocid
|
||||||
}
|
}
|
||||||
|
|
@ -40,3 +41,4 @@ data "oci_core_shapes" "this" {
|
||||||
|
|
||||||
availability_domain = each.key
|
availability_domain = each.key
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ locals {
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "oci_core_instance" "that" {
|
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
|
compartment_id = var.tenancy_ocid
|
||||||
shape = local.shapes.flex
|
shape = local.shapes.flex
|
||||||
|
|
||||||
|
|
@ -65,7 +65,10 @@ resource "oci_core_instance" "that" {
|
||||||
}
|
}
|
||||||
|
|
||||||
lifecycle {
|
lifecycle {
|
||||||
ignore_changes = [source_details.0.source_id]
|
ignore_changes = [
|
||||||
|
metadata,
|
||||||
|
source_details.0.source_id
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ variable "micro_display_names" {
|
||||||
resource "oci_core_instance" "this" {
|
resource "oci_core_instance" "this" {
|
||||||
count = 2
|
count = 2
|
||||||
|
|
||||||
availability_domain = local.availability_domain_micro
|
availability_domain = "dBWL:CA-TORONTO-1-AD-1"
|
||||||
compartment_id = var.tenancy_ocid
|
compartment_id = var.tenancy_ocid
|
||||||
shape = local.shapes.micro
|
shape = local.shapes.micro
|
||||||
|
|
||||||
|
|
@ -64,7 +64,10 @@ resource "oci_core_instance" "this" {
|
||||||
}
|
}
|
||||||
|
|
||||||
lifecycle {
|
lifecycle {
|
||||||
ignore_changes = [source_details.0.source_id]
|
ignore_changes = [
|
||||||
|
metadata,
|
||||||
|
source_details.0.source_id
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
variable "passphrase" {
|
||||||
|
sensitive = true
|
||||||
|
}
|
||||||
|
|
||||||
terraform {
|
terraform {
|
||||||
required_providers {
|
required_providers {
|
||||||
# Vendor: Hashicorp
|
# Vendor: Hashicorp
|
||||||
|
|
@ -23,28 +27,23 @@ terraform {
|
||||||
version = "4.4.0"
|
version = "4.4.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
encryption {
|
||||||
|
method "unencrypted" "migrate" {}
|
||||||
|
|
||||||
/*
|
key_provider "pbkdf2" "kw" {
|
||||||
# Settings for local applies
|
passphrase = var.passphrase
|
||||||
backend "remote" {
|
}
|
||||||
hostname = "app.terraform.io"
|
|
||||||
organization = "kittywitch"
|
method "aes_gcm" "kw" {
|
||||||
workspaces {
|
keys = key_provider.pbkdf2.kw
|
||||||
name = "nixfiles"
|
}
|
||||||
|
|
||||||
|
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
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
Loading…
Add table
Add a link
Reference in a new issue