From 61cc005548e70b740e85ad64b946c97b6c9f4471 Mon Sep 17 00:00:00 2001 From: Khosrow Moossavi Date: Thu, 10 Jun 2021 17:10:03 -0400 Subject: [PATCH] Render resources without URL correctly in Markdown and Asciidoc Signed-off-by: Khosrow Moossavi --- docs/reference/asciidoc-document.md | 5 +++++ docs/reference/asciidoc-table.md | 3 +++ docs/reference/json.md | 17 +++++++++++++++++ docs/reference/markdown-document.md | 5 +++++ docs/reference/markdown-table.md | 3 +++ docs/reference/pretty.md | 3 +++ docs/reference/toml.md | 17 +++++++++++++++++ docs/reference/xml.md | 17 +++++++++++++++++ docs/reference/yaml.md | 11 +++++++++++ examples/main.tf | 7 ++++++- .../templates/asciidoc_document_resources.tmpl | 7 ++----- .../templates/asciidoc_table_resources.tmpl | 7 ++----- .../templates/markdown_document_resources.tmpl | 7 ++----- .../templates/markdown_table_resources.tmpl | 7 ++----- .../testdata/asciidoc/document-Base.golden | 5 +++++ .../asciidoc/document-IndentationOfFour.golden | 5 +++++ .../asciidoc/document-OnlyProviders.golden | 2 ++ .../asciidoc/document-OnlyRequirements.golden | 2 ++ .../asciidoc/document-OnlyResources.golden | 1 + .../asciidoc/document-WithAnchor.golden | 5 +++++ .../asciidoc/document-WithRequired.golden | 5 +++++ .../format/testdata/asciidoc/table-Base.golden | 3 +++ .../asciidoc/table-IndentationOfFour.golden | 3 +++ .../asciidoc/table-OnlyProviders.golden | 1 + .../asciidoc/table-OnlyRequirements.golden | 1 + .../asciidoc/table-OnlyResources.golden | 1 + .../testdata/asciidoc/table-WithAnchor.golden | 3 +++ .../testdata/asciidoc/table-WithRequired.golden | 3 +++ .../format/testdata/common/sort-NoSort.golden | 3 +++ .../testdata/common/sort-SortByName.golden | 3 +++ .../testdata/common/sort-SortByRequired.golden | 3 +++ .../testdata/common/sort-SortByType.golden | 3 +++ internal/format/testdata/json/json-Base.golden | 17 +++++++++++++++++ .../testdata/json/json-EscapeCharacters.golden | 17 +++++++++++++++++ .../testdata/json/json-OnlyProviders.golden | 5 +++++ .../testdata/json/json-OnlyRequirements.golden | 4 ++++ .../testdata/json/json-OnlyResources.golden | 8 ++++++++ .../testdata/markdown/document-Base.golden | 5 +++++ .../markdown/document-EscapeCharacters.golden | 5 +++++ .../markdown/document-IndentationOfFour.golden | 5 +++++ .../markdown/document-OnlyProviders.golden | 2 ++ .../markdown/document-OnlyRequirements.golden | 2 ++ .../markdown/document-OnlyResources.golden | 1 + .../markdown/document-WithAnchor.golden | 5 +++++ .../markdown/document-WithRequired.golden | 5 +++++ .../markdown/document-WithoutHTML.golden | 5 +++++ .../document-WithoutHTMLWithAnchor.golden | 5 +++++ .../format/testdata/markdown/table-Base.golden | 3 +++ .../markdown/table-EscapeCharacters.golden | 3 +++ .../markdown/table-IndentationOfFour.golden | 3 +++ .../markdown/table-OnlyProviders.golden | 1 + .../markdown/table-OnlyRequirements.golden | 1 + .../markdown/table-OnlyResources.golden | 1 + .../testdata/markdown/table-WithAnchor.golden | 3 +++ .../testdata/markdown/table-WithRequired.golden | 3 +++ .../testdata/markdown/table-WithoutHTML.golden | 3 +++ .../markdown/table-WithoutHTMLWithAnchor.golden | 3 +++ .../format/testdata/pretty/pretty-Base.golden | 3 +++ .../testdata/pretty/pretty-OnlyProviders.golden | 1 + .../pretty/pretty-OnlyRequirements.golden | 1 + .../testdata/pretty/pretty-OnlyResources.golden | 1 + .../testdata/pretty/pretty-WithColor.golden | 3 +++ internal/format/testdata/toml/toml-Base.golden | 17 +++++++++++++++++ .../testdata/toml/toml-OnlyProviders.golden | 5 +++++ .../testdata/toml/toml-OnlyRequirements.golden | 4 ++++ .../testdata/toml/toml-OnlyResources.golden | 8 ++++++++ internal/format/testdata/xml/xml-Base.golden | 17 +++++++++++++++++ .../testdata/xml/xml-OnlyProviders.golden | 5 +++++ .../testdata/xml/xml-OnlyRequirements.golden | 4 ++++ .../testdata/xml/xml-OnlyResources.golden | 8 ++++++++ internal/format/testdata/yaml/yaml-Base.golden | 11 +++++++++++ .../testdata/yaml/yaml-OnlyProviders.golden | 3 +++ .../testdata/yaml/yaml-OnlyRequirements.golden | 2 ++ .../testdata/yaml/yaml-OnlyResources.golden | 6 ++++++ 74 files changed, 361 insertions(+), 21 deletions(-) diff --git a/docs/reference/asciidoc-document.md b/docs/reference/asciidoc-document.md index 32f5a38..496fd97 100644 --- a/docs/reference/asciidoc-document.md +++ b/docs/reference/asciidoc-document.md @@ -101,6 +101,8 @@ generates the following output: - [[requirement_aws]] <> (>= 2.15.0) + - [[requirement_foo]] <> (>= 1.0) + - [[requirement_random]] <> (>= 2.2.0) == Providers @@ -111,6 +113,8 @@ generates the following output: - [[provider_aws.ident]] <> (>= 2.15.0) + - [[provider_foo]] <> (>= 1.0) + - [[provider_null]] <> - [[provider_tls]] <> @@ -147,6 +151,7 @@ generates the following output: The following resources are used by this module: + - foo_resource.baz (resource) - https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource[null_resource.foo] (resource) - https://registry.terraform.io/providers/hashicorp/tls/latest/docs/resources/private_key[tls_private_key.baz] (resource) - https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity[aws_caller_identity.current] (data source) diff --git a/docs/reference/asciidoc-table.md b/docs/reference/asciidoc-table.md index c64b21f..fcd7722 100644 --- a/docs/reference/asciidoc-table.md +++ b/docs/reference/asciidoc-table.md @@ -100,6 +100,7 @@ generates the following output: |Name |Version |[[requirement_terraform]] <> |>= 0.12 |[[requirement_aws]] <> |>= 2.15.0 + |[[requirement_foo]] <> |>= 1.0 |[[requirement_random]] <> |>= 2.2.0 |=== @@ -110,6 +111,7 @@ generates the following output: |Name |Version |[[provider_aws]] <> |>= 2.15.0 |[[provider_aws.ident]] <> |>= 2.15.0 + |[[provider_foo]] <> |>= 1.0 |[[provider_null]] <> |n/a |[[provider_tls]] <> |n/a |=== @@ -130,6 +132,7 @@ generates the following output: [cols="a,a",options="header,autowidth"] |=== |Name |Type + |foo_resource.baz |resource |https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource[null_resource.foo] |resource |https://registry.terraform.io/providers/hashicorp/tls/latest/docs/resources/private_key[tls_private_key.baz] |resource |https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity[aws_caller_identity.current] |data source diff --git a/docs/reference/json.md b/docs/reference/json.md index 9e7f6b4..46da130 100644 --- a/docs/reference/json.md +++ b/docs/reference/json.md @@ -348,6 +348,11 @@ generates the following output: "alias": "ident", "version": "\u003e= 2.15.0" }, + { + "name": "foo", + "alias": null, + "version": "\u003e= 1.0" + }, { "name": "null", "alias": null, @@ -368,12 +373,24 @@ generates the following output: "name": "aws", "version": "\u003e= 2.15.0" }, + { + "name": "foo", + "version": "\u003e= 1.0" + }, { "name": "random", "version": "\u003e= 2.2.0" } ], "resources": [ + { + "type": "resource", + "name": "baz", + "provider": "foo", + "source": "https://registry.acme.com/foo", + "mode": "managed", + "version": "latest" + }, { "type": "resource", "name": "foo", diff --git a/docs/reference/markdown-document.md b/docs/reference/markdown-document.md index 1e68410..6e2448b 100644 --- a/docs/reference/markdown-document.md +++ b/docs/reference/markdown-document.md @@ -103,6 +103,8 @@ generates the following output: - [aws](#requirement\_aws) (>= 2.15.0) + - [foo](#requirement\_foo) (>= 1.0) + - [random](#requirement\_random) (>= 2.2.0) ## Providers @@ -113,6 +115,8 @@ generates the following output: - [aws.ident](#provider\_aws.ident) (>= 2.15.0) + - [foo](#provider\_foo) (>= 1.0) + - [null](#provider\_null) - [tls](#provider\_tls) @@ -149,6 +153,7 @@ generates the following output: The following resources are used by this module: + - foo_resource.baz (resource) - [null_resource.foo](https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource) (resource) - [tls_private_key.baz](https://registry.terraform.io/providers/hashicorp/tls/latest/docs/resources/private_key) (resource) - [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) (data source) diff --git a/docs/reference/markdown-table.md b/docs/reference/markdown-table.md index 8f52d1b..8b154ec 100644 --- a/docs/reference/markdown-table.md +++ b/docs/reference/markdown-table.md @@ -101,6 +101,7 @@ generates the following output: |------|---------| | [terraform](#requirement\_terraform) | >= 0.12 | | [aws](#requirement\_aws) | >= 2.15.0 | + | [foo](#requirement\_foo) | >= 1.0 | | [random](#requirement\_random) | >= 2.2.0 | ## Providers @@ -109,6 +110,7 @@ generates the following output: |------|---------| | [aws](#provider\_aws) | >= 2.15.0 | | [aws.ident](#provider\_aws.ident) | >= 2.15.0 | + | [foo](#provider\_foo) | >= 1.0 | | [null](#provider\_null) | n/a | | [tls](#provider\_tls) | n/a | @@ -125,6 +127,7 @@ generates the following output: | Name | Type | |------|------| + | foo_resource.baz | resource | | [null_resource.foo](https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource) | resource | | [tls_private_key.baz](https://registry.terraform.io/providers/hashicorp/tls/latest/docs/resources/private_key) | resource | | [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source | diff --git a/docs/reference/pretty.md b/docs/reference/pretty.md index 4510381..922985c 100644 --- a/docs/reference/pretty.md +++ b/docs/reference/pretty.md @@ -91,11 +91,13 @@ generates the following output: requirement.terraform (>= 0.12) requirement.aws (>= 2.15.0) + requirement.foo (>= 1.0) requirement.random (>= 2.2.0) provider.aws (>= 2.15.0) provider.aws.ident (>= 2.15.0) + provider.foo (>= 1.0) provider.null provider.tls @@ -106,6 +108,7 @@ generates the following output: module.foobar (git@github.com:module/path,v7.8.9) + resource.foo_resource.baz (resource) resource.null_resource.foo (resource) (https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource) resource.tls_private_key.baz (resource) (https://registry.terraform.io/providers/hashicorp/tls/latest/docs/resources/private_key) data.aws_caller_identity.current (data source) (https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) diff --git a/docs/reference/toml.md b/docs/reference/toml.md index a4e9c66..2d31326 100644 --- a/docs/reference/toml.md +++ b/docs/reference/toml.md @@ -327,6 +327,11 @@ generates the following output: alias = "ident" version = ">= 2.15.0" + [[providers]] + name = "foo" + alias = "" + version = ">= 1.0" + [[providers]] name = "null" alias = "" @@ -345,10 +350,22 @@ generates the following output: name = "aws" version = ">= 2.15.0" + [[requirements]] + name = "foo" + version = ">= 1.0" + [[requirements]] name = "random" version = ">= 2.2.0" + [[resources]] + type = "resource" + name = "baz" + provider = "foo" + source = "https://registry.acme.com/foo" + mode = "managed" + version = "latest" + [[resources]] type = "resource" name = "foo" diff --git a/docs/reference/xml.md b/docs/reference/xml.md index 75f93d6..4580cd4 100644 --- a/docs/reference/xml.md +++ b/docs/reference/xml.md @@ -347,6 +347,11 @@ generates the following output: ident >= 2.15.0 + + foo + + >= 1.0 + null @@ -367,12 +372,24 @@ generates the following output: aws >= 2.15.0 + + foo + >= 1.0 + random >= 2.2.0 + + resource + baz + foo + https://registry.acme.com/foo + managed + latest + resource foo diff --git a/docs/reference/yaml.md b/docs/reference/yaml.md index 9230658..f09e7c7 100644 --- a/docs/reference/yaml.md +++ b/docs/reference/yaml.md @@ -304,6 +304,9 @@ generates the following output: - name: aws alias: ident version: '>= 2.15.0' + - name: foo + alias: null + version: '>= 1.0' - name: "null" alias: null version: null @@ -315,9 +318,17 @@ generates the following output: version: '>= 0.12' - name: aws version: '>= 2.15.0' + - name: foo + version: '>= 1.0' - name: random version: '>= 2.2.0' resources: + - type: resource + name: baz + provider: foo + source: https://registry.acme.com/foo + mode: managed + version: latest - type: resource name: foo provider: "null" diff --git a/examples/main.tf b/examples/main.tf index b8f2d8d..438092a 100644 --- a/examples/main.tf +++ b/examples/main.tf @@ -43,10 +43,15 @@ terraform { required_providers { random = ">= 2.2.0" aws = ">= 2.15.0" + foo = { + source = "https://registry.acme.com/foo" + version = ">= 1.0" + } } } resource "tls_private_key" "baz" {} +resource "foo_resource" "baz" {} data "aws_caller_identity" "current" { provider = "aws" @@ -74,5 +79,5 @@ module "baz" { } module "foobar" { - source = "git@github.com:module/path?ref=v7.8.9" + source = "git@github.com:module/path?ref=v7.8.9" } diff --git a/internal/format/templates/asciidoc_document_resources.tmpl b/internal/format/templates/asciidoc_document_resources.tmpl index de53d66..e37d2ab 100644 --- a/internal/format/templates/asciidoc_document_resources.tmpl +++ b/internal/format/templates/asciidoc_document_resources.tmpl @@ -8,11 +8,8 @@ {{- $isResource := and $.Settings.ShowResources ( eq "resource" (printf "%s" .GetMode)) }} {{- $isDataResource := and $.Settings.ShowDataSources ( eq "data source" (printf "%s" .GetMode)) }} {{- if or $isResource $isDataResource }} - {{ if eq (len .URL) 0 }} - - {{ .Spec }} {{ printf "(%s)" .GetMode -}} - {{- else -}} - - {{ .URL }}[{{ .Spec }}] {{ printf "(%s)" .GetMode -}} - {{- end }} + {{- $fullspec := ternary .URL (printf "%s[%s]" .URL .Spec) .Spec }} + - {{ $fullspec }} {{ printf "(%s)" .GetMode -}} {{- end }} {{- end }} {{ end }} diff --git a/internal/format/templates/asciidoc_table_resources.tmpl b/internal/format/templates/asciidoc_table_resources.tmpl index 50a78d1..5cfa511 100644 --- a/internal/format/templates/asciidoc_table_resources.tmpl +++ b/internal/format/templates/asciidoc_table_resources.tmpl @@ -10,11 +10,8 @@ {{- $isResource := and $.Settings.ShowResources ( eq "resource" (printf "%s" .GetMode)) }} {{- $isDataResource := and $.Settings.ShowDataSources ( eq "data source" (printf "%s" .GetMode)) }} {{- if or $isResource $isDataResource }} - {{ if eq (len .URL) 0 }} - |{{ .Spec }} |{{ .GetMode }} - {{- else -}} - |{{ .URL }}[{{ .Spec }}] |{{ .GetMode }} - {{- end }} + {{- $fullspec := ternary .URL (printf "%s[%s]" .URL .Spec) .Spec }} + |{{ $fullspec }} |{{ .GetMode }} {{- end }} {{- end }} |=== diff --git a/internal/format/templates/markdown_document_resources.tmpl b/internal/format/templates/markdown_document_resources.tmpl index caa187e..04bf14f 100644 --- a/internal/format/templates/markdown_document_resources.tmpl +++ b/internal/format/templates/markdown_document_resources.tmpl @@ -8,11 +8,8 @@ {{- $isResource := and $.Settings.ShowResources ( eq "resource" (printf "%s" .GetMode)) }} {{- $isDataResource := and $.Settings.ShowDataSources ( eq "data source" (printf "%s" .GetMode)) }} {{- if or $isResource $isDataResource }} - {{ if eq (len .URL) 0 }} - - {{ .Spec }} {{ printf "(%s)" .GetMode -}} - {{- else -}} - - [{{ .Spec }}]({{ .URL }}) {{ printf "(%s)" .GetMode -}} - {{- end }} + {{- $fullspec := ternary .URL (printf "[%s](%s)" .Spec .URL) .Spec }} + - {{ $fullspec }} {{ printf "(%s)" .GetMode -}} {{- end }} {{- end }} {{ end }} diff --git a/internal/format/templates/markdown_table_resources.tmpl b/internal/format/templates/markdown_table_resources.tmpl index 4e15ed2..c23902a 100644 --- a/internal/format/templates/markdown_table_resources.tmpl +++ b/internal/format/templates/markdown_table_resources.tmpl @@ -9,11 +9,8 @@ {{- $isResource := and $.Settings.ShowResources ( eq "resource" (printf "%s" .GetMode)) }} {{- $isDataResource := and $.Settings.ShowDataSources ( eq "data source" (printf "%s" .GetMode)) }} {{- if or $isResource $isDataResource }} - {{ if eq (len .URL) 0 }} - | {{ .Spec }} | {{ .GetMode }} | - {{- else -}} - | [{{ .Spec }}]({{ .URL }}) | {{ .GetMode }} | - {{- end }} + {{- $fullspec := ternary .URL (printf "[%s](%s)" .Spec .URL) .Spec }} + | {{ $fullspec }} | {{ .GetMode }} | {{- end }} {{- end }} {{ end }} diff --git a/internal/format/testdata/asciidoc/document-Base.golden b/internal/format/testdata/asciidoc/document-Base.golden index 861600b..035326c 100644 --- a/internal/format/testdata/asciidoc/document-Base.golden +++ b/internal/format/testdata/asciidoc/document-Base.golden @@ -44,6 +44,8 @@ The following requirements are needed by this module: - aws (>= 2.15.0) +- foo (>= 1.0) + - random (>= 2.2.0) == Providers @@ -52,6 +54,8 @@ The following providers are used by this module: - tls +- foo (>= 1.0) + - aws (>= 2.15.0) - aws.ident (>= 2.15.0) @@ -90,6 +94,7 @@ Version: v7.8.9 The following resources are used by this module: +- foo_resource.baz (resource) - https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource[null_resource.foo] (resource) - https://registry.terraform.io/providers/hashicorp/tls/latest/docs/resources/private_key[tls_private_key.baz] (resource) - https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity[aws_caller_identity.current] (data source) diff --git a/internal/format/testdata/asciidoc/document-IndentationOfFour.golden b/internal/format/testdata/asciidoc/document-IndentationOfFour.golden index b810a37..2fef83f 100644 --- a/internal/format/testdata/asciidoc/document-IndentationOfFour.golden +++ b/internal/format/testdata/asciidoc/document-IndentationOfFour.golden @@ -44,6 +44,8 @@ The following requirements are needed by this module: - aws (>= 2.15.0) +- foo (>= 1.0) + - random (>= 2.2.0) ==== Providers @@ -52,6 +54,8 @@ The following providers are used by this module: - tls +- foo (>= 1.0) + - aws (>= 2.15.0) - aws.ident (>= 2.15.0) @@ -90,6 +94,7 @@ Version: v7.8.9 The following resources are used by this module: +- foo_resource.baz (resource) - https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource[null_resource.foo] (resource) - https://registry.terraform.io/providers/hashicorp/tls/latest/docs/resources/private_key[tls_private_key.baz] (resource) - https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity[aws_caller_identity.current] (data source) diff --git a/internal/format/testdata/asciidoc/document-OnlyProviders.golden b/internal/format/testdata/asciidoc/document-OnlyProviders.golden index 554481e..2fee1d7 100644 --- a/internal/format/testdata/asciidoc/document-OnlyProviders.golden +++ b/internal/format/testdata/asciidoc/document-OnlyProviders.golden @@ -4,6 +4,8 @@ The following providers are used by this module: - tls +- foo (>= 1.0) + - aws (>= 2.15.0) - aws.ident (>= 2.15.0) diff --git a/internal/format/testdata/asciidoc/document-OnlyRequirements.golden b/internal/format/testdata/asciidoc/document-OnlyRequirements.golden index 495e31c..31726cc 100644 --- a/internal/format/testdata/asciidoc/document-OnlyRequirements.golden +++ b/internal/format/testdata/asciidoc/document-OnlyRequirements.golden @@ -6,4 +6,6 @@ The following requirements are needed by this module: - aws (>= 2.15.0) +- foo (>= 1.0) + - random (>= 2.2.0) \ No newline at end of file diff --git a/internal/format/testdata/asciidoc/document-OnlyResources.golden b/internal/format/testdata/asciidoc/document-OnlyResources.golden index 5072ace..1a51ce9 100644 --- a/internal/format/testdata/asciidoc/document-OnlyResources.golden +++ b/internal/format/testdata/asciidoc/document-OnlyResources.golden @@ -2,5 +2,6 @@ The following resources are used by this module: +- foo_resource.baz (resource) - https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource[null_resource.foo] (resource) - https://registry.terraform.io/providers/hashicorp/tls/latest/docs/resources/private_key[tls_private_key.baz] (resource) \ No newline at end of file diff --git a/internal/format/testdata/asciidoc/document-WithAnchor.golden b/internal/format/testdata/asciidoc/document-WithAnchor.golden index 47aa14c..1982da4 100644 --- a/internal/format/testdata/asciidoc/document-WithAnchor.golden +++ b/internal/format/testdata/asciidoc/document-WithAnchor.golden @@ -44,6 +44,8 @@ The following requirements are needed by this module: - [[requirement_aws]] <> (>= 2.15.0) +- [[requirement_foo]] <> (>= 1.0) + - [[requirement_random]] <> (>= 2.2.0) == Providers @@ -52,6 +54,8 @@ The following providers are used by this module: - [[provider_tls]] <> +- [[provider_foo]] <> (>= 1.0) + - [[provider_aws]] <> (>= 2.15.0) - [[provider_aws.ident]] <> (>= 2.15.0) @@ -90,6 +94,7 @@ Version: v7.8.9 The following resources are used by this module: +- foo_resource.baz (resource) - https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource[null_resource.foo] (resource) - https://registry.terraform.io/providers/hashicorp/tls/latest/docs/resources/private_key[tls_private_key.baz] (resource) - https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity[aws_caller_identity.current] (data source) diff --git a/internal/format/testdata/asciidoc/document-WithRequired.golden b/internal/format/testdata/asciidoc/document-WithRequired.golden index d314416..ec79e65 100644 --- a/internal/format/testdata/asciidoc/document-WithRequired.golden +++ b/internal/format/testdata/asciidoc/document-WithRequired.golden @@ -44,6 +44,8 @@ The following requirements are needed by this module: - aws (>= 2.15.0) +- foo (>= 1.0) + - random (>= 2.2.0) == Providers @@ -52,6 +54,8 @@ The following providers are used by this module: - tls +- foo (>= 1.0) + - aws (>= 2.15.0) - aws.ident (>= 2.15.0) @@ -90,6 +94,7 @@ Version: v7.8.9 The following resources are used by this module: +- foo_resource.baz (resource) - https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource[null_resource.foo] (resource) - https://registry.terraform.io/providers/hashicorp/tls/latest/docs/resources/private_key[tls_private_key.baz] (resource) - https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity[aws_caller_identity.current] (data source) diff --git a/internal/format/testdata/asciidoc/table-Base.golden b/internal/format/testdata/asciidoc/table-Base.golden index 7219ab9..18beeb2 100644 --- a/internal/format/testdata/asciidoc/table-Base.golden +++ b/internal/format/testdata/asciidoc/table-Base.golden @@ -43,6 +43,7 @@ followed by another line of text. |Name |Version |terraform |>= 0.12 |aws |>= 2.15.0 +|foo |>= 1.0 |random |>= 2.2.0 |=== @@ -52,6 +53,7 @@ followed by another line of text. |=== |Name |Version |tls |n/a +|foo |>= 1.0 |aws |>= 2.15.0 |aws.ident |>= 2.15.0 |null |n/a @@ -73,6 +75,7 @@ followed by another line of text. [cols="a,a",options="header,autowidth"] |=== |Name |Type +|foo_resource.baz |resource |https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource[null_resource.foo] |resource |https://registry.terraform.io/providers/hashicorp/tls/latest/docs/resources/private_key[tls_private_key.baz] |resource |https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity[aws_caller_identity.current] |data source diff --git a/internal/format/testdata/asciidoc/table-IndentationOfFour.golden b/internal/format/testdata/asciidoc/table-IndentationOfFour.golden index 068e0c8..16b9e81 100644 --- a/internal/format/testdata/asciidoc/table-IndentationOfFour.golden +++ b/internal/format/testdata/asciidoc/table-IndentationOfFour.golden @@ -43,6 +43,7 @@ followed by another line of text. |Name |Version |terraform |>= 0.12 |aws |>= 2.15.0 +|foo |>= 1.0 |random |>= 2.2.0 |=== @@ -52,6 +53,7 @@ followed by another line of text. |=== |Name |Version |tls |n/a +|foo |>= 1.0 |aws |>= 2.15.0 |aws.ident |>= 2.15.0 |null |n/a @@ -73,6 +75,7 @@ followed by another line of text. [cols="a,a",options="header,autowidth"] |=== |Name |Type +|foo_resource.baz |resource |https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource[null_resource.foo] |resource |https://registry.terraform.io/providers/hashicorp/tls/latest/docs/resources/private_key[tls_private_key.baz] |resource |https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity[aws_caller_identity.current] |data source diff --git a/internal/format/testdata/asciidoc/table-OnlyProviders.golden b/internal/format/testdata/asciidoc/table-OnlyProviders.golden index f21ebf5..5594869 100644 --- a/internal/format/testdata/asciidoc/table-OnlyProviders.golden +++ b/internal/format/testdata/asciidoc/table-OnlyProviders.golden @@ -4,6 +4,7 @@ |=== |Name |Version |tls |n/a +|foo |>= 1.0 |aws |>= 2.15.0 |aws.ident |>= 2.15.0 |null |n/a diff --git a/internal/format/testdata/asciidoc/table-OnlyRequirements.golden b/internal/format/testdata/asciidoc/table-OnlyRequirements.golden index 7708644..7201810 100644 --- a/internal/format/testdata/asciidoc/table-OnlyRequirements.golden +++ b/internal/format/testdata/asciidoc/table-OnlyRequirements.golden @@ -5,5 +5,6 @@ |Name |Version |terraform |>= 0.12 |aws |>= 2.15.0 +|foo |>= 1.0 |random |>= 2.2.0 |=== \ No newline at end of file diff --git a/internal/format/testdata/asciidoc/table-OnlyResources.golden b/internal/format/testdata/asciidoc/table-OnlyResources.golden index cbea1b2..c61dd84 100644 --- a/internal/format/testdata/asciidoc/table-OnlyResources.golden +++ b/internal/format/testdata/asciidoc/table-OnlyResources.golden @@ -3,6 +3,7 @@ [cols="a,a",options="header,autowidth"] |=== |Name |Type +|foo_resource.baz |resource |https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource[null_resource.foo] |resource |https://registry.terraform.io/providers/hashicorp/tls/latest/docs/resources/private_key[tls_private_key.baz] |resource |=== \ No newline at end of file diff --git a/internal/format/testdata/asciidoc/table-WithAnchor.golden b/internal/format/testdata/asciidoc/table-WithAnchor.golden index b4c23d0..d0443e0 100644 --- a/internal/format/testdata/asciidoc/table-WithAnchor.golden +++ b/internal/format/testdata/asciidoc/table-WithAnchor.golden @@ -43,6 +43,7 @@ followed by another line of text. |Name |Version |[[requirement_terraform]] <> |>= 0.12 |[[requirement_aws]] <> |>= 2.15.0 +|[[requirement_foo]] <> |>= 1.0 |[[requirement_random]] <> |>= 2.2.0 |=== @@ -52,6 +53,7 @@ followed by another line of text. |=== |Name |Version |[[provider_tls]] <> |n/a +|[[provider_foo]] <> |>= 1.0 |[[provider_aws]] <> |>= 2.15.0 |[[provider_aws.ident]] <> |>= 2.15.0 |[[provider_null]] <> |n/a @@ -73,6 +75,7 @@ followed by another line of text. [cols="a,a",options="header,autowidth"] |=== |Name |Type +|foo_resource.baz |resource |https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource[null_resource.foo] |resource |https://registry.terraform.io/providers/hashicorp/tls/latest/docs/resources/private_key[tls_private_key.baz] |resource |https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity[aws_caller_identity.current] |data source diff --git a/internal/format/testdata/asciidoc/table-WithRequired.golden b/internal/format/testdata/asciidoc/table-WithRequired.golden index cc20a08..6413275 100644 --- a/internal/format/testdata/asciidoc/table-WithRequired.golden +++ b/internal/format/testdata/asciidoc/table-WithRequired.golden @@ -43,6 +43,7 @@ followed by another line of text. |Name |Version |terraform |>= 0.12 |aws |>= 2.15.0 +|foo |>= 1.0 |random |>= 2.2.0 |=== @@ -52,6 +53,7 @@ followed by another line of text. |=== |Name |Version |tls |n/a +|foo |>= 1.0 |aws |>= 2.15.0 |aws.ident |>= 2.15.0 |null |n/a @@ -73,6 +75,7 @@ followed by another line of text. [cols="a,a",options="header,autowidth"] |=== |Name |Type +|foo_resource.baz |resource |https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource[null_resource.foo] |resource |https://registry.terraform.io/providers/hashicorp/tls/latest/docs/resources/private_key[tls_private_key.baz] |resource |https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity[aws_caller_identity.current] |data source diff --git a/internal/format/testdata/common/sort-NoSort.golden b/internal/format/testdata/common/sort-NoSort.golden index 8ab0a85..f722ded 100644 --- a/internal/format/testdata/common/sort-NoSort.golden +++ b/internal/format/testdata/common/sort-NoSort.golden @@ -46,6 +46,7 @@ ], "providers": [ "tls", + "foo", "aws", "aws.ident", "null" @@ -53,9 +54,11 @@ "requirements": [ "terraform", "aws", + "foo", "random" ], "resources": [ + "foo_resource.baz__managed", "null_resource.foo__managed", "tls_private_key.baz__managed", "aws_caller_identity.current__data", diff --git a/internal/format/testdata/common/sort-SortByName.golden b/internal/format/testdata/common/sort-SortByName.golden index 29ac9c1..b74c55f 100644 --- a/internal/format/testdata/common/sort-SortByName.golden +++ b/internal/format/testdata/common/sort-SortByName.golden @@ -47,15 +47,18 @@ "providers": [ "aws", "aws.ident", + "foo", "null", "tls" ], "requirements": [ "terraform", "aws", + "foo", "random" ], "resources": [ + "foo_resource.baz__managed", "null_resource.foo__managed", "tls_private_key.baz__managed", "aws_caller_identity.current__data", diff --git a/internal/format/testdata/common/sort-SortByRequired.golden b/internal/format/testdata/common/sort-SortByRequired.golden index 1e3b623..1ce5386 100644 --- a/internal/format/testdata/common/sort-SortByRequired.golden +++ b/internal/format/testdata/common/sort-SortByRequired.golden @@ -47,15 +47,18 @@ "providers": [ "aws", "aws.ident", + "foo", "null", "tls" ], "requirements": [ "terraform", "aws", + "foo", "random" ], "resources": [ + "foo_resource.baz__managed", "null_resource.foo__managed", "tls_private_key.baz__managed", "aws_caller_identity.current__data", diff --git a/internal/format/testdata/common/sort-SortByType.golden b/internal/format/testdata/common/sort-SortByType.golden index 7edaf07..8a0e228 100644 --- a/internal/format/testdata/common/sort-SortByType.golden +++ b/internal/format/testdata/common/sort-SortByType.golden @@ -47,15 +47,18 @@ "providers": [ "aws", "aws.ident", + "foo", "null", "tls" ], "requirements": [ "terraform", "aws", + "foo", "random" ], "resources": [ + "foo_resource.baz__managed", "null_resource.foo__managed", "tls_private_key.baz__managed", "aws_caller_identity.current__data", diff --git a/internal/format/testdata/json/json-Base.golden b/internal/format/testdata/json/json-Base.golden index 393aaae..df5a604 100644 --- a/internal/format/testdata/json/json-Base.golden +++ b/internal/format/testdata/json/json-Base.golden @@ -291,6 +291,11 @@ "alias": null, "version": null }, + { + "name": "foo", + "alias": null, + "version": ">= 1.0" + }, { "name": "aws", "alias": null, @@ -316,12 +321,24 @@ "name": "aws", "version": ">= 2.15.0" }, + { + "name": "foo", + "version": ">= 1.0" + }, { "name": "random", "version": ">= 2.2.0" } ], "resources": [ + { + "type": "resource", + "name": "baz", + "provider": "foo", + "source": "https://registry.acme.com/foo", + "mode": "managed", + "version": "latest" + }, { "type": "resource", "name": "foo", diff --git a/internal/format/testdata/json/json-EscapeCharacters.golden b/internal/format/testdata/json/json-EscapeCharacters.golden index cdc99a7..c0c6212 100644 --- a/internal/format/testdata/json/json-EscapeCharacters.golden +++ b/internal/format/testdata/json/json-EscapeCharacters.golden @@ -291,6 +291,11 @@ "alias": null, "version": null }, + { + "name": "foo", + "alias": null, + "version": "\u003e= 1.0" + }, { "name": "aws", "alias": null, @@ -316,12 +321,24 @@ "name": "aws", "version": "\u003e= 2.15.0" }, + { + "name": "foo", + "version": "\u003e= 1.0" + }, { "name": "random", "version": "\u003e= 2.2.0" } ], "resources": [ + { + "type": "resource", + "name": "baz", + "provider": "foo", + "source": "https://registry.acme.com/foo", + "mode": "managed", + "version": "latest" + }, { "type": "resource", "name": "foo", diff --git a/internal/format/testdata/json/json-OnlyProviders.golden b/internal/format/testdata/json/json-OnlyProviders.golden index e6d8420..ab8fa54 100644 --- a/internal/format/testdata/json/json-OnlyProviders.golden +++ b/internal/format/testdata/json/json-OnlyProviders.golden @@ -10,6 +10,11 @@ "alias": null, "version": null }, + { + "name": "foo", + "alias": null, + "version": ">= 1.0" + }, { "name": "aws", "alias": null, diff --git a/internal/format/testdata/json/json-OnlyRequirements.golden b/internal/format/testdata/json/json-OnlyRequirements.golden index fcb2002..1358efe 100644 --- a/internal/format/testdata/json/json-OnlyRequirements.golden +++ b/internal/format/testdata/json/json-OnlyRequirements.golden @@ -14,6 +14,10 @@ "name": "aws", "version": ">= 2.15.0" }, + { + "name": "foo", + "version": ">= 1.0" + }, { "name": "random", "version": ">= 2.2.0" diff --git a/internal/format/testdata/json/json-OnlyResources.golden b/internal/format/testdata/json/json-OnlyResources.golden index b89017e..90475ed 100644 --- a/internal/format/testdata/json/json-OnlyResources.golden +++ b/internal/format/testdata/json/json-OnlyResources.golden @@ -7,6 +7,14 @@ "providers": [], "requirements": [], "resources": [ + { + "type": "resource", + "name": "baz", + "provider": "foo", + "source": "https://registry.acme.com/foo", + "mode": "managed", + "version": "latest" + }, { "type": "resource", "name": "foo", diff --git a/internal/format/testdata/markdown/document-Base.golden b/internal/format/testdata/markdown/document-Base.golden index b0208e3..0d5801c 100644 --- a/internal/format/testdata/markdown/document-Base.golden +++ b/internal/format/testdata/markdown/document-Base.golden @@ -44,6 +44,8 @@ The following requirements are needed by this module: - aws (>= 2.15.0) +- foo (>= 1.0) + - random (>= 2.2.0) ## Providers @@ -52,6 +54,8 @@ The following providers are used by this module: - tls +- foo (>= 1.0) + - aws (>= 2.15.0) - aws.ident (>= 2.15.0) @@ -90,6 +94,7 @@ Version: v7.8.9 The following resources are used by this module: +- foo_resource.baz (resource) - [null_resource.foo](https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource) (resource) - [tls_private_key.baz](https://registry.terraform.io/providers/hashicorp/tls/latest/docs/resources/private_key) (resource) - [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) (data source) diff --git a/internal/format/testdata/markdown/document-EscapeCharacters.golden b/internal/format/testdata/markdown/document-EscapeCharacters.golden index 52828b8..1203ff2 100644 --- a/internal/format/testdata/markdown/document-EscapeCharacters.golden +++ b/internal/format/testdata/markdown/document-EscapeCharacters.golden @@ -44,6 +44,8 @@ The following requirements are needed by this module: - aws (>= 2.15.0) +- foo (>= 1.0) + - random (>= 2.2.0) ## Providers @@ -52,6 +54,8 @@ The following providers are used by this module: - tls +- foo (>= 1.0) + - aws (>= 2.15.0) - aws.ident (>= 2.15.0) @@ -90,6 +94,7 @@ Version: v7.8.9 The following resources are used by this module: +- foo_resource.baz (resource) - [null_resource.foo](https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource) (resource) - [tls_private_key.baz](https://registry.terraform.io/providers/hashicorp/tls/latest/docs/resources/private_key) (resource) - [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) (data source) diff --git a/internal/format/testdata/markdown/document-IndentationOfFour.golden b/internal/format/testdata/markdown/document-IndentationOfFour.golden index 25ca644..f09c340 100644 --- a/internal/format/testdata/markdown/document-IndentationOfFour.golden +++ b/internal/format/testdata/markdown/document-IndentationOfFour.golden @@ -44,6 +44,8 @@ The following requirements are needed by this module: - aws (>= 2.15.0) +- foo (>= 1.0) + - random (>= 2.2.0) #### Providers @@ -52,6 +54,8 @@ The following providers are used by this module: - tls +- foo (>= 1.0) + - aws (>= 2.15.0) - aws.ident (>= 2.15.0) @@ -90,6 +94,7 @@ Version: v7.8.9 The following resources are used by this module: +- foo_resource.baz (resource) - [null_resource.foo](https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource) (resource) - [tls_private_key.baz](https://registry.terraform.io/providers/hashicorp/tls/latest/docs/resources/private_key) (resource) - [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) (data source) diff --git a/internal/format/testdata/markdown/document-OnlyProviders.golden b/internal/format/testdata/markdown/document-OnlyProviders.golden index db83aed..7d854cc 100644 --- a/internal/format/testdata/markdown/document-OnlyProviders.golden +++ b/internal/format/testdata/markdown/document-OnlyProviders.golden @@ -4,6 +4,8 @@ The following providers are used by this module: - tls +- foo (>= 1.0) + - aws (>= 2.15.0) - aws.ident (>= 2.15.0) diff --git a/internal/format/testdata/markdown/document-OnlyRequirements.golden b/internal/format/testdata/markdown/document-OnlyRequirements.golden index d1e42ce..2bbc9ca 100644 --- a/internal/format/testdata/markdown/document-OnlyRequirements.golden +++ b/internal/format/testdata/markdown/document-OnlyRequirements.golden @@ -6,4 +6,6 @@ The following requirements are needed by this module: - aws (>= 2.15.0) +- foo (>= 1.0) + - random (>= 2.2.0) \ No newline at end of file diff --git a/internal/format/testdata/markdown/document-OnlyResources.golden b/internal/format/testdata/markdown/document-OnlyResources.golden index 830f74e..20245d8 100644 --- a/internal/format/testdata/markdown/document-OnlyResources.golden +++ b/internal/format/testdata/markdown/document-OnlyResources.golden @@ -2,5 +2,6 @@ The following resources are used by this module: +- foo_resource.baz (resource) - [null_resource.foo](https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource) (resource) - [tls_private_key.baz](https://registry.terraform.io/providers/hashicorp/tls/latest/docs/resources/private_key) (resource) \ No newline at end of file diff --git a/internal/format/testdata/markdown/document-WithAnchor.golden b/internal/format/testdata/markdown/document-WithAnchor.golden index b4f23ee..da9ac43 100644 --- a/internal/format/testdata/markdown/document-WithAnchor.golden +++ b/internal/format/testdata/markdown/document-WithAnchor.golden @@ -44,6 +44,8 @@ The following requirements are needed by this module: - [aws](#requirement_aws) (>= 2.15.0) +- [foo](#requirement_foo) (>= 1.0) + - [random](#requirement_random) (>= 2.2.0) ## Providers @@ -52,6 +54,8 @@ The following providers are used by this module: - [tls](#provider_tls) +- [foo](#provider_foo) (>= 1.0) + - [aws](#provider_aws) (>= 2.15.0) - [aws.ident](#provider_aws.ident) (>= 2.15.0) @@ -90,6 +94,7 @@ Version: v7.8.9 The following resources are used by this module: +- foo_resource.baz (resource) - [null_resource.foo](https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource) (resource) - [tls_private_key.baz](https://registry.terraform.io/providers/hashicorp/tls/latest/docs/resources/private_key) (resource) - [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) (data source) diff --git a/internal/format/testdata/markdown/document-WithRequired.golden b/internal/format/testdata/markdown/document-WithRequired.golden index 7444d28..555b376 100644 --- a/internal/format/testdata/markdown/document-WithRequired.golden +++ b/internal/format/testdata/markdown/document-WithRequired.golden @@ -44,6 +44,8 @@ The following requirements are needed by this module: - aws (>= 2.15.0) +- foo (>= 1.0) + - random (>= 2.2.0) ## Providers @@ -52,6 +54,8 @@ The following providers are used by this module: - tls +- foo (>= 1.0) + - aws (>= 2.15.0) - aws.ident (>= 2.15.0) @@ -90,6 +94,7 @@ Version: v7.8.9 The following resources are used by this module: +- foo_resource.baz (resource) - [null_resource.foo](https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource) (resource) - [tls_private_key.baz](https://registry.terraform.io/providers/hashicorp/tls/latest/docs/resources/private_key) (resource) - [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) (data source) diff --git a/internal/format/testdata/markdown/document-WithoutHTML.golden b/internal/format/testdata/markdown/document-WithoutHTML.golden index b0208e3..0d5801c 100644 --- a/internal/format/testdata/markdown/document-WithoutHTML.golden +++ b/internal/format/testdata/markdown/document-WithoutHTML.golden @@ -44,6 +44,8 @@ The following requirements are needed by this module: - aws (>= 2.15.0) +- foo (>= 1.0) + - random (>= 2.2.0) ## Providers @@ -52,6 +54,8 @@ The following providers are used by this module: - tls +- foo (>= 1.0) + - aws (>= 2.15.0) - aws.ident (>= 2.15.0) @@ -90,6 +94,7 @@ Version: v7.8.9 The following resources are used by this module: +- foo_resource.baz (resource) - [null_resource.foo](https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource) (resource) - [tls_private_key.baz](https://registry.terraform.io/providers/hashicorp/tls/latest/docs/resources/private_key) (resource) - [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) (data source) diff --git a/internal/format/testdata/markdown/document-WithoutHTMLWithAnchor.golden b/internal/format/testdata/markdown/document-WithoutHTMLWithAnchor.golden index b4f23ee..da9ac43 100644 --- a/internal/format/testdata/markdown/document-WithoutHTMLWithAnchor.golden +++ b/internal/format/testdata/markdown/document-WithoutHTMLWithAnchor.golden @@ -44,6 +44,8 @@ The following requirements are needed by this module: - [aws](#requirement_aws) (>= 2.15.0) +- [foo](#requirement_foo) (>= 1.0) + - [random](#requirement_random) (>= 2.2.0) ## Providers @@ -52,6 +54,8 @@ The following providers are used by this module: - [tls](#provider_tls) +- [foo](#provider_foo) (>= 1.0) + - [aws](#provider_aws) (>= 2.15.0) - [aws.ident](#provider_aws.ident) (>= 2.15.0) @@ -90,6 +94,7 @@ Version: v7.8.9 The following resources are used by this module: +- foo_resource.baz (resource) - [null_resource.foo](https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource) (resource) - [tls_private_key.baz](https://registry.terraform.io/providers/hashicorp/tls/latest/docs/resources/private_key) (resource) - [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) (data source) diff --git a/internal/format/testdata/markdown/table-Base.golden b/internal/format/testdata/markdown/table-Base.golden index ae8177c..21ef339 100644 --- a/internal/format/testdata/markdown/table-Base.golden +++ b/internal/format/testdata/markdown/table-Base.golden @@ -42,6 +42,7 @@ followed by another line of text. |------|---------| | terraform | >= 0.12 | | aws | >= 2.15.0 | +| foo | >= 1.0 | | random | >= 2.2.0 | ## Providers @@ -49,6 +50,7 @@ followed by another line of text. | Name | Version | |------|---------| | tls | n/a | +| foo | >= 1.0 | | aws | >= 2.15.0 | | aws.ident | >= 2.15.0 | | null | n/a | @@ -66,6 +68,7 @@ followed by another line of text. | Name | Type | |------|------| +| foo_resource.baz | resource | | [null_resource.foo](https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource) | resource | | [tls_private_key.baz](https://registry.terraform.io/providers/hashicorp/tls/latest/docs/resources/private_key) | resource | | [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source | diff --git a/internal/format/testdata/markdown/table-EscapeCharacters.golden b/internal/format/testdata/markdown/table-EscapeCharacters.golden index ce62b7e..bb82f74 100644 --- a/internal/format/testdata/markdown/table-EscapeCharacters.golden +++ b/internal/format/testdata/markdown/table-EscapeCharacters.golden @@ -42,6 +42,7 @@ followed by another line of text. |------|---------| | terraform | >= 0.12 | | aws | >= 2.15.0 | +| foo | >= 1.0 | | random | >= 2.2.0 | ## Providers @@ -49,6 +50,7 @@ followed by another line of text. | Name | Version | |------|---------| | tls | n/a | +| foo | >= 1.0 | | aws | >= 2.15.0 | | aws.ident | >= 2.15.0 | | null | n/a | @@ -66,6 +68,7 @@ followed by another line of text. | Name | Type | |------|------| +| foo_resource.baz | resource | | [null_resource.foo](https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource) | resource | | [tls_private_key.baz](https://registry.terraform.io/providers/hashicorp/tls/latest/docs/resources/private_key) | resource | | [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source | diff --git a/internal/format/testdata/markdown/table-IndentationOfFour.golden b/internal/format/testdata/markdown/table-IndentationOfFour.golden index fdff09a..19c86fd 100644 --- a/internal/format/testdata/markdown/table-IndentationOfFour.golden +++ b/internal/format/testdata/markdown/table-IndentationOfFour.golden @@ -42,6 +42,7 @@ followed by another line of text. |------|---------| | terraform | >= 0.12 | | aws | >= 2.15.0 | +| foo | >= 1.0 | | random | >= 2.2.0 | #### Providers @@ -49,6 +50,7 @@ followed by another line of text. | Name | Version | |------|---------| | tls | n/a | +| foo | >= 1.0 | | aws | >= 2.15.0 | | aws.ident | >= 2.15.0 | | null | n/a | @@ -66,6 +68,7 @@ followed by another line of text. | Name | Type | |------|------| +| foo_resource.baz | resource | | [null_resource.foo](https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource) | resource | | [tls_private_key.baz](https://registry.terraform.io/providers/hashicorp/tls/latest/docs/resources/private_key) | resource | | [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source | diff --git a/internal/format/testdata/markdown/table-OnlyProviders.golden b/internal/format/testdata/markdown/table-OnlyProviders.golden index 7267758..10b50c6 100644 --- a/internal/format/testdata/markdown/table-OnlyProviders.golden +++ b/internal/format/testdata/markdown/table-OnlyProviders.golden @@ -3,6 +3,7 @@ | Name | Version | |------|---------| | tls | n/a | +| foo | >= 1.0 | | aws | >= 2.15.0 | | aws.ident | >= 2.15.0 | | null | n/a | \ No newline at end of file diff --git a/internal/format/testdata/markdown/table-OnlyRequirements.golden b/internal/format/testdata/markdown/table-OnlyRequirements.golden index 2e2afdc..f3742cb 100644 --- a/internal/format/testdata/markdown/table-OnlyRequirements.golden +++ b/internal/format/testdata/markdown/table-OnlyRequirements.golden @@ -4,4 +4,5 @@ |------|---------| | terraform | >= 0.12 | | aws | >= 2.15.0 | +| foo | >= 1.0 | | random | >= 2.2.0 | \ No newline at end of file diff --git a/internal/format/testdata/markdown/table-OnlyResources.golden b/internal/format/testdata/markdown/table-OnlyResources.golden index e3db822..dc1d5ff 100644 --- a/internal/format/testdata/markdown/table-OnlyResources.golden +++ b/internal/format/testdata/markdown/table-OnlyResources.golden @@ -2,5 +2,6 @@ | Name | Type | |------|------| +| foo_resource.baz | resource | | [null_resource.foo](https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource) | resource | | [tls_private_key.baz](https://registry.terraform.io/providers/hashicorp/tls/latest/docs/resources/private_key) | resource | \ No newline at end of file diff --git a/internal/format/testdata/markdown/table-WithAnchor.golden b/internal/format/testdata/markdown/table-WithAnchor.golden index 1d64b1d..a1aaacc 100644 --- a/internal/format/testdata/markdown/table-WithAnchor.golden +++ b/internal/format/testdata/markdown/table-WithAnchor.golden @@ -42,6 +42,7 @@ followed by another line of text. |------|---------| | [terraform](#requirement_terraform) | >= 0.12 | | [aws](#requirement_aws) | >= 2.15.0 | +| [foo](#requirement_foo) | >= 1.0 | | [random](#requirement_random) | >= 2.2.0 | ## Providers @@ -49,6 +50,7 @@ followed by another line of text. | Name | Version | |------|---------| | [tls](#provider_tls) | n/a | +| [foo](#provider_foo) | >= 1.0 | | [aws](#provider_aws) | >= 2.15.0 | | [aws.ident](#provider_aws.ident) | >= 2.15.0 | | [null](#provider_null) | n/a | @@ -66,6 +68,7 @@ followed by another line of text. | Name | Type | |------|------| +| foo_resource.baz | resource | | [null_resource.foo](https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource) | resource | | [tls_private_key.baz](https://registry.terraform.io/providers/hashicorp/tls/latest/docs/resources/private_key) | resource | | [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source | diff --git a/internal/format/testdata/markdown/table-WithRequired.golden b/internal/format/testdata/markdown/table-WithRequired.golden index 2f8905f..08ed2ee 100644 --- a/internal/format/testdata/markdown/table-WithRequired.golden +++ b/internal/format/testdata/markdown/table-WithRequired.golden @@ -42,6 +42,7 @@ followed by another line of text. |------|---------| | terraform | >= 0.12 | | aws | >= 2.15.0 | +| foo | >= 1.0 | | random | >= 2.2.0 | ## Providers @@ -49,6 +50,7 @@ followed by another line of text. | Name | Version | |------|---------| | tls | n/a | +| foo | >= 1.0 | | aws | >= 2.15.0 | | aws.ident | >= 2.15.0 | | null | n/a | @@ -66,6 +68,7 @@ followed by another line of text. | Name | Type | |------|------| +| foo_resource.baz | resource | | [null_resource.foo](https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource) | resource | | [tls_private_key.baz](https://registry.terraform.io/providers/hashicorp/tls/latest/docs/resources/private_key) | resource | | [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source | diff --git a/internal/format/testdata/markdown/table-WithoutHTML.golden b/internal/format/testdata/markdown/table-WithoutHTML.golden index 89ec195..6840055 100644 --- a/internal/format/testdata/markdown/table-WithoutHTML.golden +++ b/internal/format/testdata/markdown/table-WithoutHTML.golden @@ -42,6 +42,7 @@ followed by another line of text. |------|---------| | terraform | >= 0.12 | | aws | >= 2.15.0 | +| foo | >= 1.0 | | random | >= 2.2.0 | ## Providers @@ -49,6 +50,7 @@ followed by another line of text. | Name | Version | |------|---------| | tls | n/a | +| foo | >= 1.0 | | aws | >= 2.15.0 | | aws.ident | >= 2.15.0 | | null | n/a | @@ -66,6 +68,7 @@ followed by another line of text. | Name | Type | |------|------| +| foo_resource.baz | resource | | [null_resource.foo](https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource) | resource | | [tls_private_key.baz](https://registry.terraform.io/providers/hashicorp/tls/latest/docs/resources/private_key) | resource | | [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source | diff --git a/internal/format/testdata/markdown/table-WithoutHTMLWithAnchor.golden b/internal/format/testdata/markdown/table-WithoutHTMLWithAnchor.golden index 5988efd..dfaadf1 100644 --- a/internal/format/testdata/markdown/table-WithoutHTMLWithAnchor.golden +++ b/internal/format/testdata/markdown/table-WithoutHTMLWithAnchor.golden @@ -42,6 +42,7 @@ followed by another line of text. |------|---------| | [terraform](#requirement_terraform) | >= 0.12 | | [aws](#requirement_aws) | >= 2.15.0 | +| [foo](#requirement_foo) | >= 1.0 | | [random](#requirement_random) | >= 2.2.0 | ## Providers @@ -49,6 +50,7 @@ followed by another line of text. | Name | Version | |------|---------| | [tls](#provider_tls) | n/a | +| [foo](#provider_foo) | >= 1.0 | | [aws](#provider_aws) | >= 2.15.0 | | [aws.ident](#provider_aws.ident) | >= 2.15.0 | | [null](#provider_null) | n/a | @@ -66,6 +68,7 @@ followed by another line of text. | Name | Type | |------|------| +| foo_resource.baz | resource | | [null_resource.foo](https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource) | resource | | [tls_private_key.baz](https://registry.terraform.io/providers/hashicorp/tls/latest/docs/resources/private_key) | resource | | [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source | diff --git a/internal/format/testdata/pretty/pretty-Base.golden b/internal/format/testdata/pretty/pretty-Base.golden index 9f74c6f..4957b1b 100644 --- a/internal/format/testdata/pretty/pretty-Base.golden +++ b/internal/format/testdata/pretty/pretty-Base.golden @@ -39,10 +39,12 @@ followed by another line of text. requirement.terraform (>= 0.12) requirement.aws (>= 2.15.0) +requirement.foo (>= 1.0) requirement.random (>= 2.2.0) provider.tls +provider.foo (>= 1.0) provider.aws (>= 2.15.0) provider.aws.ident (>= 2.15.0) provider.null @@ -54,6 +56,7 @@ module.baz (baz,4.5.6) module.foobar (git@github.com:module/path,v7.8.9) +resource.foo_resource.baz (resource) resource.null_resource.foo (resource) (https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource) resource.tls_private_key.baz (resource) (https://registry.terraform.io/providers/hashicorp/tls/latest/docs/resources/private_key) data.aws_caller_identity.current (data source) (https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) diff --git a/internal/format/testdata/pretty/pretty-OnlyProviders.golden b/internal/format/testdata/pretty/pretty-OnlyProviders.golden index acad1f9..26c91a3 100644 --- a/internal/format/testdata/pretty/pretty-OnlyProviders.golden +++ b/internal/format/testdata/pretty/pretty-OnlyProviders.golden @@ -1,4 +1,5 @@ provider.tls +provider.foo (>= 1.0) provider.aws (>= 2.15.0) provider.aws.ident (>= 2.15.0) provider.null \ No newline at end of file diff --git a/internal/format/testdata/pretty/pretty-OnlyRequirements.golden b/internal/format/testdata/pretty/pretty-OnlyRequirements.golden index bf52a8f..8894b61 100644 --- a/internal/format/testdata/pretty/pretty-OnlyRequirements.golden +++ b/internal/format/testdata/pretty/pretty-OnlyRequirements.golden @@ -1,3 +1,4 @@ requirement.terraform (>= 0.12) requirement.aws (>= 2.15.0) +requirement.foo (>= 1.0) requirement.random (>= 2.2.0) \ No newline at end of file diff --git a/internal/format/testdata/pretty/pretty-OnlyResources.golden b/internal/format/testdata/pretty/pretty-OnlyResources.golden index 53632ca..a91e902 100644 --- a/internal/format/testdata/pretty/pretty-OnlyResources.golden +++ b/internal/format/testdata/pretty/pretty-OnlyResources.golden @@ -1,2 +1,3 @@ +resource.foo_resource.baz (resource) resource.null_resource.foo (resource) (https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource) resource.tls_private_key.baz (resource) (https://registry.terraform.io/providers/hashicorp/tls/latest/docs/resources/private_key) \ No newline at end of file diff --git a/internal/format/testdata/pretty/pretty-WithColor.golden b/internal/format/testdata/pretty/pretty-WithColor.golden index 891ad88..9d7fe4b 100644 --- a/internal/format/testdata/pretty/pretty-WithColor.golden +++ b/internal/format/testdata/pretty/pretty-WithColor.golden @@ -39,10 +39,12 @@ followed by another line of text. requirement.terraform (>= 0.12) requirement.aws (>= 2.15.0) +requirement.foo (>= 1.0) requirement.random (>= 2.2.0) provider.tls +provider.foo (>= 1.0) provider.aws (>= 2.15.0) provider.aws.ident (>= 2.15.0) provider.null @@ -54,6 +56,7 @@ followed by another line of text. module.foobar (git@github.com:module/path,v7.8.9) +resource.foo_resource.baz (resource) resource.null_resource.foo (resource) (https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource) resource.tls_private_key.baz (resource) (https://registry.terraform.io/providers/hashicorp/tls/latest/docs/resources/private_key) data.aws_caller_identity.current (data source) (https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) diff --git a/internal/format/testdata/toml/toml-Base.golden b/internal/format/testdata/toml/toml-Base.golden index cef684c..3141860 100644 --- a/internal/format/testdata/toml/toml-Base.golden +++ b/internal/format/testdata/toml/toml-Base.golden @@ -271,6 +271,11 @@ footer = "## This is an example of a footer\n\nIt looks exactly like a header, b alias = "" version = "" +[[providers]] + name = "foo" + alias = "" + version = ">= 1.0" + [[providers]] name = "aws" alias = "" @@ -294,10 +299,22 @@ footer = "## This is an example of a footer\n\nIt looks exactly like a header, b name = "aws" version = ">= 2.15.0" +[[requirements]] + name = "foo" + version = ">= 1.0" + [[requirements]] name = "random" version = ">= 2.2.0" +[[resources]] + type = "resource" + name = "baz" + provider = "foo" + source = "https://registry.acme.com/foo" + mode = "managed" + version = "latest" + [[resources]] type = "resource" name = "foo" diff --git a/internal/format/testdata/toml/toml-OnlyProviders.golden b/internal/format/testdata/toml/toml-OnlyProviders.golden index ba815b5..a5b1558 100644 --- a/internal/format/testdata/toml/toml-OnlyProviders.golden +++ b/internal/format/testdata/toml/toml-OnlyProviders.golden @@ -11,6 +11,11 @@ resources = [] alias = "" version = "" +[[providers]] + name = "foo" + alias = "" + version = ">= 1.0" + [[providers]] name = "aws" alias = "" diff --git a/internal/format/testdata/toml/toml-OnlyRequirements.golden b/internal/format/testdata/toml/toml-OnlyRequirements.golden index e30deff..6b53ca9 100644 --- a/internal/format/testdata/toml/toml-OnlyRequirements.golden +++ b/internal/format/testdata/toml/toml-OnlyRequirements.golden @@ -14,6 +14,10 @@ resources = [] name = "aws" version = ">= 2.15.0" +[[requirements]] + name = "foo" + version = ">= 1.0" + [[requirements]] name = "random" version = ">= 2.2.0" \ No newline at end of file diff --git a/internal/format/testdata/toml/toml-OnlyResources.golden b/internal/format/testdata/toml/toml-OnlyResources.golden index 7dd61aa..ec2319d 100644 --- a/internal/format/testdata/toml/toml-OnlyResources.golden +++ b/internal/format/testdata/toml/toml-OnlyResources.golden @@ -6,6 +6,14 @@ outputs = [] providers = [] requirements = [] +[[resources]] + type = "resource" + name = "baz" + provider = "foo" + source = "https://registry.acme.com/foo" + mode = "managed" + version = "latest" + [[resources]] type = "resource" name = "foo" diff --git a/internal/format/testdata/xml/xml-Base.golden b/internal/format/testdata/xml/xml-Base.golden index c9e2668..a61a110 100644 --- a/internal/format/testdata/xml/xml-Base.golden +++ b/internal/format/testdata/xml/xml-Base.golden @@ -291,6 +291,11 @@ + + foo + + >= 1.0 + aws @@ -316,12 +321,24 @@ aws >= 2.15.0 + + foo + >= 1.0 + random >= 2.2.0 + + resource + baz + foo + https://registry.acme.com/foo + managed + latest + resource foo diff --git a/internal/format/testdata/xml/xml-OnlyProviders.golden b/internal/format/testdata/xml/xml-OnlyProviders.golden index 6da7f3c..132017a 100644 --- a/internal/format/testdata/xml/xml-OnlyProviders.golden +++ b/internal/format/testdata/xml/xml-OnlyProviders.golden @@ -10,6 +10,11 @@ + + foo + + >= 1.0 + aws diff --git a/internal/format/testdata/xml/xml-OnlyRequirements.golden b/internal/format/testdata/xml/xml-OnlyRequirements.golden index 4f1803c..a122b13 100644 --- a/internal/format/testdata/xml/xml-OnlyRequirements.golden +++ b/internal/format/testdata/xml/xml-OnlyRequirements.golden @@ -14,6 +14,10 @@ aws >= 2.15.0 + + foo + >= 1.0 + random >= 2.2.0 diff --git a/internal/format/testdata/xml/xml-OnlyResources.golden b/internal/format/testdata/xml/xml-OnlyResources.golden index c8015da..4bdd544 100644 --- a/internal/format/testdata/xml/xml-OnlyResources.golden +++ b/internal/format/testdata/xml/xml-OnlyResources.golden @@ -7,6 +7,14 @@ + + resource + baz + foo + https://registry.acme.com/foo + managed + latest + resource foo diff --git a/internal/format/testdata/yaml/yaml-Base.golden b/internal/format/testdata/yaml/yaml-Base.golden index 2ee44f6..af1e057 100644 --- a/internal/format/testdata/yaml/yaml-Base.golden +++ b/internal/format/testdata/yaml/yaml-Base.golden @@ -250,6 +250,9 @@ providers: - name: tls alias: null version: null + - name: foo + alias: null + version: '>= 1.0' - name: aws alias: null version: '>= 2.15.0' @@ -264,9 +267,17 @@ requirements: version: '>= 0.12' - name: aws version: '>= 2.15.0' + - name: foo + version: '>= 1.0' - name: random version: '>= 2.2.0' resources: + - type: resource + name: baz + provider: foo + source: https://registry.acme.com/foo + mode: managed + version: latest - type: resource name: foo provider: "null" diff --git a/internal/format/testdata/yaml/yaml-OnlyProviders.golden b/internal/format/testdata/yaml/yaml-OnlyProviders.golden index 93ae90c..b659e67 100644 --- a/internal/format/testdata/yaml/yaml-OnlyProviders.golden +++ b/internal/format/testdata/yaml/yaml-OnlyProviders.golden @@ -7,6 +7,9 @@ providers: - name: tls alias: null version: null + - name: foo + alias: null + version: '>= 1.0' - name: aws alias: null version: '>= 2.15.0' diff --git a/internal/format/testdata/yaml/yaml-OnlyRequirements.golden b/internal/format/testdata/yaml/yaml-OnlyRequirements.golden index e7e51c3..44145f3 100644 --- a/internal/format/testdata/yaml/yaml-OnlyRequirements.golden +++ b/internal/format/testdata/yaml/yaml-OnlyRequirements.golden @@ -9,6 +9,8 @@ requirements: version: '>= 0.12' - name: aws version: '>= 2.15.0' + - name: foo + version: '>= 1.0' - name: random version: '>= 2.2.0' resources: [] \ No newline at end of file diff --git a/internal/format/testdata/yaml/yaml-OnlyResources.golden b/internal/format/testdata/yaml/yaml-OnlyResources.golden index 69275ae..02e2a0d 100644 --- a/internal/format/testdata/yaml/yaml-OnlyResources.golden +++ b/internal/format/testdata/yaml/yaml-OnlyResources.golden @@ -6,6 +6,12 @@ outputs: [] providers: [] requirements: [] resources: + - type: resource + name: baz + provider: foo + source: https://registry.acme.com/foo + mode: managed + version: latest - type: resource name: foo provider: "null"