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

Support Block Plan Modification #222

Closed
Tracked by #158
bflad opened this issue Nov 2, 2021 · 1 comment · Fixed by #224
Closed
Tracked by #158

Support Block Plan Modification #222

bflad opened this issue Nov 2, 2021 · 1 comment · Fixed by #224
Assignees
Labels
enhancement New feature or request schema Issues and pull requests about the abstraction for specifying schemas.
Milestone

Comments

@bflad
Copy link
Contributor

bflad commented Nov 2, 2021

Module version

v0.4.2

Use-cases

The initial block support of #85 may not contain plan modification support for the block itself or underlying attributes to reduce the complexity of first round code changes. This support should be added for parity with attributes and to prevent provider developer confusion.

Proposal

Add PlanModifiers field to the Block type and wire with schema plan modification. Ensure each Attribute under Block.Attributes properly handles their PlanModifiers field.

@bflad bflad added enhancement New feature or request schema Issues and pull requests about the abstraction for specifying schemas. labels Nov 2, 2021
bflad added a commit that referenced this issue Nov 3, 2021
Reference: #85

The primary purpose for supporting blocks is to allow previously existing schemas defined by the older Terraform Plugin SDK to not require practitioner breaking changes upon migrating to the framework (except the protocol version and therefore the minimum Terraform CLI version unless a tfprotov5 server implementation is added to this framework as well). This also allows this framework to be muxed with the older framework since the provider schema must match. It is expected that over time any schema definitions including `Blocks` will migrate to `Attributes`.

Provider developers should always opt for `Attributes` in new schema definitions.

One notable exclusion to this initial block support is plan modification, both with attributes under blocks and blocks themselves. Support for this functionality can be tracked in #222.
@bflad bflad self-assigned this Nov 3, 2021
@bflad bflad added this to the v0.5.0 milestone Nov 3, 2021
bflad added a commit that referenced this issue Nov 11, 2021
Reference: #222

Adds `PlanModifiers` within `Block`s and ensures any children attribute and block plan modifiers of a `Block` are executed.

The dual response parameter pattern is twofold necessary, or rather a simpler implementation, due to the current details:

*  `AttributePlanModifier`s return a `RequiresReplace` boolean, which the caller is responsible for setting the proper attribute path for the overall schema response.
* `AttributePlanModifier`s return `AttributePlan` as an `attr.Value`, which cannot be directly set into a parent value without reimplementing all the `SetAttribute()` logic for handling nil/null/unknown values, so it is left to the caller to properly call `(Plan).SetAttribute()` in the schema response.
bflad added a commit that referenced this issue Nov 19, 2021
Reference: #222

Adds `PlanModifiers` within `Block`s and ensures any children attribute and block plan modifiers of a `Block` are executed.
@github-actions
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 20, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request schema Issues and pull requests about the abstraction for specifying schemas.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant