Multiple terraform reports by a single GitLab CI job

Viewed 526

Has anyone tried uploading terraform reports artifacts generated by a single job that have multiple plan outputs?

Example:

terraform:plan:
  image: my-tf-container
  stage: terraform
  tags: [docker]
  script:
    - |
      echo -e '{
                 "create": 0,
                 "update": 2,
                 "delete": 0
               }' > ./plan-summary-0.json
    - |
      echo -e '{
                       "create": 1,
                       "update": 2,
                       "delete": 4
                     }' > ./plan-summary-1.json
  artifacts:
    reports:
      terraform:
      - "./plan-summary-0.json"
      - "./plan-summary-1.json"

In the pipeline logs, I'm getting the following error:

Uploading artifacts...
./plan-summary-0.json: found 1 matching files and directories 
./plan-summary-1.json: found 1 matching files and directories 
WARNING: Uploading artifacts as "terraform" to coordinator... failed  id=164225 responseStatus=500 Internal Server Error status=500 token=******
WARNING: Retrying...                                context=artifacts-uploader error=invalid argument
WARNING: Uploading artifacts as "terraform" to coordinator... failed  id=164225 responseStatus=500 Internal Server Error status=500 token=*****
WARNING: Retrying...                                context=artifacts-uploader error=invalid argument
WARNING: Uploading artifacts as "terraform" to coordinator... failed  id=164225 responseStatus=500 Internal Server Error status=500 token=*****
FATAL: invalid argument                            
Cleaning up file based variables
00:01 ERROR: Job failed: exit code 1

1 Answers
Related