Function: terraform--resource-url

terraform--resource-url is a natively compiled function defined in terraform-mode.el.

Signature

(terraform--resource-url RESOURCE DOC-DIR)

Documentation

Return the url containing the documentation for RESOURCE using DOC-DIR.

Source Code

;; Defined in /nix/store/2sgzhgfr3sxpjh5dpyjjiqacrm3016bl-emacs-packages-deps/share/emacs/site-lisp/elpa/terraform-mode-20251115.2210/terraform-mode.el
(defun terraform--resource-url (resource doc-dir)
  "Return the url containing the documentation for RESOURCE using DOC-DIR."
  (let* ((provider (terraform--extract-provider resource))
         ;; search provider source in terraform files
         (provider-source (terraform--get-resource-provider-source provider))
         (resource-name (terraform--extract-resource resource)))
    (when (= (length provider-source) 0)
      ;; fallback to old method with terraform providers command
      (setq provider-source (concat
                             (terraform--get-resource-provider-namespace provider)
                             "/" provider)))
    (if (> (length provider-source) 0)
        (format "https://registry.terraform.io/providers/%s/latest/docs/%s/%s"
                provider-source doc-dir resource-name)
      (user-error "Can not determine the provider source for %s" provider))))