When I run terraform commands from my local machine the stdout and stderr of the process streams into my terminal as it runs.
When I run the exact same commands against the exact same terraform template in a Github Action, the stdout and stderr will not be displayed until the very end of the command where it will dump all of it suddenly.
This is very frustrating as it can take a very long time to run sometimes and we have a particular issue where it appears that one of the steps can actually get hung but I can't tell which since the output is not streaming, and if you cancel the github action, github will eat all subsequent output, so there is no way to see what is hanging.
How can I get terraform to stream all of its output like it does locally while running inside of a github action?
Here is the test I just completed:
name: 'Terraform'
on:
push:
branches:
- master
pull_request:
jobs:
terraform:
name: 'Terraform'
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup Terraform
uses: hashicorp/setup-terraform@v1
- name: Terraform Version
run: terraform version -json
- name: Terraform Init
run: |
cd TerraForm/time_sleep/
terraform init
- name: Terraform Apply
run: |
cd TerraForm/time_sleep/
terraform apply -auto-approve
in the terraform side I'm mostly doing time_sleep:
resource "time_sleep" "wait" {
count = 15
create_duration = "${count.index + 1}s"
}
The full code is here:
https://github.com/heldersepu/hs-scripts/tree/master/TerraForm/time_sleep