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

timeouts.Block causes error in modify plan set #14

Closed
1 task done
gdavison opened this issue Nov 22, 2022 · 2 comments · Fixed by hashicorp/terraform-plugin-framework#552
Closed
1 task done
Labels
bug Something isn't working

Comments

@gdavison
Copy link

Terraform CLI and Framework Versions

github.com/hashicorp/terraform-plugin-framework v0.16.0
github.com/hashicorp/terraform-plugin-framework-timeouts v0.2.0

Terraform Plugin Framework Code

func (r *resourceTable) GetSchema(ctx context.Context) (tfsdk.Schema, diag.Diagnostics) {
	schema := tfsdk.Schema{
		Attributes: map[string]tfsdk.Attribute{
			// ...
		},
		Blocks: map[string]tfsdk.Block{
			// ...
			"timeouts": timeouts.Block(ctx, timeouts.Opts{
				Create: true,
				Update: true,
				Delete: true,
			}),
		},
		Version: 1,
	}

	return schema, nil
}

Terraform Configuration

resource "aws_dynamodb_table" "test" {
  name           = "test"
  read_capacity  = 1
  write_capacity = 1
  hash_key       = "test"

  attribute {
    name = "test"
    type = "S"
  }
}

Expected Behavior

In a debugging session or provider acceptance tests, I should reach the Create function

Actual Behavior

I get an error like

Error running pre-apply refresh: …
Error: Error modifying plan …
AttributeName(“timeouts”): couldn’t find attribute in resource schema: path leads to block, not an attribute

when running provider acceptance tests

Steps to Reproduce

Run provider acceptance test

Logs

No response

Additional Information

I am trying to port the AWS Provider resource aws_dynamodb_table, so we have to use the Block version of the timeouts.

Code of Conduct

  • I agree to follow this project's Code of Conduct
@bendbennett
Copy link
Contributor

Hey Graham 👋

Sorry for the delay in getting to this and apologies that you ran into an issue here.

I've opened a PR to Amend Plan Resource Change To Allow For Optional Blocks on terraform-plugin-framework to address this but will judge from the feedback as to whether the proposed fix is acceptable.

@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.

2 participants