Question: how-to customize icons on terraform report in MR?

The terraform report in a merge request generates this kind of message in the merge-request :
image
but the icon is always the same !

Problem to solve

How can I change the icons that are generated, depending on the actual content of the report ?

For example, have a different icon when nothing is changed (:green_circle: ?), have a red warning when there are ressources destroyed (:red_circle: ) and orange when there are only changes (:orange_circle:) ?

Steps to reproduce

this was produced with the following convert_report running on the terraform plan output,

Configuration

extract :

.terraform:plan:
  stage: plan 
  script:
    - *terraform-ver-init
    - terraform plan -input=false -out=${PLAN} -lock=${CI_COMMIT_REF_PROTECTED}
    # not in before_script since would overide the auth. / https://gitlab.com/gitlab-org/gitlab/-/issues/258606
    # gitlab Merge-request integration
    - apk --no-cache add jq
    - alias convert_report="jq -r '([.resource_changes[]?.change.actions?]|flatten)|{\"create\":(map(select(.==\"create\"))|length),\"update\":(map(select(.==\"update\"))|length),\"delete\":(map(select(.==\"delete\"))|length)}'"
    - terraform show -json ${PLAN} | convert_report > ${PLAN_JSON}
    - cat ${PLAN_JSON}
  resource_group: ${TF_STATE_NAME}
  artifacts:
    # The next line, which disables public access to pipeline artifacts, may not be available everywhere.
    # See: https://docs.gitlab.com/ee/ci/yaml/#artifactspublic
    public: false
    paths:
      - ${PLAN}
    reports:
      terraform: ${PLAN_JSON}

Versions

Please select whether options apply, and add the version information.

  • Self-managed
  • GitLab.com SaaS
  • Self-hosted Runners