code: func (c *Client) ModuleVersions(module *regsrc.Module) (*response.ModuleVersions, error) {
  	host, err := module.SvcHost()
  	if err != nil {
  		return nil, err
  	}
  
  	service, err := c.Discover(host, modulesServiceID)
  	if err != nil {
  		return nil, err
  	}
  
  	p, err := url.Parse(path.Join(module.Module(), "versions"))
  	if err != nil {
  		return nil, err
  	}
  
  	service = service.ResolveReference(p)
  
  	log.Printf("[DEBUG] fetching module versions from %q", service)
  
  	req, err := http.NewRequest("GET", service.String(), nil)
  	if err != nil {
  		return nil, err
  	}
  
  	c.addRequestCreds(host, req)
  	req.Header.Set(xTerraformVersion, tfVersion)
  
  	resp, err := c.client.Do(req)
  	if err != nil {
  		return nil, err
  	}
  	defer resp.Body.Close()
  
  	switch resp.StatusCode {
  	case http.StatusOK:
  		// OK
  	case http.StatusNotFound:
  		return nil, &errModuleNotFound{addr: module}
  	default:
  		return nil, fmt.Errorf("error looking up module versions: %s", resp.Status)
  	}
  
  	var versions response.ModuleVersions
  
  	dec := json.NewDecoder(resp.Body)
  	if err := dec.Decode(&versions); err != nil {
  		return nil, err
  	}
  
  	for _, mod := range versions.Modules {
  		for _, v := range mod.Versions {
  			log.Printf("[DEBUG] found available version %q for %s", v.Version, mod.Source)
  		}
  	}
  
  	return &versions, nil
  }
docs: // ModuleVersions queries the registry for a module, and returns the available versions.