Hi ,
I am using the gitlab official terraform module to create a gitlab repository from a gitlab group level template project. In the same code I am also using a gitlab file data search.
resource “gitlab_project” “dummy_product_projects” {
name = “test”
default_branch = “master”
description = “test”
namespace_id = data.gitlab_group.foo.group_id
visibility_level = “private”
use_custom_template = true
template_project_id = data.gitlab_project.example.id
group_with_project_templates_id = data.gitlab_group.template_subgroup.id
}
data “gitlab_repository_file” “test” {
project = gitlab_project.dummy_product_projects.id
ref = “master”
file_path = “test.yaml”
}
Then within local I am trying to read the content of the file test.yaml
content = try(yamldecode(base64decode(data.gitlab_repository_file.test.content)), {})
Then I am trying to create other resources based on what input has been provided in the yaml file; i.e the via the local variable. My understanding is initially the test.yaml would have the content what is there in the gitlab template.
But while running terraform , I am getting the following errors
local.content.values will be known only after apply
│
│ The “for_each” map includes keys derived from resource attributes that cannot be determined until apply, and so Terraform cannot determine the full set of
│ keys that will identify the instances of this resource.
I am assuming when I am running this for the first time , the gitlab repo does not exist so the terraform cant determine the local values.
Is there any way we can get rid of this situation ?