Skip to content

Commit

Permalink
more jq abuse
Browse files Browse the repository at this point in the history
  • Loading branch information
AmineChikhaoui committed Jun 2, 2023
1 parent f620330 commit e75d7a5
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
12 changes: 12 additions & 0 deletions amis/generate-nixpkgs-update
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#! /usr/bin/env bash

version="$1"

echo "append the following to nixpkgs: nixos/modules/virtualisation/amazon-ec2-amis.nix"
echo "make sure to update latest attribute to point to $version !"
echo

terraform output -json \
| jq \
--arg version "$version" \
'.[]|.value|"\"\($version)\".\(.region).\(.arch).hvm-ebs = \(.id);"' -r
3 changes: 2 additions & 1 deletion amis/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ resource "aws_ami" "nixos_ami" {
}

lifecycle {
ignore_changes = [ deprecation_time ]
ignore_changes = [deprecation_time]
}
}

Expand All @@ -102,6 +102,7 @@ resource "aws_ami_launch_permission" "public_access" {
output "ami" {
value = {
region = var.aws_region
arch = local.image_system
id = aws_ami.nixos_ami.id
}
}
1 change: 1 addition & 0 deletions amis/regions.jq
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"ami_\(.)": {
"value": {
"id": "${aws_ami_copy.copy_\(.).id}",
"arch": "${local.image_system}",
"region": .
}
}
Expand Down

0 comments on commit e75d7a5

Please sign in to comment.