Skip to content

Commit 9be2c98

Browse files
committed
VED-812: Improve Terraform workspace Makefile commands.
1 parent 190af29 commit 9be2c98

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

infra/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ lock-provider:
1414
$(tf_cmd) providers lock -platform=darwin_arm64 -platform=darwin_amd64 -platform=linux_amd64 -platform=windows_amd64
1515

1616
workspace:
17-
$(tf_cmd) workspace new $(ENVIRONMENT) || $(tf_cmd) workspace select $(ENVIRONMENT) && echo "Switched to workspace/environment: $(ENVIRONMENT)"
17+
$(tf_cmd) workspace select -or-create $(ENVIRONMENT) && echo "Switched to workspace/environment: $(ENVIRONMENT)"
1818

1919
init:
2020
$(tf_cmd) init $(tf_state) -upgrade $(tf_vars)

mesh_infra/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ lock-provider:
1414
$(tf_cmd) providers lock -platform=darwin_arm64 -platform=darwin_amd64 -platform=linux_amd64 -platform=windows_amd64
1515

1616
workspace:
17-
$(tf_cmd) workspace new $(ENVIRONMENT) || $(tf_cmd) workspace select $(ENVIRONMENT) && echo "Switched to workspace/environment: $(ENVIRONMENT)"
17+
$(tf_cmd) workspace select -or-create $(ENVIRONMENT) && echo "Switched to workspace/environment: $(ENVIRONMENT)"
1818

1919
init:
2020
$(tf_cmd) init $(tf_state) -upgrade $(tf_vars)
@@ -42,7 +42,7 @@ ifndef name
4242
endif
4343
$(tf_cmd) output -raw $(name)
4444

45-
import:
45+
import:
4646
$(tf_cmd) import $(tf_vars) $(to) $(id)
4747

4848
tf-%:

terraform/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ lock-provider:
2121
$(tf_cmd) providers lock -platform=darwin_arm64 -platform=darwin_amd64 -platform=linux_amd64 -platform=windows_amd64
2222

2323
workspace:
24-
$(tf_cmd) workspace new $(sub_environment) || $(tf_cmd) workspace select $(sub_environment) && echo "Switched to workspace/environment: $(sub_environment)"
24+
$(tf_cmd) workspace select -or-create $(sub_environment) && echo "Switched to workspace/environment: $(sub_environment)"
2525

2626
init:
2727
$(tf_cmd) init $(tf_state) -upgrade $(tf_vars)

terraform_aws_backup/aws-backup-destination/Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ lock-provider:
2020
$(tf_cmd) providers lock -platform=darwin_arm64 -platform=darwin_amd64 -platform=linux_amd64 -platform=windows_amd64
2121

2222
workspace:
23-
$(tf_cmd) workspace new $(environment) || $(tf_cmd) workspace select $(environment) && echo "Switched to workspace/environment: $(environment)"
23+
$(tf_cmd) workspace select -or-create $(environment) && echo "Switched to workspace/environment: $(environment)"
2424

2525
init:
26-
$(tf_cmd) init $(tf_state) -upgrade
26+
$(tf_cmd) init $(tf_state) -upgrade
2727

2828
plan: workspace
29-
$(tf_cmd) plan
29+
$(tf_cmd) plan
3030

3131
plan-changes: workspace
3232
$(tf_cmd) plan -out=plan && $(tf_cmd) show -no-color -json plan | jq -r '.resource_changes[] | select(.change.actions[0]=="update" or .change.actions[0]=="create" or .change.actions[0]=="add") | .address'

terraform_aws_backup/aws-backup-source/Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ lock-provider:
2020
$(tf_cmd) providers lock -platform=darwin_arm64 -platform=darwin_amd64 -platform=linux_amd64 -platform=windows_amd64
2121

2222
workspace:
23-
$(tf_cmd) workspace new $(environment) || $(tf_cmd) workspace select $(environment) && echo "Switched to workspace/environment: $(environment)"
23+
$(tf_cmd) workspace select -or-create $(environment) && echo "Switched to workspace/environment: $(environment)"
2424

2525
init:
26-
$(tf_cmd) init $(tf_state) -upgrade
26+
$(tf_cmd) init $(tf_state) -upgrade
2727

2828
plan: workspace
29-
$(tf_cmd) plan
29+
$(tf_cmd) plan
3030

3131
plan-changes: workspace
3232
$(tf_cmd) plan -out=plan && $(tf_cmd) show -no-color -json plan | jq -r '.resource_changes[] | select(.change.actions[0]=="update" or .change.actions[0]=="create" or .change.actions[0]=="add") | .address'

0 commit comments

Comments
 (0)