Is there an API call anyone knows of to get the list of Gitlab managed terraform states in my project?
For example, something like
curl --header “Private-Token: $GITLAB_API_TOKEN” --request GET “https://my.doman.com/api/v4/projects/[project id]/terraform/state/list”
The specific use is I’m trying to check in my pipeline if the current branch name is in the list of the terraform states.
The actual use is I’m trying to switch between using Gitlab managed terraform state when it’s enabled in my branch (by checking that there is a Gitlab terraform state in the repo of the same branch name) and TFE managed terraform state when the branch is main. This is all to create independent state files whose resources aren’t destroyed by running divergent branches.
Thanks!