hashicorp / hashicorp/terraform-plugin-codegen-framework

Support `timeouts` attribute from the codegen framework

Open
#143 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Go
Stars
57
Forks
29
Avg merge
2d 13h
Merged PRs (30d)
1

Description

### Use Cases or Problem Statement

Terraform lets you set `timeouts` in your resource configuration. However, the Terraform Plugin Codegen Framework doesn't have a way to add `timeouts` in the `provider_code_spec.json` file. This means the framework can't generate code that looks like [this](https://developer.hashicorp.com/terraform/plugin/framework/resources/timeouts#attribute):

```go
func (t *exampleResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) {
resp.Schema = schema.Schema{
Attributes: map[string]schema.Attribute{
/* ... */
"timeouts": timeouts.Attributes(ctx, timeouts.Opts{
Create: true,
}),
},
```

I don't think the framework has built-in support for `timeouts`. I'm curious if there is an alternative approach or workaround that would allow me to include `timeouts`. Is it possible to use dynamic types, object types, or any other method to read `timeouts` value from the resource definition?

### Proposal

Modify [JSON schema](https://github.com/hashicorp/terraform-plugin-codegen-spec/blob/main/spec/v0.1/schema.json) to include special `timeouts` type.

### Additional Information

_No response_

### Code of Conduct

- [X] I agree to follow this project's Code of Conduct

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.