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

Amend Plan Resource Change To Allow For Optional Blocks #551

Closed
bendbennett opened this issue Nov 28, 2022 · 1 comment · Fixed by #552
Closed

Amend Plan Resource Change To Allow For Optional Blocks #551

bendbennett opened this issue Nov 28, 2022 · 1 comment · Fixed by #552
Labels
bug Something isn't working

Comments

@bendbennett
Copy link
Contributor

Module version

v0.16.0

Relevant provider source code

The issue is described in more detail in timeouts.Block causes error in modify plan set.

Briefly, defining a block within the schema, in this instance, for timeouts and then omitting timeouts from configuration generates an error.

func (e *exampleResource) GetSchema(ctx context.Context) (tfsdk.Schema, diag.Diagnostics) {
	return tfsdk.Schema{
		/*...*/        
		Blocks: map[string]tfsdk.Block{
			"timeouts": timeouts.Block(
				ctx,
				timeouts.Opts{
					Create: true,
					Update: true,
					Delete: true,
				},
			),
		},
	}, nil
}

Terraform Configuration Files

resource "example_resource" "example" {
}

Debug Output

https://gist.github.com/bendbennett/8a9ecd46848abc0aaeebf47129fd2a14

Expected Behavior

terraform apply should have run successfully

Actual Behavior

The following error is generated:

│ Error: Error modifying plan
│ 
│   with playground_resource.example,
│   on resource.tf line 9, in resource "playground_resource" "example":
│    9: resource "playground_resource" "example" {
│ 
│ There was an unexpected error updating the plan. This is always a problem with the provider. Please report the following to the provider developer:
│ 
│ AttributeName("timeouts"): couldn't find attribute in resource schema: path leads to block, not an attribute

Steps to Reproduce

Using the schema and configuration listed above and running terraform apply should be sufficient to reproduce the issue.

References

@bendbennett bendbennett added the bug Something isn't working label Nov 28, 2022
bendbennett added a commit that referenced this issue Nov 28, 2022
…ional blocks to be present within configuration (#551)
bflad pushed a commit that referenced this issue Nov 28, 2022
Reference: #551

Modifying handling of blocks during plan resource change to allow optional blocks to be present within configuration
@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 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant