Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gitlab-ci: Terraform has no command named "sh". Did you mean "show"

I'm trying to set up Terrafom validation on Gitlab CI.
However a build fails with an error: "Terraform has no command named "sh". Did you mean "show"?"

Why does it happen? How could it be fixed?

My .gitlab-ci.yml

image: hashicorp/terraform:light

before_script:
  - terraform init

validate:
  script:
    - terraform validate
like image 924
AlexElin Avatar asked Dec 13 '25 18:12

AlexElin


1 Answers

You need to override the entrypoint in the terraform image so you have access to the shell.

image: 
  name: hashicorp/terraform:light
  entrypoint: [""]

before_script:
  - terraform init

validate:
  script:
    - terraform validate

You can also take a look at the official gitlab documentation how to integrate terraform with gitlab, as the have a template for that.

like image 184
danielnelz Avatar answered Dec 16 '25 19:12

danielnelz