Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some providers are shown, but others are not. And local execution does not match CI execution. #765

Open
aamkye opened this issue Apr 10, 2024 · 0 comments
Labels

Comments

@aamkye
Copy link

aamkye commented Apr 10, 2024

Describe the bug

GitHub Provider:

terraform {
  required_version = ">= 1.8.0, < 2.0.0"
  cloud {
    organization = "XXX"

    workspaces {
      name = "gh-terraform"
    }
  }

  required_providers {
    github = {
      source  = "integrations/github"
      version = "~> 6.0"
    }
  }
}

provider "github" {
  owner = "XXX"
  app_auth {}
}

Generates:

## Providers

No providers.

## Requirements

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.8.0, < 2.0.0 |
| <a name="requirement_github"></a> [github](#requirement\_github) | ~> 6.0 |

...

And now the fun part starts:

TFE Provider:

terraform {
  required_version = ">= 1.8.0, < 2.0.0"
  cloud {
    organization = "XXX"

    workspaces {
      name = "cloud-terraform"
    }
  }

  required_providers {
    tfe = {
      source  = "hashicorp/tfe"
      version = "~> 0.53"
    }
  }
}

provider "tfe" {
  organization = "XXX"
}

Generates:

## Providers

| Name | Version |
|------|---------|
| <a name="provider_tfe"></a> [tfe](#provider\_tfe) | 0.53.0 |

## Requirements

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.8.0, < 2.0.0 |
| <a name="requirement_tfe"></a> [tfe](#requirement\_tfe) | ~> 0.53.0 |

I'd expect some consistency here 😅.

What is even more interesting, CI thinks differently than local and fails with:

...

All changes made by hooks:
diff --git a/cloud_terraform/readme.md b/cloud_terraform/readme.md
index 67aeb0d..fbac005 100644
--- a/cloud_terraform/readme.md
+++ b/cloud_terraform/readme.md
@@ -5,7 +5,7 @@
 
 | Name | Version |
 |------|---------|
-| <a name="provider_tfe"></a> [tfe](#provider\_tfe) | 0.53.0 |
+| <a name="provider_tfe"></a> [tfe](#provider\_tfe) | ~> 0.53.0 |
 
 ## Requirements

How can we reproduce it?

I think you could use the attached snippets.

+ config:

formatter: "markdown table" # this is required
version: "0.17"
# header-from: ""
# footer-from: ""
recursive:
  enabled: false
  path: ""
sections:
  hide: []
  show: []

content: |-
  {{ .Providers }}

  {{ .Requirements }}

  {{ .Resources }}

  {{ .Inputs }}

  {{ .Modules }}

  {{ .Outputs }}
output:
  file: readme.md
  mode: inject
  template: |-
    <!-- BEGIN_AUTOMATED_CLOUD_TF_DOCS_BLOCK -->
    {{ .Content }}
    <!-- END_AUTOMATED_CLOUD_TF_DOCS_BLOCK -->
output-values:
  enabled: false
  from: ""
sort:
  enabled: true
  by: name
settings:
  anchor: true
  color: true
  default: true
  description: true
  escape: true
  hide-empty: false
  html: true
  indent: 2
  lockfile: true
  read-comments: true
  required: true
  sensitive: true
  type: true

Environment information

> terraform-docs --version
terraform-docs version v0.17.0 darwin/arm64

+ version used in CI: https://github.com/terraform-docs/terraform-docs/releases/download/v0.17.0/terraform-docs-v0.17.0-linux-amd64.tar.gz

@aamkye aamkye added the bug label Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant