Skip to content

Commit

Permalink
Fix Terraform examples for newer Nix versions
Browse files Browse the repository at this point in the history
The examples do work for the Nix version that the book is tested
against, but this updates them to also work for newer Nix versions.

For more details, see:

Gabriella439/terraform-nixos-ng#9
  • Loading branch information
Gabriella439 committed Sep 23, 2024
1 parent a9f5fe7 commit e6cfbe6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions manuscript/Terraform.md
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ module "ami" {
}
module "nixos" {
source = "github.com/Gabriella439/terraform-nixos-ng//nixos?ref=d8563d06cc65bc699ffbf1ab8d692b1343ecd927"
source = "github.com/Gabriella439/terraform-nixos-ng//nixos?ref=af1a0af57287851f957be2b524fcdc008a21d9ae"
host = "root@${aws_instance.todo.public_ip}"
flake = ".#default"
arguments = [ "--build-host", "root@${aws_instance.todo.public_ip}" ]
Expand All @@ -467,7 +467,7 @@ let
source = fetchFromGitHub {
owner = "Gabriella439";
repo = "terraform-nixos-ng";
rev = "d8563d06cc65bc699ffbf1ab8d692b1343ecd927";
rev = "af1a0af57287851f957be2b524fcdc008a21d9ae";
hash = …;
};
Expand Down Expand Up @@ -503,7 +503,7 @@ The first child module selects the correct NixOS AMI to use:

```hcl
module "ami" {
source = "github.com/Gabriella439/terraform-nixos-ng//ami?ref=d8563d06cc65bc699ffbf1ab8d692b1343ecd927"
source = "github.com/Gabriella439/terraform-nixos-ng//ami?ref=af1a0af57287851f957be2b524fcdc008a21d9ae"
release = "23.05"
region = var.region
system = "x86_64-linux"
Expand All @@ -514,7 +514,7 @@ module "ami" {

```hcl
module "nixos" {
source = "github.com/Gabriella439/terraform-nixos-ng//nixos?ref=d8563d06cc65bc699ffbf1ab8d692b1343ecd927"
source = "github.com/Gabriella439/terraform-nixos-ng//nixos?ref=af1a0af57287851f957be2b524fcdc008a21d9ae"
host = "root@${aws_instance.todo.public_ip}"
Expand Down
4 changes: 2 additions & 2 deletions templates/continuous-deployment/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ resource "aws_key_pair" "nixos-in-production" {
}

module "ami" {
source = "github.com/Gabriella439/terraform-nixos-ng//ami?ref=06d207ebc1c3de68d1bc52129d0fa23d61de5525"
source = "github.com/Gabriella439/terraform-nixos-ng//ami?ref=af1a0af57287851f957be2b524fcdc008a21d9ae"
release = "23.05"
region = var.region
system = "x86_64-linux"
Expand Down Expand Up @@ -117,7 +117,7 @@ resource "null_resource" "wait" {
}

module "nixos" {
source = "github.com/Gabriella439/terraform-nixos-ng//nixos?ref=06d207ebc1c3de68d1bc52129d0fa23d61de5525"
source = "github.com/Gabriella439/terraform-nixos-ng//nixos?ref=af1a0af57287851f957be2b524fcdc008a21d9ae"
host = "root@${aws_instance.todo.public_ip}"
flake = ".#default"
arguments = [ "--build-host", "root@${aws_instance.todo.public_ip}" ]
Expand Down
4 changes: 2 additions & 2 deletions templates/terraform/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ resource "aws_key_pair" "nixos-in-production" {
}

module "ami" {
source = "github.com/Gabriella439/terraform-nixos-ng//ami?ref=06d207ebc1c3de68d1bc52129d0fa23d61de5525"
source = "github.com/Gabriella439/terraform-nixos-ng//ami?ref=af1a0af57287851f957be2b524fcdc008a21d9ae"
release = "23.05"
region = var.region
system = "x86_64-linux"
Expand Down Expand Up @@ -117,7 +117,7 @@ resource "null_resource" "wait" {
}

module "nixos" {
source = "github.com/Gabriella439/terraform-nixos-ng//nixos?ref=06d207ebc1c3de68d1bc52129d0fa23d61de5525"
source = "github.com/Gabriella439/terraform-nixos-ng//nixos?ref=af1a0af57287851f957be2b524fcdc008a21d9ae"
host = "root@${aws_instance.todo.public_ip}"
flake = ".#default"
arguments = [ "--build-host", "root@${aws_instance.todo.public_ip}" ]
Expand Down

0 comments on commit e6cfbe6

Please sign in to comment.