atmos icon indicating copy to clipboard operation
atmos copied to clipboard

HTTP Backend support for `terraform.state`

Open mss opened this issue 7 months ago • 2 comments

Describe the Feature

The terraform.state feature introduced with v1.183 sounds like an interesting feature which could eliminate some of our performance issues with terraform.output.

Since we use the HTTP (GitLab) backend we can't use it though. It would be nice if support for the HTTP backend was considered as well.

Expected Behavior

Read https://atmos.tools/core-concepts/stacks/yaml-functions/terraform.state/ and hoped that the http backend was listed as a potential future (or even current) backend type.

Use Case

Replace terraform.output with terraform.state.

Describe Ideal Solution

This works out of the box:

terraform:
  backend_type: http
  backend:
    http:
      address: 'https://gitlab.example.com/api/v4/projects/42/terraform/state/{{ .stack }}-{{ regexp.Replace "/" "_" .atmos_component }}'
      lock_address: 'https://gitlab.example.com/api/v4/projects/42/terraform/state/{{ .stack }}-{{ regexp.Replace "/" "_" .atmos_component }}/lock'
      unlock_address: 'https://gitlab.example.com/api/v4/projects/42/terraform/state/{{ .stack }}-{{ regexp.Replace "/" "_" .atmos_component }}/lock'
      lock_method: 'POST'
      unlock_method: 'DELETE'
      retry_wait_min: '3'
      username: atmos
      password: !env GITLAB_TOKEN

Alternatives Considered

No response

Additional Context

No response

mss avatar Jul 29 '25 09:07 mss

@mss we likely will not be able to this anytime soon, but we'll promptly review any PRs adding support for http. We designed the implementation to be easy to implement for other backend types.

osterman avatar Jul 29 '25 09:07 osterman

@osterman thanks for the quick reply, I didn't expect it to be acted upon quickly, just wanted to note our interest. Maybe we'll find time to implement it, since @astephanh did some HTTP backend related fixes already he might be familiar with the code in question.

mss avatar Jul 29 '25 09:07 mss