generated from qbeyond/terraform-module-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.terraform-docs.yml
115 lines (96 loc) · 3.49 KB
/
.terraform-docs.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
formatter: "markdown"
# Tested with this version
# As Majorversion is 0 any change may break
version: ">=0.16.0"
sections:
hide:
- header
- providers
output:
file: "README.md"
mode: inject
sort:
enabled: true
by: required
content: |-
{{- define "setDict" -}}
{{- $resource := list -}}
{{- if hasKey .Dict .Key -}}
{{- $resource = get .Dict .Key -}}
{{- else -}}
{{- $resource = list -}}
{{- end -}}
{{- $resource := append $resource .Resource -}}
{{- $_ := set .Dict .Key $resource -}}
{{- end -}}
{{- $filesResources := dict -}}
{{- $resourceTypes := dict -}}
{{- range .Module.Resources -}}
{{- template "setDict" dict "Dict" $filesResources "Key" .Position.Filename "Resource" . -}}
{{- $isResource := eq "resource" (printf "%s" .GetMode) -}}
{{- if $isResource -}}
{{- template "setDict" dict "Dict" $resourceTypes "Key" (printf "%s_%s" .ProviderName .Type) "Resource" . -}}
{{- end -}}
{{- end -}}
{{ indent 0 "#" }} Usage
To use this module a resource group and log analytics workspace is required.
The webhook URL needs to point to a valid receiver for pipeline events.
If authentication or other options are required they need to be included in the URL as path or query parameters.
```hcl
{{ include "examples/basic/main.tf" }}
```
{{ indent 1 "#" }} Extra Queries
You can specify additional kusto queries to monitor.
```hcl
{{ include "examples/extra_queries/main.tf" }}
```
`queries/failed_jobs.kusto`
```kusto
{{ include "examples/extra_queries/queries/failed_jobs.kusto" }}
```
{{ .Requirements }}
{{ .Providers }}
{{ .Inputs }}
{{ .Outputs }}
{{ if .Config.Sections.Resources -}}
{{- if not (keys $resourceTypes) -}}
{{- if not .Config.Settings.HideEmpty -}}
{{- indent 0 "#" }} Resource types
No resources.
{{ end }}
{{ else }}
{{- indent 0 "#" }} Resource types
| Type | Used |
|------|-------|
{{- range $type,$resources := $resourceTypes }}
{{- $url := (first $resources).URL -}}
{{- $type = ternary $url (printf "[%s](%s)" $type $url) $type }}
| {{ $type }} | {{ len $resources }} |
{{- end }}
**`Used` only includes resource blocks.** `for_each` and `count` meta arguments, as well as resource blocks of modules are not considered.
{{ end }}
{{ end -}}
{{ .Modules }}
{{ if or .Config.Sections.Resources .Config.Sections.DataSources -}}
{{- if not (keys $filesResources) -}}
{{- if not .Config.Settings.HideEmpty -}}
{{ indent 0 "#" }} Resources by Files
No resources.
{{ end }}
{{ else }}
{{ indent 0 "#" }} Resources by Files
{{- range $fileName,$resources := $filesResources }}
{{ indent 1 "#" }} {{ $fileName }}
| Name | Type |
|------|------|
{{- range $resources -}}
{{- $isResource := and $.Config.Sections.Resources ( eq "resource" (printf "%s" .GetMode)) }}
{{- $isDataResource := and $.Config.Sections.DataSources ( eq "data source" (printf "%s" .GetMode)) }}
{{- if or $isResource $isDataResource }}
{{- $fullspec := ternary .URL (printf "[%s](%s)" .Spec .URL) .Spec }}
| {{ $fullspec }} | {{ .GetMode }} |
{{- end }}
{{- end -}}
{{- end }}
{{ end }}
{{- end -}}