Ability to import project ci variable with project path

Created by: olhado

Feature Description

Currently you need the project id in order to define its CI variables.

I have created a module that takes a complex variable that defines a project and it's integrations and and CI variables. The goal being that my org's defaults are set, simplifying using terraform for gitlab config by end users. In this use case, I use a for_each over the variable and try and map the project id (defined in the module with a project resource) to the project CI variables definitions.

Of course, terraform errors out, rightfully so, complaining that since terraform won't know if the project exists, it can't create the local for_each variables to iterate over the CI variable definitions. This particularly affects CI pipelines trying to plan the terraform definitions.

If I were able to use the path + name, this would allow me to avoid an error on plan. It might still fail on apply, if the project failed to be created, but fixing a project definition is easier to do.

Do you want to implement this?

  • I would like to implement this myself 👷
Edited by Timo Furrer