diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7c1a9075..62ea1b16 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -4,6 +4,11 @@ repos: - args: - --args=--config=.terraform-docs.yml id: terraform_docs + - args: + - --args=--config=.terraform-docs-internal.yml + - --hook-config=--path-to-file=.README.md + files: ^modules/test_infrastructure/ + id: terraform_docs - args: - --args=--only=terraform_deprecated_interpolation - --args=--only=terraform_deprecated_index diff --git a/.terraform-docs-internal.yml b/.terraform-docs-internal.yml new file mode 100644 index 00000000..273f7315 --- /dev/null +++ b/.terraform-docs-internal.yml @@ -0,0 +1,130 @@ +formatter: "markdown document" # this is required +version: "" +header-from: ".header.md" + +output: + file: .README.md + mode: replace + +sort: + enabled: false + +settings: + indent: 3 + lockfile: false + +content: |- + {{ .Header }} + + ## Module's Required Inputs + + Name | Type | Description + --- | --- | --- + {{- range .Module.Inputs }} + {{- if .Required }} + [`{{ .Name }}`](#{{ .Name }}) | `{{ (split "(" .Type.Raw)._0 }}` | {{ (split "." .Description.Raw)._0 }}. + {{- end }} + {{- end }} + + {{ $optional := false -}} + {{ range .Module.Inputs }}{{ if not .Required }}{{ $optional = true -}}{{ end -}}{{ end -}} + + {{ if $optional -}} + ## Module's Optional Inputs + + Name | Type | Description + --- | --- | --- + {{- range .Module.Inputs }} + {{- if not .Required }} + [`{{ .Name }}`](#{{ .Name }}) | `{{ (split "(" .Type.Raw)._0 }}` | {{ (split "." .Description.Raw)._0 }}. + {{- end -}} + {{ end -}} + {{ end }} + + {{ if ne (len .Module.Outputs) 0 -}} + ## Module's Outputs + + Name | Description + --- | --- + {{- range .Module.Outputs }} + `{{ .Name }}` | {{ .Description.Raw }} + {{- end }} + {{- end }} + + ## Module's Nameplate + + {{ if ne (len .Module.Requirements) 0 -}} + Requirements needed by this module: + {{ range .Module.Requirements }} + - `{{ .Name }}`{{ if .Version }}, version: {{ .Version }}{{ end }} + {{- end }} + {{- end }} + + {{ if ne (len .Module.Providers) 0 -}} + Providers used in this module: + {{ range .Module.Providers }} + - `{{ .Name }}`{{ if .Version }}, version: {{ .Version }}{{ end }} + {{- end }} + {{- end }} + + {{ if ne (len .Module.ModuleCalls) 0 -}} + Modules used in this module: + Name | Version | Source | Description + --- | --- | --- | --- + {{- range .Module.ModuleCalls }} + `{{ .Name }}` | {{ if .Version }}{{ .Version }}{{ else }}-{{ end }} | {{ .Source }} | {{ .Description }} + {{- end }} + {{- end }} + + {{ if ne (len .Module.Resources) 0 -}} + Resources used in this module: + {{ range .Module.Resources }} + - `{{ .Type }}` ({{ .Mode }}) + {{- end }} + {{- end }} + + ## Inputs/Outpus details + + ### Required Inputs + + {{ range .Module.Inputs -}} + {{ if .Required -}} + #### {{ .Name }} + + {{ .Description }} + + Type: {{ if lt (len (split "\n" .Type.Raw)) 2 }}{{ .Type }}{{ else }} + + ```hcl + {{ .Type }} + ``` + {{ end }} + + [back to list](#modules-required-inputs) + + {{ end -}} + {{- end -}} + + {{ if $optional -}} + ### Optional Inputs + + {{ range .Module.Inputs -}} + {{ if not .Required -}} + #### {{ .Name }} + + {{ .Description }} + + Type: {{ if lt (len (split "\n" .Type.Raw)) 2 }}{{ .Type }}{{ else }} + + ```hcl + {{ .Type }} + ``` + {{ end }} + + Default value: `{{ .Default }}` + + [back to list](#modules-optional-inputs) + + {{ end }} + {{- end -}} + {{ end -}} \ No newline at end of file diff --git a/modules/test_infrastructure/.README.md b/modules/test_infrastructure/.README.md index aa0c50dc..7646a9a4 100644 --- a/modules/test_infrastructure/.README.md +++ b/modules/test_infrastructure/.README.md @@ -20,7 +20,6 @@ Name | Type | Description [`spoke_vms`](#spoke_vms) | `map` | A map defining spoke VMs for testing. [`bastions`](#bastions) | `map` | A map containing Azure Bastion definition. - ## Module's Optional Inputs Name | Type | Description @@ -29,8 +28,6 @@ Name | Type | Description [`tags`](#tags) | `map` | The map of tags to assign to all created resources. [`load_balancers`](#load_balancers) | `map` | A map containing configuration for all (both private and public) Load Balancers. - - ## Module's Outputs Name | Description @@ -42,17 +39,14 @@ private IP address otherwise. ## Module's Nameplate - Requirements needed by this module: - `terraform`, version: >= 1.5, < 2.0 -- `azurerm`, version: ~> 3.80 - +- `azurerm`, version: ~> 3.98 Providers used in this module: -- `azurerm`, version: ~> 3.80 - +- `azurerm`, version: ~> 3.98 Modules used in this module: Name | Version | Source | Description @@ -61,7 +55,6 @@ Name | Version | Source | Description `vnet_peering` | - | ../vnet_peering | https://registry.terraform.io/modules/PaloAltoNetworks/swfw-modules/azurerm/latest/submodules/vnet_peering `load_balancer` | - | ../loadbalancer | https://registry.terraform.io/modules/PaloAltoNetworks/swfw-modules/azurerm/latest/submodules/loadbalancer - Resources used in this module: - `bastion_host` (managed) @@ -76,8 +69,6 @@ Resources used in this module: ### Required Inputs - - #### resource_group_name The name of the Resource Group to use. @@ -94,7 +85,6 @@ Type: string [back to list](#modules-required-inputs) - #### vnets A map defining VNETs. @@ -171,7 +161,6 @@ map(object({ [back to list](#modules-required-inputs) - #### authentication A map defining authentication details for spoke VMs. @@ -278,11 +267,8 @@ map(object({ [back to list](#modules-required-inputs) - - ### Optional Inputs - #### create_resource_group When set to `true` it will cause a Resource Group creation. Name of the newly specified RG is controlled by @@ -296,8 +282,6 @@ Default value: `true` [back to list](#modules-optional-inputs) - - #### tags The map of tags to assign to all created resources. @@ -308,7 +292,6 @@ Default value: `map[]` [back to list](#modules-optional-inputs) - #### load_balancers A map containing configuration for all (both private and public) Load Balancers. @@ -408,7 +391,4 @@ Default value: `map[]` [back to list](#modules-optional-inputs) - - - \ No newline at end of file