Skip to content

Commit 023c127

Browse files
committed
make tests pass when credentials file is missing
1 parent f49e42d commit 023c127

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

ec2/main.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ locals {
6363
dynamodb_table_name = "${var.cluster_name}-state"
6464
bastion_sg_name = "${var.cluster_name}-bastion-sg"
6565

66-
unison_credentials = jsondecode(file("~/.local/share/unisonlanguage/credentials.json"))
66+
unison_credentials_file = "~/.local/share/unisonlanguage/credentials.json"
67+
unison_credentials = jsondecode(fileexists(local.unison_credentials_file) ? file(local.unison_credentials_file) : file("/dev/null"))
6768
unison_token = local.unison_credentials.credentials.default["api.unison-lang.org"].tokens.access_token
6869
}
6970

eks/main.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ locals {
3333
eks_cluster_name = "${var.cluster_name}"
3434
dynamodb_table_name = "${var.cluster_name}-state"
3535

36-
unison_credentials = jsondecode(file("~/.local/share/unisonlanguage/credentials.json"))
36+
unison_credentials_file = "~/.local/share/unisonlanguage/credentials.json"
37+
unison_credentials = jsondecode(fileexists(local.unison_credentials_file) ? file(local.unison_credentials_file) : file("/dev/null"))
3738
unison_token = local.unison_credentials.credentials.default["api.unison-lang.org"].tokens.access_token
3839
}
3940

0 commit comments

Comments
 (0)