terraform icon indicating copy to clipboard operation
terraform copied to clipboard

Custom Search Engine support in chrome or other modern browser

Open cschar opened this issue 2 years ago • 7 comments

Terraform Version

non-version specific

Affected Pages

No response

What is the docs issue?

Often times I google "azurerm_some_resource_name" hoping to get a registry.terraform.io hit on the first page. unfortunately, sometimes the result doesn't show up on the first page... sometimes not even on the first 3 pages of search results.

When searching in chrome, I want to use registry.terraform.io as a specific search engine heres a tutorial on how to setup a search engine: https://www.wired.com/2013/09/h2-chrome-omnibox/

Other sites that support this are youtube, twitter, soundcloud etc...

Once You go into a provider specific page, there is a filter on the sidebar, to filter resources. but the search bar at the top stays at a top level view. and searches across multiple providers etc... I would like a provider specific keyword search.

e.g. for azurerm if i type 'virtual' I would like to see results of a few virtual_machine resources.

Proposal

Add support for provider specific search, to enter a GET request with a ?q= parameter, returning a page of results, instead of just a filter widget.

References

No response

cschar avatar Aug 30 '23 21:08 cschar

Hi @cschar,

If I'm understanding your request correctly, I think you are asking for a URL template on registry.terraform.io that is compatible with the custom search capabilities in popular browsers.

If so, I think such a template already exists: https://registry.terraform.io/search/providers?q=%s. This returns all of the providers matching a given query, and is accessible from the UI by selecting "See all" from the "Providers" header in the search box's pop-out panel.

Does that achieve what you were hoping for, or is there something missing? Thanks!

apparentlymart avatar Aug 30 '23 21:08 apparentlymart

This would be helpful!

tzahari avatar Jan 17 '24 09:01 tzahari

Hi @cschar,

If I'm understanding your request correctly, I think you are asking for a URL template on registry.terraform.io that is compatible with the custom search capabilities in popular browsers.

If so, I think such a template already exists: https://registry.terraform.io/search/providers?q=%s. This returns all of the providers matching a given query, and is accessible from the UI by selecting "See all" from the "Providers" header in the search box's pop-out panel.

Does that achieve what you were hoping for, or is there something missing? Thanks!

Hi @apparentlymart

your solution is a search for providers themselves... which is not my case as i already know the azurerm provider exists... its the hundreds of resources within that I want to immediately be able to search without having to click thorugh google search results that may be poorly indexed.

Following your solution provides the following:

Configuring in chrome: Screenshot 2024-05-24 at 8 58 01 PM

typing keyword 'registry.tf' in browser Screenshot 2024-05-24 at 8 59 08 PM

hitting "TAB" to begin search on your suggested https://registry.terraform.io/search/providers?q=%s Screenshot 2024-05-24 at 8 59 13 PM

getting the results back... Yes its an azurerm provider... but i want to search within that provider, ex, for a random policy resource or route_table_association etc... Screenshot 2024-05-24 at 8 59 28 PM

I want the following search exposed... Screenshot 2024-05-24 at 9 05 26 PM

I notice when I type in those search keywords virtual_network_gateway .... the URL does not change... you could have it so if you add a q?= to https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs --> https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs?q=virtual_network_gateway

that it loads the page with that filter keyword automatically loaded into the filter... that might suffice as an entry point for the browser search.

As you can see, if i type in that ?q=<KEYWORD> inside the provider docs page... and hit enter it does not load the page with any filter terms loaded in Screenshot 2024-05-24 at 9 09 00 PM

cschar avatar May 25 '24 01:05 cschar

Thanks for that extra context, @cschar.

Indeed, as far as I know the docs navigation filter for a specific provider is not exposed as a separate page you can link to as a search engine template.

This request is still labelled for consideration and the Terraform Registry team, so we'll see what they think about the feasibility of implementing what you're hoping for.

Thanks!

apparentlymart avatar May 28 '24 14:05 apparentlymart

any update on this? would like to have this.

mustafa89 avatar Oct 15 '24 10:10 mustafa89

Since the time this issue was posted, the Registry team created a new mechanism to provide them with feedback. Please email [email protected]. For the most part, the Registry team does not work on issues that are reported via this repository's issue tracker.

I will leave this issue open as a reference point for discussions with the registry team going forward.

Thanks!

crw avatar Oct 15 '24 15:10 crw

I have found a work-around using a Javascript userscript (I am using Tampermonkey extension in my browser to inject the userscript dynamically - or this one with Firefox). It's not ideal, but it allows to set the filter with a query string parameter and therefor enables setting up a custom search engine for Terraform.io documentations.

ps: The script is currently wrapping the search terms with double-quotes " to return only exact matches. If you prefer a normal search to be performed, just take them out.

Here is the script I wrote:

// ==UserScript==
// @name         Terraform.io | Auto search
// @namespace    https://registry.terraform.io/
// @version      2025-05-29
// @description  try to take over the world!
// @author       Gregory Becker
// @match        https://registry.terraform.io/providers/*/docs?filter=*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=terraform.io
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    var attempts = 20
    var updateFilter = function() {
        var queryStringParams = new URLSearchParams(document.location.search)
        var filterParam = queryStringParams.get('filter')
        var input = document.getElementById('ember32')

        if (input && filterParam) {
            // updates the filter input value
            input.value = '"' + filterParam + '"'
            // triggers an update to reload the list of results
            var eventChange = new Event('change')
            var eventKeyUp = new Event('keyup')
            input.dispatchEvent(eventChange)
            input.dispatchEvent(eventKeyUp)
        } else if (attempts > 0) {
            setTimeout(updateFilter, 200)
            attempts--
        }
    }

    setTimeout(updateFilter, 200);
})();

Then, you can set the filter from the URL like this:

https://registry.terraform.io/providers/hashicorp/aws/5.98.0/docs?filter=aws_db

igreg avatar May 29 '25 16:05 igreg

Going to close this as docs have moved out of this repo to hashicorp/web-unified-docs and, as previously noted, the registry team has a new feedback mechanism that should be used for this type of feedback. Thanks!

crw avatar Aug 13 '25 00:08 crw

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

github-actions[bot] avatar Sep 12 '25 02:09 github-actions[bot]