You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
terraform {
required_version =">= 1.3.0"required_providers {
aws = {
source ="hashicorp/aws"
version ="~> 5"
}
}
}
data"aws_caller_identity""current" {}
output"user" {
description ="The current user's ARN"
value =data.aws_caller_identity.current.arn
}
Once all those are in place, run pre-commit run --all
$ pre-commit run --all
Terraform fmt............................................................Passed
Terraform validate.......................................................Passed
Terraform docs...........................................................Passed
And the following README.md's are created:
README.md
# readme_error<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->## Requirements| Name | Version ||------|---------|| <aname="requirement_terraform"></a> [terraform](#requirement\_terraform)| >= 1.3.0 || <aname="requirement_aws"></a> [aws](#requirement\_aws)|~> 5 |## Providers
No providers.
## Modules| Name | Source | Version ||------|--------|---------|| <aname="module_readme_error_maker"></a> [readme\_error\_maker](#module\_readme\_error\_maker)| ./modules/readme_error_maker | n/a |## Resources
No resources.
## Inputs
No inputs.
## Outputs| Name | Description ||------|-------------|| <aname="output_user"></a> [user](#output\_user)| User |<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
and modules/readme_error_maker/README.md
# readme_error_maker<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->## Requirements| Name | Version ||------|---------|| <aname="requirement_terraform"></a> [terraform](#requirement\_terraform)| >= 1.3.0 || <aname="requirement_aws"></a> [aws](#requirement\_aws)|~> 5 |## Providers| Name | Version ||------|---------|| <aname="provider_aws"></a> [aws](#provider\_aws)|~> 5 |## Modules
No modules.
## Resources| Name | Type ||------|------||[aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity)| data source |## Inputs
No inputs.
## Outputs| Name | Description ||------|-------------|| <aname="output_user"></a> [user](#output\_user)| The current user's ARN |<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
If I remove both README.mds, and run terraform-docs markdown table . --recursive --output-file README.md instead:
then the only difference is the block markers are now <-- BEGIN_TF_DOCS --> / <-- END_TF_DOCS --> and no heading line. The rest of the content is the same.
Environment information
$ terraform-docs --version
terraform-docs version v0.16.0 darwin/amd64
$ go version
go version go1.18.4 darwin/amd64
All on MacOS. NOTE: I'm not compiling my own version of terraform-docs.
The text was updated successfully, but these errors were encountered:
Describe the bug
We have multiple repos for different microservices and all of them use pre-commit with terraform-docs setup as:
No special options regarding the overriding of terraform-docs.
Our provider setups are per project, and will include different providers, but all will be AWS at v5:
The lock file is also present and always has a single version for the provider:
But, depending upon the repo, the output in the README is different.
This project is TF and AWS only with root tf files managing resources.
This project is uses the same providers, but all in modules. Nothing is in the root module.
I've tried with and without
--lockfile=true
(both on theterraform-docs
command line and via pre-commit's- --arg=--lockfile=true
).How can we reproduce it?
Several files are needed. Hopefully enough here to make sense.
.terraform-version
(used by tfenv if you are using that - not required otherwise).terraform.lock.hcl
(I'm not sure how much of the content of this file is required, but here it is).pre-commit-config.yaml
make_error.tf
modules/readme_error_maker/main.tf
Once all those are in place, run
pre-commit run --all
And the following
README.md
's are created:README.md
and
modules/readme_error_maker/README.md
If I remove both
README.md
s, and runterraform-docs markdown table . --recursive --output-file README.md
instead:then the only difference is the block markers are now
<-- BEGIN_TF_DOCS -->
/<-- END_TF_DOCS -->
and no heading line. The rest of the content is the same.Environment information
All on MacOS. NOTE: I'm not compiling my own version of terraform-docs.
The text was updated successfully, but these errors were encountered: