Terraform fails without any error message

Viewed 1283

I am trying to execute Terraform commands from GitLab but I am unable to execute this successfully.

Following are the contents of my .gitlab-ci.yml file:

plan:k8stest:
  image: 
    name: hashicorp/terraform:latest
  stage: plan
  environment:
    name: k8s-test
  before_script:
    - terraform version
  script:
    - cd ${TF_ROOT}
    - terraform fmt -check -recursive
    - terraform init
    - terraform validate
    - terraform plan

It executes 'terraform fmt' command but after that it bails out without any error message

Executing "step_script" stage of the job script
00:01
$ terraform version
Terraform v1.0.2
on linux_amd64
$ cd ${TF_ROOT}
$ terraform fmt -check -recursive
backend.tf
service.tf
terraform.tfvars
Uploading artifacts for failed job
00:01
Uploading artifacts...
WARNING: /builds/SathishKumar/ultestdevops/terraform/plan.json: no matching files 
ERROR: No files to upload

Kindly let me know what am I doing wrong and why terraform init was not executed.

1 Answers
Related