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

Show 'providers' information #140

Merged
merged 2 commits into from
Jan 3, 2020
Merged

Conversation

khos2ow
Copy link
Member

@khos2ow khos2ow commented Jan 2, 2020

Prerequisites

Put an x into the box(es) that apply:

  • This pull request fixes a bug.
  • This pull request adds a feature.
  • This pull request enhances existing functionality.
  • This pull request introduces breaking change.

For more information, see the Contributing Guide.

Description

This PR adds new functionality to show providers information. This was originally added in #113 by @moatra which we decided to introduce it in its own PR for the sake of cleaner history.

Issues Resolved

List any existing issues this pull request resolves.

Checklist

Put an x into all boxes that apply:

Tests

  • I have added tests to cover my changes.
  • All tests pass when I run make test.

Documentation

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

Code Style

  • My code follows the code style of this project.

@metmajer
Copy link
Member

metmajer commented Jan 2, 2020

@khos2ow should we display provider information optionally?

@khos2ow
Copy link
Member Author

khos2ow commented Jan 2, 2020

I think after a little while showing provider information will become mainstream, and instead of opt-in approach I had thought to add new flags for opt-out approach, --no-providers, --no-inputs, --no-outputs. What do you think?

Originally-Authored-By: Thomas Alton <thomas.alton@gmail.com>
Original-Pull-Request: terraform-docs#113
@metmajer
Copy link
Member

metmajer commented Jan 3, 2020

@khos2ow I like that approach! That will create a breaking change in how things are displayed, and we should be 1) transparent about this in the release documentation and 2) ping our power users.

@khos2ow khos2ow merged commit ce32bf1 into terraform-docs:master Jan 3, 2020
@khos2ow khos2ow deleted the providers branch January 3, 2020 23:33
@crisp2u
Copy link

crisp2u commented Jan 6, 2020

Guys, how is this supposed to work ? I guess it will show the same output as Providers Requirements section from terraform-config-inspect ? Or terraform providers ? Can you provide some examples based on the test data ?

@khos2ow
Copy link
Member Author

khos2ow commented Jan 6, 2020

@crisp2u it looks for required_providers but it's not the only way to look for the providers, we're also looking for all the managed and data resources to discover the providers (module.go#134).

Also you can find the generated content here based on our example.

resource "tls_private_key" "baz" {}

data "aws_caller_identity" "current" {
  provider = "aws"
}
data "aws_caller_identity" "ident" {
  provider = "aws.ident"
}
terraform {
  required_providers {
    aws = ">= 2.15.0"
  }
}
resource "null_resource" "foo" {}

will generate

 ## Providers

| Name | Version |
|------|---------|
| aws | >= 2.15.0 |
| aws.ident | >= 2.15.0 |
| null | n/a |
| tls | n/a |

@crisp2u
Copy link

crisp2u commented Jan 6, 2020

Thanks for the examples pointer. I'm getting some weird output from my code but i'll try to isolate it and come back with some info

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants