Design Pattern to Pull Files From an Enterprise Git Server

We have a Terraform module that populates various Parameter Store parameters with JSON data. Presently this module utilizes fileset and a local_file data source to pull the JSON data from files in a local directory and dynamically populate N parameters based on the number of files.

We’d like to store the JSON files in GitLab. Is there a way to have Terraform pull the files from GitLab?

Anyone have any ideas on this?

Thank you.

Hi @Kimmel ,

Assuming you mean that the files will be inside a Git repository hosted in GitLab, my first thought here was to look for a provider for GitLab, and indeed it seems there is gitlabhq/gitlab which seems relevant.

I see that this provider has a gitlab_repository_file data source which can retrieve the content of one particular file from a repository, which could replace your use of local_file.

I don’t see any data source that would be analogous to your use of fileset to query a set of available files, but perhaps you could replace that by an explicit manifest of the relevant files stored in the repository and then first retrieve the top-level manifest file in order to find the other files it refers to.

Alternatively, you may be able to open a feature request with the maintainers of that provider to see if there’s a way to map to an API provided by GitLab to enumerate files in a particular subtree in GitLab.

@apparentlymart ,

Thank you for the reply.