Skip to content

Configuration

open-docs reads an optional .open-docs.hcl. Put it in the module directory or the repository root, or pass -config <file>. open-docs uses the nearest one, searching from the module directory up to the repository root.

Your file is decoded on top of the built-in defaults, so set only what you want to change.

main

main {
  docsfile = "README.md" # relative to the module directory
  mode     = "inject"    # "stdout" (default) | "replace" | "inject"
  header   = false       # omit the module title line (default: true)
  verbose  = true        # add line:column:byte ranges to positions (default: false)
  version  = false       # omit the "generated with open-docs" line (default: true)
}
Mode Behavior
stdout Print the docs. The default.
replace Overwrite docsfile with the docs.
inject Replace the text between <!-- BEGIN_OPEN_DOC --> and <!-- END_OPEN_DOC --> in docsfile, adding the region if it is missing.

The -m <mode> flag sets the mode from the command line, and -o <file> sets the output file. Both take precedence over the config file. -o alone is a shortcut for replace mode to that path; combine it with -m inject to update the markers in that file instead.

-show and -hide take comma-separated section block names, such as -hide locals,resources, and override each section's render switch for one run; -hide wins when both name a section. -check renders the docs and exits non-zero if writing them would change the docs file, without writing it.

Sections and columns

Every section has a block with a render switch and one switch per column:

# Hide two columns of the inputs table.
variables {
  comment  = false
  position = false
}

# Drop the outputs section entirely.
outputs {
  render = false
}

Defaults

These are the built-in defaults, included straight from internal/config/defaults.hcl, so they always match the released code.

# Built-in defaults for open-docs. A user's .open-docs.hcl is decoded on top
# of these values, so any attribute set there overrides the one here.
main {
  docsfile = "README.md" # the markdown file to update
  mode     = "stdout"    # must be `stdout`, `replace`, or `inject`
  header   = true        # render the `# Module` title line
  verbose = false        # include byte and column locations in position renders
  version = true         # include the open-docs version header in markdown render
}

required {
  render = true
  name = true
  source = true
  version = true
  alias = false
  position = true
}

providers {
  render = true
  name = true
  alias = true
  for_each = false
  position = true
}

variables {
  render = true
  name = true
  type = true
  default = true
  required = true
  description = true
  comment = true
  sensitive = true
  nullable = true
  ephemeral = true
  validation = true
  position = true
}

outputs {
  render = true
  name = true
  value = true
  references = true
  description = true
  comment = true
  sensitive = true
  ephemeral = true
  depends_on = true
  position = true
}

locals {
  render = true
  name = true
  value = true
  references = true
  position = true
}

resources {
  render    = true
    name      = true
    # mode      = false
    mode      = true
    type      = true
    provider  = false
    count     = true
    for_each   = true
    depends_on = true
    nested_body= true
    lifecycle = true
    comment   = true
    position  = true
}

data {
  render    = true
    name      = true
    mode      = true
    type      = true
    provider  = false
    count     = true
    for_each   = true
    depends_on = true
    nested_body= true
    lifecycle = true
    comment   = true
    position  = true
}

ephemeral {
  render    = true
    name      = true
    mode      = true
    type      = true
    provider  = false
    count     = true
    for_each   = true
    depends_on = true
    nested_body= true
    lifecycle = true
    comment   = true
    position  = true
}

modules {
  render = true
  name = true
  source = true
  version = true
  count = true
  for_each = true
  depends_on = true
  providers = true
  inputs = true
  comment = true
  position = true
}

diagnostics {
  render = true
  summary = true
  detail = true
  subject = true
  context = true
}

moved {
  render = true
  from = true
  to = true
  position = true
}

imports {
  render = true
  to = true
  id = true
  provider = true
  position = true
}

removed {
  render = true
  from = true
  destroy_on_drop = true
  position = true
}

checks {
  render = true
  name = true
  data_source = true
  assertions = true
  position = true
}

schema_findings {
  render = true
  resource = true
  kind = true
  attribute = true
  message = true
  position = true
}