{{- $moduleName := .moduleName -}} {{- $repoURL := .repoURL -}} {{- $moduleStatus := .moduleStatus -}} {{- $useLinks := .useLinks -}} {{/* Only query the registry API for published modules */}} {{- if and (or (eq $moduleStatus "Available") (eq $moduleStatus "Orphaned") (eq $moduleStatus "Deprecated")) (ne $repoURL "") -}} {{/* Extract the provider from the repo URL (e.g., "azurerm" from "terraform-azurerm-...") */}} {{- $repoURLSplit := strings.Split $repoURL "/" -}} {{- $repoName := index $repoURLSplit (sub (len $repoURLSplit) 1) -}} {{- $repoNameSplit := strings.Split $repoName "-" -}} {{- $moduleProvider := index $repoNameSplit 1 -}} {{/* Fetch module details from the Terraform registry API */}} {{- $moduleTfRegApiUrl := printf "https://registry.terraform.io/v1/modules/Azure/%s/%s" $moduleName $moduleProvider -}} {{- $moduleTfRegApiData := dict -}} {{- with resources.GetRemote $moduleTfRegApiUrl -}} {{- with .Err -}} {{- else -}} {{- $moduleTfRegApiData = . | transform.Unmarshal -}} {{- end -}} {{- end -}} {{/* Extract submodules, filtering to only include paths under "modules/" (not examples) */}} {{- $submodules := slice -}} {{- with $moduleTfRegApiData.submodules -}} {{- range . -}} {{- if hasPrefix .path "modules/" -}} {{- $submodules = $submodules | append . -}} {{- end -}} {{- end -}} {{- end -}} {{/* Render submodules as a flat bullet point list if any exist */}} {{- if $submodules -}}
{{- end -}} {{- end -}}