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

Add option --with-aggregate-type-defaults to enable printing of default values for types 'list' and 'map'. #53

Merged
merged 5 commits into from
Sep 23, 2018

Conversation

metmajer
Copy link
Member

@metmajer metmajer commented Jul 25, 2018

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 introduces breaking change.

For more information, see the Contributing Guide.

Description

This pull request adds the --with-aggregate-type-defaults option to enable printing of default values for types 'list' and 'map'. If enabled, default values of aggregate types are presented as JSON data structures.

The pull request introduces a breaking change. The data type doc.Value has its property Literal changed to Value. This shouldn't affect you're making use of terraform-docs json, where this change is reflected in the resulting output.

The following example shows the processing of a Terraform variable of type map:

variable "foo" {
  default = {
    bar = 1
    baz = "two"
  }

  description = "Some variable named 'foo'."
  type = "map"
}
$ terraform-docs json .

[…]
{
  "Name": "foo",
  "Description": "Some variable named 'foo'.",
  "Default": {
    "Type": "map",
    "Value": {
      "bar": 1,
      "baz": "two"
    }
  },
  "Type": "map"
}
[…]
$ terraform-docs md .
Name Description Type Default Required
foo Some variable named 'foo'. map { "bar": 1, "baz": "two" } no
$ terraform-docs .

[…]
var.foo ({ "bar": 1, "baz": "two" })
Some variable named 'foo'.
[…]

Issues Resolved

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 Author

metmajer commented Aug 9, 2018

@yields with the number of pull requests being open since a longer time now, is this project still maintained?

@yields
Copy link
Contributor

yields commented Aug 9, 2018

We use it heavily in segment, however, since I've moved teams I no longer personally use this.
I'll review the PRs over the weekend, sorry about the delay here!

@metmajer
Copy link
Member Author

I think it's a wonderful tool and at @getcloudnative, we plan to make heavy use of it as well. Let me know if you want to welcome an additional maintainer.

@metmajer
Copy link
Member Author

metmajer commented Aug 20, 2018

@boggsboggs I am referring to your recent commit 7110697, indicating that this repo is currently unmaintained. I am willing to step in as a maintainer or have maintenance transferred over to https://github.com/getcloudnative/terraform-docs. Please let me know if either works for you.

@metmajer metmajer mentioned this pull request Sep 3, 2018
@boggsboggs
Copy link
Contributor

@metmajer I'd love to take you up on your offer to become a maintainer for this project. I need to talk to legal and security here to see what process I need to follow to add you as a collaborator on the project. That's taking a little while... thanks for your patience.

@boggsboggs
Copy link
Contributor

Thanks for your patience @metmajer. You're a collaborator with write access to the repo now. I've updated the Readme to reference you and your work and explain the maintenance arrangement to users: https://github.com/segmentio/terraform-docs#maintenance

@metmajer
Copy link
Member Author

metmajer commented Sep 12, 2018

@boggsboggs Thanks for making this happen. In order to properly maintain this project for @segmentio, I request admin access to this repository so that I can enlarge the maintenance team if needed. You can reach out to me via metmajer@getcloudnative.io. Thanks!

@metmajer metmajer changed the title Add support for default values for variable types list and map. Add option --with-aggregate-type-defaults to enable printing of default values for types 'list' and 'map'. Sep 23, 2018
@metmajer metmajer merged commit 721386d into terraform-docs:master Sep 23, 2018
@metmajer metmajer deleted the extract-default-values branch September 27, 2018 07:18
@metmajer metmajer restored the extract-default-values branch September 27, 2018 07:18
@metmajer metmajer deleted the extract-default-values branch October 1, 2018 09:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants