Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't use Terraform output on Windows runner #383

Open
ZsoltPath opened this issue Dec 6, 2023 · 0 comments
Open

Can't use Terraform output on Windows runner #383

ZsoltPath opened this issue Dec 6, 2023 · 0 comments

Comments

@ZsoltPath
Copy link

I'm trying to use terraform output on a Windows GitHub runner.

The worklfow look like this:

      - name: Install Terraform
        uses: hashicorp/setup-terraform@v3
        with:
          terraform_version: 1.5.2
          terraform_wrapper: true
      - name: Terraform Init
        run: terraform init
      - name: Terraform Select Workspace dev
        run: terraform workspace select dev
      - name: Terraform Output
        id: terraform-crm-event-log
        run: terraform output -json
      - name: Parse Terraform output
        run: |
          $json = "${{ steps.terraform-pricing-engine.outputs.stdout }}"
          $output = $json | ConvertFrom-Json
          ....

I have tried with both terraform_wrapper = true or false.
In case of true I can't even see the outputs.

2023-12-06T16:40:47.3592374Z ##[group]Run hashicorp/setup-terraform@v3
2023-12-06T16:40:47.3593026Z with:
2023-12-06T16:40:47.3593369Z   terraform_version: 1.5.2
2023-12-06T16:40:47.3593818Z   terraform_wrapper: true
2023-12-06T16:40:47.3594335Z   cli_config_credentials_hostname: app.terraform.io
2023-12-06T16:40:47.3594900Z env:
2023-12-06T16:40:47.3595813Z   AWS_ACCESS_KEY_ID: ***
2023-12-06T16:40:47.3596251Z   AWS_DEFAULT_REGION: eu-west-2
2023-12-06T16:40:47.3596944Z   AWS_SECRET_ACCESS_KEY: ***
2023-12-06T16:40:47.3597854Z   AUTH_ENDPOINT: https://login.microsoftonline.com/3c736e26-e6d2-4f82-9710-e23949b7af7d/oauth2/v2.0/token
2023-12-06T16:40:47.3598824Z   ASSEMBLY_PATH: \bin\Release
2023-12-06T16:40:47.3599283Z   ISOLATION_MODE: 2
2023-12-06T16:40:47.3599638Z ##[endgroup]
2023-12-06T16:40:48.6182572Z [command]"C:\Program Files\PowerShell\7\pwsh.exe" -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command "$ErrorActionPreference = 'Stop' ; try { Add-Type -AssemblyName System.IO.Compression.ZipFile } catch { } ; try { [System.IO.Compression.ZipFile]::ExtractToDirectory('D:\a\_temp\352c7a39-fab4-4b90-a86d-3e050b5fcead.zip', 'D:\a\_temp\ff131bfd-394b-4115-9807-e0419b42aab5', $true) } catch { if (($_.Exception.GetType().FullName -eq 'System.Management.Automation.MethodException') -or ($_.Exception.GetType().FullName -eq 'System.Management.Automation.RuntimeException') ){ Expand-Archive -LiteralPath 'D:\a\_temp\352c7a39-fab4-4b90-a86d-3e050b5fcead.zip' -DestinationPath 'D:\a\_temp\ff131bfd-394b-4115-9807-e0419b42aab5' -Force } else { throw $_ } } ;"
2023-12-06T16:40:49.5063887Z ##[group]Run terraform init
2023-12-06T16:40:49.5064637Z terraform init
2023-12-06T16:40:49.5145161Z shell: C:\Program Files\PowerShell\7\pwsh.EXE -command ". '{0}'"
2023-12-06T16:40:49.5145894Z env:
2023-12-06T16:40:49.5146425Z   AWS_ACCESS_KEY_ID: ***
2023-12-06T16:40:49.5146871Z   AWS_DEFAULT_REGION: eu-west-2
2023-12-06T16:40:49.5147580Z   AWS_SECRET_ACCESS_KEY: ***
2023-12-06T16:40:49.5148518Z   AUTH_ENDPOINT: https://login.microsoftonline.com/3c736e26-e6d2-4f82-9710-e23949b7af7d/oauth2/v2.0/token
2023-12-06T16:40:49.5149493Z   ASSEMBLY_PATH: \bin\Release
2023-12-06T16:40:49.5149935Z   ISOLATION_MODE: 2
2023-12-06T16:40:49.5150525Z   TERRAFORM_CLI_PATH: D:\a\_temp\ff131bfd-394b-4115-9807-e0419b42aab5
2023-12-06T16:40:49.5151230Z ##[endgroup]
2023-12-06T16:40:50.6537395Z ##[group]Run terraform workspace select dev
2023-12-06T16:40:50.6538170Z terraform workspace select dev
2023-12-06T16:40:50.6580528Z shell: C:\Program Files\PowerShell\7\pwsh.EXE -command ". '{0}'"
2023-12-06T16:40:50.6581217Z env:
2023-12-06T16:40:50.6581728Z   AWS_ACCESS_KEY_ID: ***
2023-12-06T16:40:50.6582201Z   AWS_DEFAULT_REGION: eu-west-2
2023-12-06T16:40:50.6582891Z   AWS_SECRET_ACCESS_KEY: ***
2023-12-06T16:40:50.6583800Z   AUTH_ENDPOINT: https://login.microsoftonline.com/3c736e26-e6d2-4f82-9710-e23949b7af7d/oauth2/v2.0/token
2023-12-06T16:40:50.6584764Z   ASSEMBLY_PATH: \bin\Release
2023-12-06T16:40:50.6585205Z   ISOLATION_MODE: 2
2023-12-06T16:40:50.6585797Z   TERRAFORM_CLI_PATH: D:\a\_temp\ff131bfd-394b-4115-9807-e0419b42aab5
2023-12-06T16:40:50.6586565Z ##[endgroup]
2023-12-06T16:40:51.2037528Z ##[group]Run terraform output -json
2023-12-06T16:40:51.2038189Z terraform output -json
2023-12-06T16:40:51.2079182Z shell: C:\Program Files\PowerShell\7\pwsh.EXE -command ". '{0}'"
2023-12-06T16:40:51.2079889Z env:
2023-12-06T16:40:51.2080388Z   AWS_ACCESS_KEY_ID: ***
2023-12-06T16:40:51.2080835Z   AWS_DEFAULT_REGION: eu-west-2
2023-12-06T16:40:51.2081533Z   AWS_SECRET_ACCESS_KEY: ***
2023-12-06T16:40:51.2082436Z   AUTH_ENDPOINT: https://login.microsoftonline.com/3c736e26-e6d2-4f82-9710-e23949b7af7d/oauth2/v2.0/token
2023-12-06T16:40:51.2083647Z   ASSEMBLY_PATH: \bin\Release
2023-12-06T16:40:51.2084093Z   ISOLATION_MODE: 2
2023-12-06T16:40:51.2084689Z   TERRAFORM_CLI_PATH: D:\a\_temp\ff131bfd-394b-4115-9807-e0419b42aab5
2023-12-06T16:40:51.2085376Z ##[endgroup]

