Skip to content

[Feature Request]: Mark terracurl_request.response as sensitive (or add response_sensitive toggle) #142

Description

@ludens11

Github handle

ludens11

Please describe the feature you would like added to TerraCurl.

I would like terracurl_request.response to be treated as sensitive so secret values returned by APIs are not printed in Terraform plan output or stored in clear text in state. This could be done by either:

  • Marking response as sensitive in the provider schema (default behavior), or
  • Adding an optional flag like response_sensitive = true (default false to preserve existing behavior), which would mark the response attribute as sensitive only when enabled.

This is specifically about the read-only response attribute produced by terracurl_request. The request/response behavior should remain unchanged; the only change is how Terraform displays and stores that field.

Please detail the use case for this feature request?

We use terracurl_request to create and update API keys. The API response includes sensitive values such as API keys and tokens and sometimes those values are embedded in error messages. Terraform plan output currently shows the full response, which leaks credentials into CI logs or PR reviews. Even with ignore_response_fields, the values are still present in plan and state; it only reduces drift detection. We need a way to avoid exposing secrets in plan/state while keeping the resource functional.

Please add any pseudo code to demonstrate how this feature would work

resource "terracurl_request" "create_api_key" {
  name    = "Create New API Key"
  url     = "https://example.com/path/to/generate/a/key"
  method  = "POST"
  headers = {
    Authorization = "Bearer xxx"
  }
  request_body = jsonencode({
    key_alias = "my-api-key"
  })

  response_codes = [200]

  # proposed option
  response_sensitive = true
}

Terraform plan output shows:

response = jsonencode({
  key   = "key-1234"
  token = "f71c6dfc..."
  error = {
    message = "Error: key-1234"
  }
})

Expected behavior with response_sensitive = true (or with response marked sensitive by default):
- Plan output should show response = (sensitive value)
- State should store it as sensitive, preventing accidental leakage

Are you interested in working on this feature?

Yes

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions