terranix: init #14

Merged
raito merged 1 commit from terranix-init into main 2024-07-04 11:42:21 +00:00
Owner

Adds simple nix run .#apply & nix run .#destroy which renders the
configuration file and let Terraform drive it.

Signed-off-by: Raito Bezarius masterancpp@gmail.com

Adds simple `nix run .#apply` & `nix run .#destroy` which renders the configuration file and let Terraform drive it. Signed-off-by: Raito Bezarius <masterancpp@gmail.com>
raito added 1 commit 2024-07-02 09:10:19 +00:00
Adds simple `nix run .#apply` & `nix run .#destroy` which renders the
configuration file and let Terraform drive it.

Signed-off-by: Raito Bezarius <masterancpp@gmail.com>
lheckemann reviewed 2024-07-02 09:13:42 +00:00
flake.nix Outdated
@ -20,0 +39,4 @@
apply = {
type = "app";
program = toString (pkgs.writers.writeBash "apply" ''
if [[ -e config.tf.json ]]; then rm -f config.tf.json; fi
Collaborator

rm -f ignores failure anyway, so you don't need to check if it exists.

`rm -f` ignores failure anyway, so you don't need to check if it exists.
raito marked this conversation as resolved
flake.nix Outdated
@ -20,0 +40,4 @@
type = "app";
program = toString (pkgs.writers.writeBash "apply" ''
if [[ -e config.tf.json ]]; then rm -f config.tf.json; fi
cp ${terraformCfg} config.tf.json \
Collaborator

We could also ln -snf, then we don't even have to remove it first?

We could also `ln -snf`, then we don't even have to remove it first?
raito marked this conversation as resolved
flake.nix Outdated
@ -20,0 +41,4 @@
program = toString (pkgs.writers.writeBash "apply" ''
if [[ -e config.tf.json ]]; then rm -f config.tf.json; fi
cp ${terraformCfg} config.tf.json \
&& ${lib.getExe terraform} init \
Collaborator

set -eo pipefail rather than chaining &&?

`set -eo pipefail` rather than chaining `&&`?
raito marked this conversation as resolved
flake.nix Outdated
@ -20,0 +45,4 @@
&& ${lib.getExe terraform} apply
'');
};
# nix run ".#destroy"
Collaborator

Is this something we anticipate doing regularly? oO

Is this something we anticipate doing regularly? oO
Author
Owner

I just did it out of symmetry.

I just did it out of symmetry.
raito marked this conversation as resolved
Author
Owner

@lheckemann Can I let you implement your changes directly?

@lheckemann Can I let you implement your changes directly?
raito force-pushed terranix-init from 28b4492214 to e422da8f83 2024-07-04 11:42:07 +00:00 Compare
raito merged commit 0a747f2f3a into main 2024-07-04 11:42:21 +00:00
raito deleted branch terranix-init 2024-07-04 11:42:21 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: delroth/bagel-infra#14
No description provided.