Merge pull request 'fix: create terraform workspaces automatically in shared actions' (!44) from fix/terraform-workspace-or-create into main

Reviewed-on: #44
Reviewed-by: Böhringer_Sebastian_-_J._Schmalz_GmbH <Sebastian.Boehringer@schmalz.de>
This commit is contained in:
Böhringer_Sebastian_-_J._Schmalz_GmbH 2026-06-15 06:46:11 +00:00
commit 463f657b4a
Signed by: schmalz-git.git.onstackit.cloud
GPG key ID: 569DFBE669A0D544
2 changed files with 10 additions and 1 deletions

View file

@ -61,7 +61,7 @@ runs:
TF_DIR: ${{ inputs.terraform-dir }}
TF_WORKSPACE_NAME: ${{ inputs.workspace }}
run: |
terraform -chdir="$TF_DIR" workspace select "$TF_WORKSPACE_NAME"
terraform -chdir="$TF_DIR" workspace select -or-create "$TF_WORKSPACE_NAME"
- name: Terraform Apply
shell: bash

View file

@ -69,6 +69,15 @@ runs:
TF_TOKEN_schmalz_jfrog_io: ${{ inputs.jfrog-token }}
run: terraform -chdir=${{ env.TF_DIR }} init -backend=false -no-color
- name: Terraform Select Workspace
if: ${{ inputs.workspace != '' }}
shell: bash
env:
TF_DIR: ${{ inputs.terraform-dir }}
TF_WORKSPACE_NAME: ${{ inputs.workspace }}
run: |
terraform -chdir="$TF_DIR" workspace select -or-create "$TF_WORKSPACE_NAME"
- name: Terraform Format Check
shell: bash
env: