Skip to content

Investigate and Determine Computed-Only Block Behavior #214

@bflad

Description

@bflad

Module version

v0.4.2

Description

If/when block support is implemented (see also: #85), there may need to be an investigation into how Computed only blocks (or more technically accurate, where all block attributes are Computed only) are documented or otherwise supported by the framework.

In Terraform Plugin SDK version 2, there is special logic that automatically applied to Computed-only blocks that converts them into attributes:

https://github.com/hashicorp/terraform-plugin-sdk/blob/9dad6ed9dc7845584ce20f1116c02a10863b1900/helper/schema/core_schema.go#L96-L101

While this has its own issues (see also: hashicorp/terraform-plugin-sdk#201) and likely would not be done in this framework since its design tends to avoid such unexpected abstraction/behavior changes, something may need to be done to prevent Terraform CLI "inconsistent results after apply" errors, if they occur, whether that be additional documentation, helpers, or other handling by the framework.

Definition of Done

terraform-provider-corner may be the most appropriate place to capture end-to-end testing scenarios, since any potential error would occur in Terraform CLI.

  • Create a resource schema that contains a list block with Computed only attributes (replicate for set blocks as well)
    • Verify not setting state does not return an error
    • Verify setting 1 list element with attributes does not return an error
    • Verify setting 2+ list elements with attributes does not return an error
    • Create a resource schema that contains a list block with a list block (nested block) with Computed only attributes (replicate for nested set blocks as well)
    • Verify not setting state does not return an error
    • Verify setting 1 list element with attributes does not return an error
    • Verify setting 2+ list elements with attributes does not return an error
  • If an error is returned in any of these cases, framework maintainers determine next course of action and create further issues as appropriate for documentation, helpers, other handling in the framework, etc.

Metadata

Metadata

Labels

sdkv2-parityIssues tracking feature parity with terraform-plugin-sdk v2 and PRs working towards it.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions