Skip to content

Commit 0ef9e87

Browse files
committed
tagging: cf resource updates; rm --yes from rain to allow change set inspection
1 parent 44ca98c commit 0ef9e87

File tree

4 files changed

+36
-7
lines changed

4 files changed

+36
-7
lines changed

Justfile

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,8 +284,17 @@ cardano-testnet isNg *ARGS:
284284
cf STACKNAME:
285285
#!/usr/bin/env nu
286286
mkdir cloudFormation
287+
let secretName = (nix eval --raw '.#cardano-parts.cluster.infra.generic.costCenter')
288+
let costCenter = (
289+
just sops-decrypt-binary secrets/tf/cluster.tfvars
290+
| lines
291+
| where { |it| $it =~ $secretName }
292+
| parse $"($secretName) = \"{secret}\""
293+
| get 0.secret
294+
| to text
295+
)
287296
nix eval --json '.#cloudFormation.{{STACKNAME}}' | from json | save --force 'cloudFormation/{{STACKNAME}}.json'
288-
rain deploy --debug --termination-protection --yes ./cloudFormation/{{STACKNAME}}.json
297+
rain deploy --debug --params costCenter=($costCenter) --termination-protection ./cloudFormation/{{STACKNAME}}.json
289298

290299
# Prep dbsync for delegation analysis
291300
dbsync-prep ENV HOST ACCTS="501":

flake/cloudFormation/terraformState.nix

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,45 @@ with lib; {
1212
Key = n;
1313
Value = v;
1414
}) {
15-
inherit (config.flake.cardano-parts.cluster.infra.generic) organization tribe function repo;
16-
environment = "generic";
15+
inherit
16+
(config.flake.cardano-parts.cluster.infra.generic)
17+
environment
18+
function
19+
organization
20+
owner
21+
project
22+
repo
23+
tribe
24+
;
1725
})
1826
++ [
1927
{
2028
Key = "Name";
2129
Value = name;
2230
}
31+
{
32+
Key = "costCenter";
33+
Value = {
34+
Ref = "costCenter";
35+
};
36+
}
2337
];
2438
in {
2539
AWSTemplateFormatVersion = "2010-09-09";
2640
Description = "Terraform state handling";
2741

42+
# The costCenter parameter will be passed to the configuration via a secrets file.
43+
# For details, see the just recipe: cf
44+
Parameters = {
45+
costCenter = {
46+
Type = "String";
47+
Description = "The costCenter tag";
48+
};
49+
};
50+
2851
# Resources here will be created in the AWS_REGION and AWS_PROFILE from your
2952
# environment variables.
3053
# Execute this using: `just cf terraformState`
31-
3254
Resources = {
3355
kmsKey = {
3456
Type = "AWS::KMS::Key";

flake/cluster.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ with flake.lib; {
3838
environment = "testnets";
3939
project = "cardano-playground";
4040

41-
# This is the tf var secrets name
41+
# This is the tf var secrets name located in secrets/tf/cluster.tfvars
4242
costCenter = "tag_costCenter";
4343

4444
# These options must remain true for the playground cluster as ip info is required

flake/colmena.nix

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
}: let
88
inherit (config.flake) nixosModules nixosConfigurations;
99
inherit (config.flake.cardano-parts.cluster.infra.aws) domain;
10-
11-
cfgGeneric = config.flake.cardano-parts.cluster.infra.generic;
1210
in
1311
with builtins;
1412
with lib; {

0 commit comments

Comments
 (0)