diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.gitignore b/.gitignore index 3906290..e8168ee 100644 --- a/.gitignore +++ b/.gitignore @@ -34,3 +34,4 @@ override.tf.json terraform.rc .terraform.lock.hcl *.tfbackend +.direnv diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..fc5227d --- /dev/null +++ b/flake.lock @@ -0,0 +1,61 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1694529238, + "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1698266953, + "narHash": "sha256-jf72t7pC8+8h8fUslUYbWTX5rKsRwOzRMX8jJsGqDXA=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "75a52265bda7fd25e06e3a67dee3f0354e73243c", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..351896c --- /dev/null +++ b/flake.nix @@ -0,0 +1,18 @@ +{ + description = "A basic flake with a shell"; + inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + inputs.flake-utils.url = "github:numtide/flake-utils"; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem (system: let + pkgs = nixpkgs.legacyPackages.${system}; + in { + devShells.default = pkgs.mkShell { + packages = with pkgs; [ + bashInteractive + opentofu + jq + ]; + }; + }); +} diff --git a/terraform/main.tf b/terraform/main.tf index 561fde2..48c066b 100644 --- a/terraform/main.tf +++ b/terraform/main.tf @@ -6,22 +6,24 @@ terraform { required_providers { libvirt = { source = "dmacvicar/libvirt" + version = "0.7.1" # https://github.com/dmacvicar/terraform-provider-libvirt/issues/1040 } } } provider "libvirt" { - uri = "qemu+ssh://root@atlas.hyp/system" + # https://libvirt.org/uri.html#libssh-and-libssh2-transport + uri = "qemu+ssh://root@atlas.hyp/system?known_hosts=/etc/ssh/ssh_known_hosts" } provider "libvirt" { alias = "jefke" - uri = "qemu+ssh://root@jefke.hyp/system" + uri = "qemu+ssh://root@jefke.hyp/system?known_hosts=/etc/ssh/ssh_known_hosts" } provider "libvirt" { alias = "lewis" - uri = "qemu+ssh://root@lewis.hyp/system" + uri = "qemu+ssh://root@lewis.hyp/system?known_hosts=/etc/ssh/ssh_known_hosts" } resource "libvirt_pool" "iso" { @@ -42,6 +44,12 @@ resource "libvirt_pool" "init" { path = "/kvm/init" } +resource "libvirt_pool" "data" { + name = "data" + type = "dir" + path = "/kvm/data" +} + resource "libvirt_volume" "ubuntu_jammy" { name = "ubuntu-jammy.img" pool = "iso"