Using text file contents as value for json key

I have a basic example like so:

data "local_file" "input" {
  filename = "${path.module}/test.txt"
}


output "test"{
    value = jsonencode({
    "name": "GITLAB_OMNIBUS_CONFIG",
    "value": data.local_file.input.content
})
}

test.txt contains the following:

external_url 'https://gitlab.company.com'
gitlab_rails['time_zone'] = 'UTC'
gitlab_rails['object_store']['enabled'] = true
gitlab_rails['object_store']['proxy_download'] = false
gitlab_rails['object_store']['connection'] = {
                'provider' => 'AWS',
    'region' => 'eu-west-2',
    'use_iam_profile' => true
}

I am trying to replace the value in jsonencode with what is in the text file. Is this behaviour possible?

Hi @fraserc182,

The example you shared seems like it should already do what you described, but I’m possibly misunderstanding what your goal is.

Can you share what happened when you applied this configuration, and how that differed from what you intended?