Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: hashicorp/terraform-plugin-docs
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.19.1
Choose a base ref
...
head repository: hashicorp/terraform-plugin-docs
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v0.19.2
Choose a head ref
  • 4 commits
  • 8 files changed
  • 3 contributors

Commits on Apr 26, 2024

  1. migrate: Ensure idempotency when ran multiple times (#364)

    Reference: #362
    
    To reproduce, copied an existing test case and ensured the test script included multiple `exec tfplugindocs migrate` invocations. This generated a test failure matching the bug report:
    
    ```
    --- FAIL: Test_SchemaJson_MigrateAcceptanceTests (0.00s)
        --- FAIL: Test_SchemaJson_MigrateAcceptanceTests/time_provider_multiple_runs (0.32s)
            testscript.go:558: # Copyright (c) HashiCorp, Inc.
                # SPDX-License-Identifier: MPL-2.0
                # Multiple runs of tfplugindocs -migrate to verify idempotency (0.000s)
                # Run migrate command (0.301s)
                # Check template files (0.000s)
                > cmpenv templates/index.md.tmpl exp-templates/index.md.tmpl
                diff templates/index.md.tmpl exp-templates/index.md.tmpl
                --- templates/index.md.tmpl
                +++ exp-templates/index.md.tmpl
                @@ -31,36 +31,3 @@
                 `triggers` are *not* treated as sensitive attributes; a value used for `triggers` will be displayed in Terraform UI output as plaintext.
    
                 To force a these actions to reoccur without updating `triggers`, the [`terraform taint` command](https://www.terraform.io/docs/commands/taint.html) can be used to produce the action on the next run.
                ----
                -page_title: "Provider: Time"
                -description: |-
                -  The time provider is used to interact with time-based resources.
                ----
                -
                -{{/* This template serves as a starting point for documentation generation, and can be customized with hardcoded values and/or doc gen templates.
                -
                -For example, the {{ .SchemaMarkdown }} template can be used to replace manual schema documentation if descriptions of schema attributes are added in the provider source code. */ -}}
                -
                -# Time Provider
                -
                -The time provider is used to interact with time-based resources. The provider itself has no configuration options.
                -
                -Use the navigation to the left to read about the available resources.
                -
                -## Resource "Triggers"
                -
                -Certain time resources, only perform actions during specific lifecycle actions:
                -
                -- `time_offset`: Saves base timestamp into Terraform state only when created.
                -- `time_sleep`: Sleeps when created and/or destroyed.
                -- `time_static`: Saves base timestamp into Terraform state only when created.
                -
                -These resources provide an optional map argument called `triggers` that can be populated with arbitrary key/value pairs. When the keys or values of this argument are updated, Terraform will re-perform the desired action, such as updating the base timestamp or sleeping again.
                -
                -For example:
                -
                -{{tffile "examples/example_1.tf"}}
                -
                -`triggers` are *not* treated as sensitive attributes; a value used for `triggers` will be displayed in Terraform UI output as plaintext.
                -
                -To force a these actions to reoccur without updating `triggers`, the [`terraform taint` command](https://www.terraform.io/docs/commands/taint.html) can be used to produce the action on the next run.
    
                FAIL: testdata/scripts/schema-json/migrate/time_provider_multiple_runs.txtar:13: templates/index.md.tmpl and exp-templates/index.md.tmpl differ
    ```
    
    To fix this, changed the internal logic from opening the template file multiple times with `os.O_APPEND` to opening the template file once with only `os.O_WRONLY|os.O_CREATE` and passing the file handle around instead.
    bflad authored Apr 26, 2024
    Configuration menu
    Copy the full SHA
    8a55c41 View commit details
    Browse the repository at this point in the history
  2. generate: Prevent automatic id attribute behaviors under blocks (#365)

    Reference: #335
    
    Previously, the automatic `id` attribute handling intended for root level schema blocks was applied to all blocks, causing the generator to errantly set the grouping to `Read-Only` and the description to `The ID of this resource`. This was captured via a new integration test:
    
    ```
    --- FAIL: Test_SchemaJson_GenerateAcceptanceTests (0.00s)
        --- FAIL: Test_SchemaJson_GenerateAcceptanceTests/nested_id_attribute (0.25s)
            testscript.go:558: # Copyright (c) HashiCorp, Inc.
                # SPDX-License-Identifier: MPL-2.0
                # Ensure only root level id attribute receives automatic description (0.236s)
                > [!unix] skip
                > exec tfplugindocs --provider-name=terraform-provider-scaffolding --providers-schema=schema.json
                [stdout]
                rendering website for provider "terraform-provider-scaffolding" (as "terraform-provider-scaffolding")
                exporting schema from JSON file
                getting provider schema
                generating missing templates
                generating missing resource content
                generating new template for "scaffolding_example"
                generating missing data source content
                generating missing function content
                generating missing provider content
                generating new template for "terraform-provider-scaffolding"
                rendering static website
                cleaning rendered website dir
                rendering templated website to static markdown
                rendering "index.md.tmpl"
                rendering "resources/example.md.tmpl"
                > cmp stdout expected-output.txt
                > cmp docs/index.md expected-index.md
                > cmp docs/resources/example.md expected-resource.md
                diff docs/resources/example.md expected-resource.md
                --- docs/resources/example.md
                +++ expected-resource.md
                @@ -48,17 +48,17 @@
                 <a id="nestedblock--list_nested_block_optional_id"></a>
                 ### Nested Schema for `list_nested_block_optional_id`
    
                -Read-Only:
                -
                -- `id` (String) The ID of this resource.
                +Optional:
                +
                +- `id` (String)
    
                 <a id="nestedblock--list_nested_block_required_id"></a>
                 ### Nested Schema for `list_nested_block_required_id`
    
                -Read-Only:
                -
                -- `id` (String) The ID of this resource.
                +Required:
                +
                +- `id` (String)
    
                 <a id="nestedatt--optional_object_attribute"></a>
                @@ -72,33 +72,33 @@
                 <a id="nestedblock--set_nested_block_optional_id"></a>
                 ### Nested Schema for `set_nested_block_optional_id`
    
                -Read-Only:
                -
                -- `id` (String) The ID of this resource.
                +Optional:
                +
                +- `id` (String)
    
                 <a id="nestedblock--set_nested_block_required_id"></a>
                 ### Nested Schema for `set_nested_block_required_id`
    
                -Read-Only:
                -
                -- `id` (String) The ID of this resource.
                +Required:
                +
                +- `id` (String)
    
                 <a id="nestedblock--single_nested_block_optional_id"></a>
                 ### Nested Schema for `single_nested_block_optional_id`
    
                -Read-Only:
                -
                -- `id` (String) The ID of this resource.
                +Optional:
                +
                +- `id` (String)
    
                 <a id="nestedblock--single_nested_block_required_id"></a>
                 ### Nested Schema for `single_nested_block_required_id`
    
                -Read-Only:
                -
                -- `id` (String) The ID of this resource.
                +Required:
                +
                +- `id` (String)
    
                 <a id="nestedatt--computed_object_attribute"></a>
                @@ -114,7 +114,7 @@
    
                 Read-Only:
    
                -- `id` (String) The ID of this resource.
                +- `id` (String)
    
                 <a id="nestedblock--set_nested_block_computed_id"></a>
                @@ -122,7 +122,7 @@
    
                 Read-Only:
    
                -- `id` (String) The ID of this resource.
                +- `id` (String)
    
                 <a id="nestedblock--single_nested_block_computed_id"></a>
                @@ -130,4 +130,4 @@
    
                 Read-Only:
    
                -- `id` (String) The ID of this resource.
                +- `id` (String)
    
                FAIL: testdata/scripts/schema-json/generate/nested_id_attribute.txtar:9: docs/resources/example.md and expected-resource.md differ
    ```
    
    The schema rendering logic could likely use a full refactoring as it has very high code complexity, but this change is only a very targeted fix for the acute and errant `id` attribute handling behavior.
    bflad authored Apr 26, 2024
    Configuration menu
    Copy the full SHA
    14eebdd View commit details
    Browse the repository at this point in the history
  3. Bump github.com/yuin/goldmark from 1.7.0 to 1.7.1 (#353)

    Bumps [github.com/yuin/goldmark](https://github.com/yuin/goldmark) from 1.7.0 to 1.7.1.
    - [Release notes](https://github.com/yuin/goldmark/releases)
    - [Commits](yuin/goldmark@v1.7.0...v1.7.1)
    
    ---
    updated-dependencies:
    - dependency-name: github.com/yuin/goldmark
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Apr 26, 2024
    Configuration menu
    Copy the full SHA
    308f0fc View commit details
    Browse the repository at this point in the history

Commits on Apr 29, 2024

  1. Configuration menu
    Copy the full SHA
    fc2fdc0 View commit details
    Browse the repository at this point in the history
Loading