I’m trying to do something that I thought would be very simple but it seems it is not. I want to run terraform fmt --check
on my terraform code using Docker Hub
If I run it locally its fine:
docker run hashicorp/terraform:light fmt --check
However I’m trying to get this to run as a github action. I’ve tried this:
terraform-fmt-check:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
container:
image: hashicorp/terraform:light
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: terraform fmt check
run: fmt --check path/to/terraform/config
which fails with:
OCI runtime exec failed: exec failed: container_linux.go:367: starting container process caused: exec: “bash”: executable file not found in $PATH: unknown
Also tried this:
terraform-fmt-check:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
container:
image: hashicorp/terraform:light
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: terraform fmt check
run: terraform fmt --check path/to/terraform/config
which fails with the same error:
I know the command I’m trying to run is available in the container because I can run it locally. What’s the correct way to run a command inside a container?