boilerplate icon indicating copy to clipboard operation
boilerplate copied to clipboard

Execution fail with map containing boolean

Open Dudesons opened this issue 10 months ago • 3 comments

Describe the bug

I'm trying to create a template with the possibility to toggle some folders, where each folder have a map which contains all required informations.

the boilerplate.yml file looks like that:

variables:
  - name: project

  - name: serviceA
    type: map
    default:
      length: 8

  - name: serviceB
    type: map
    default:
      length: 56

  - name: serviceC
    type: map
    default:
      enabled: true
      length: 56

skip_files:
  - path: serviceC
    if: {{ not .serviceC.enabled }}

the answer file is:

project: eustaging
serviceA:
  length: 79
serviceC:
  enabled: false
  length: 789

Then when I'm running this command: boilerplate --template-url platform --output-folder dev/eu/ --var-file dev/eu/eustaging-boilerplate.yml I have this error:

[boilerplate] 2024/03/25 07:42:50 Loading boilerplate config from platform/boilerplate.yml                                                     
ERROR: yaml: invalid map key: map[interface {}]interface {}{".serviceC.enabled":interface {}(nil)}   

I also tried to switch to a map which contains all my toggles, but I have the same error.

variables:
  - name: project

  - name: serviceA
    type: map
    default:
      length: 8

  - name: serviceB
    type: map
    default:
      length: 56

  - name: serviceC
    type: map
    default:
      length: 56

  - name: toggles
    type: map
    default:
      serviceC: true

skip_files:
  - path: serviceC
    if: {{ not .toggles.serviceC }}

To Reproduce Steps to reproduce the behavior including the relevant Terraform/Terragrunt/Packer version number and any code snippets and module inputs you used.

version: boilerplate version v0.5.12

Expected behavior I'm expecting the execution could work when I want or not a directory according to the var file when this one has a bool in a map containing informations about the service or in a toggle map

Dudesons avatar Mar 25 '24 08:03 Dudesons