In case of false, I can see the output in the log, but still can't use in the subsequent step

2023-12-06T16:02:09.7512585Z ##[group]Run hashicorp/setup-terraform@v3
2023-12-06T16:02:09.7513262Z with:
2023-12-06T16:02:09.7513613Z   terraform_version: 1.5.2
2023-12-06T16:02:09.7514081Z   terraform_wrapper: false
2023-12-06T16:02:09.7514638Z   cli_config_credentials_hostname: app.terraform.io
2023-12-06T16:02:09.7515240Z env:
2023-12-06T16:02:09.7515945Z   AWS_ACCESS_KEY_ID: ***
2023-12-06T16:02:09.7516403Z   AWS_DEFAULT_REGION: eu-west-2
2023-12-06T16:02:09.7517152Z   AWS_SECRET_ACCESS_KEY: ***
2023-12-06T16:02:09.7518325Z   AUTH_ENDPOINT: https://login.microsoftonline.com/3c736e26-e6d2-4f82-9710-e23949b7af7d/oauth2/v2.0/token
2023-12-06T16:02:09.7519462Z   ASSEMBLY_PATH: \bin\Release
2023-12-06T16:02:09.7519981Z   ISOLATION_MODE: 2
2023-12-06T16:02:09.7520398Z ##[endgroup]
2023-12-06T16:02:11.2507990Z [command]"C:\Program Files\PowerShell\7\pwsh.exe" -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command "$ErrorActionPreference = 'Stop' ; try { Add-Type -AssemblyName System.IO.Compression.ZipFile } catch { } ; try { [System.IO.Compression.ZipFile]::ExtractToDirectory('D:\a\_temp\ba9a50f0-1139-4bee-8738-c0f4d8638c4e.zip', 'D:\a\_temp\b90be1dd-ec65-47e8-9b34-542fc13135d0', $true) } catch { if (($_.Exception.GetType().FullName -eq 'System.Management.Automation.MethodException') -or ($_.Exception.GetType().FullName -eq 'System.Management.Automation.RuntimeException') ){ Expand-Archive -LiteralPath 'D:\a\_temp\ba9a50f0-1139-4bee-8738-c0f4d8638c4e.zip' -DestinationPath 'D:\a\_temp\b90be1dd-ec65-47e8-9b34-542fc13135d0' -Force } else { throw $_ } } ;"
2023-12-06T16:02:12.3329453Z ##[group]Run terraform init
2023-12-06T16:02:12.3330239Z terraform init
2023-12-06T16:02:12.3406594Z shell: C:\Program Files\PowerShell\7\pwsh.EXE -command ". '{0}'"
2023-12-06T16:02:12.3407475Z env:
2023-12-06T16:02:12.3408064Z   AWS_ACCESS_KEY_ID: ***
2023-12-06T16:02:12.3408624Z   AWS_DEFAULT_REGION: eu-west-2
2023-12-06T16:02:12.3409482Z   AWS_SECRET_ACCESS_KEY: ***
2023-12-06T16:02:12.3410577Z   AUTH_ENDPOINT: https://login.microsoftonline.com/3c736e26-e6d2-4f82-9710-e23949b7af7d/oauth2/v2.0/token
2023-12-06T16:02:12.3411731Z   ASSEMBLY_PATH: \bin\Release
2023-12-06T16:02:12.3412302Z   ISOLATION_MODE: 2
2023-12-06T16:02:12.3412781Z ##[endgroup]
2023-12-06T16:02:12.9207410Z 
2023-12-06T16:02:12.9209000Z Initializing the backend...
2023-12-06T16:02:13.5011073Z 
2023-12-06T16:02:13.5012279Z Successfully configured the backend "s3"! Terraform will automatically
2023-12-06T16:02:13.5014552Z use this backend unless the backend configuration changes.
2023-12-06T16:02:14.7117142Z 
2023-12-06T16:02:14.7119205Z Initializing provider plugins...
2023-12-06T16:02:14.7122806Z 
2023-12-06T16:02:14.7127064Z Terraform has been successfully initialized!
2023-12-06T16:02:14.7129259Z 
2023-12-06T16:02:14.7130985Z You may now begin working with Terraform. Try running "terraform plan" to see
2023-12-06T16:02:14.7133866Z any changes that are required for your infrastructure. All Terraform commands
2023-12-06T16:02:14.7138421Z should now work.
2023-12-06T16:02:14.7140752Z 
2023-12-06T16:02:14.7143103Z If you ever set or change modules or backend configuration for Terraform,
2023-12-06T16:02:14.7147675Z rerun this command to reinitialize your working directory. If you forget, other
2023-12-06T16:02:14.7150548Z commands will detect it and remind you to do so if necessary.
2023-12-06T16:02:15.0549149Z ##[group]Run terraform workspace select dev
2023-12-06T16:02:15.0550148Z terraform workspace select dev
2023-12-06T16:02:15.0652200Z shell: C:\Program Files\PowerShell\7\pwsh.EXE -command ". '{0}'"
2023-12-06T16:02:15.0653322Z env:
2023-12-06T16:02:15.0653824Z   AWS_ACCESS_KEY_ID: ***
2023-12-06T16:02:15.0654309Z   AWS_DEFAULT_REGION: eu-west-2
2023-12-06T16:02:15.0655088Z   AWS_SECRET_ACCESS_KEY: ***
2023-12-06T16:02:15.0656148Z   AUTH_ENDPOINT: https://login.microsoftonline.com/3c736e26-e6d2-4f82-9710-e23949b7af7d/oauth2/v2.0/token
2023-12-06T16:02:15.0657301Z   ASSEMBLY_PATH: \bin\Release
2023-12-06T16:02:15.0657800Z   ISOLATION_MODE: 2
2023-12-06T16:02:15.0658204Z ##[endgroup]
2023-12-06T16:02:16.0449738Z Switched to workspace "dev".
2023-12-06T16:02:16.1868434Z ##[group]Run terraform output -json
2023-12-06T16:02:16.1869099Z terraform output -json
2023-12-06T16:02:16.1907469Z shell: C:\Program Files\PowerShell\7\pwsh.EXE -command ". '{0}'"
2023-12-06T16:02:16.1908132Z env:
2023-12-06T16:02:16.1908766Z   AWS_ACCESS_KEY_ID: ***
2023-12-06T16:02:16.1909248Z   AWS_DEFAULT_REGION: eu-west-2
2023-12-06T16:02:16.1910056Z   AWS_SECRET_ACCESS_KEY: ***
2023-12-06T16:02:16.1911095Z   AUTH_ENDPOINT: https://login.microsoftonline.com/3c736e26-e6d2-4f82-9710-e23949b7af7d/oauth2/v2.0/token
2023-12-06T16:02:16.1912175Z   ASSEMBLY_PATH: \bin\Release
2023-12-06T16:02:16.1912661Z   ISOLATION_MODE: 2
2023-12-06T16:02:16.1913066Z ##[endgroup]
2023-12-06T16:02:18.3396313Z {
2023-12-06T16:02:18.3409658Z   "app_service_name": {
2023-12-06T16:02:18.3410450Z     "sensitive": false,
2023-12-06T16:02:18.3411191Z     "type": "string",
2023-12-06T16:02:18.3412252Z     "value": "mentor-dev-crm-event-log"
2023-12-06T16:02:18.3413154Z   }
2023-12-06T16:02:18.3463363Z }
2023-12-06T16:02:25.3044570Z ##[group]Run $json = ""
2023-12-06T16:02:25.3045480Z $json = ""
2023-12-06T16:02:25.3046021Z $output = $json | ConvertFrom-Json
2023-12-06T16:02:25.3046671Z $output
2023-12-06T16:02:25.3106768Z shell: C:\Program Files\PowerShell\7\pwsh.EXE -command ". '{0}'"
2023-12-06T16:02:25.3107509Z env:
2023-12-06T16:02:25.3107996Z   AWS_ACCESS_KEY_ID: ***
2023-12-06T16:02:25.3108974Z   AWS_DEFAULT_REGION: eu-west-2
2023-12-06T16:02:25.3111255Z   AWS_SECRET_ACCESS_KEY: ***
2023-12-06T16:02:25.3113289Z   AUTH_ENDPOINT: https://login.microsoftonline.com/3c736e26-e6d2-4f82-9710-e23949b7af7d/oauth2/v2.0/token
2023-12-06T16:02:25.3115356Z   ASSEMBLY_PATH: \bin\Release
2023-12-06T16:02:25.3116876Z   ISOLATION_MODE: 2
2023-12-06T16:02:25.3118310Z ##[endgroup]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant