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 for computed non-optional properties #325

Open
2 tasks
arjunrajshekhar opened this issue Jan 28, 2022 · 0 comments
Open
2 tasks

Support for computed non-optional properties #325

arjunrajshekhar opened this issue Jan 28, 2022 · 0 comments

Comments

@arjunrajshekhar
Copy link

arjunrajshekhar commented Jan 28, 2022

Is your feature request related to a problem?

Assigning a property on a request/response model on the swagger spec as readOnly: true converts that property into an Optional: true and Computed: true property.

There doesn't appear to be any way to set a property with just Computed: true.

Example:

With the swaggercodegen example, run terraform providers schema -json

The computed input property for the swaggercodegen_cdn_v1 resource is marked as computed and optional

//.....
"computed": {
    "type": "string",
    "description_kind": "plain",
    "optional": true,
    "computed": true
  },
//.....

Describe the solution you'd like

It would be useful to have a method to mark a property as computed-only. Usually these would be readOnly properties from the swagger spec, but it looks like that's reserved for computed+optional properties, so perhaps an additional custom x-terraform-* field would be useful.

Acceptance criteria

The plugin has some means by which a non-optional computed property can be created on the output schema.

Additional context

The reason I have requested this is because I am looking to auto-generate terraform registry docs using the terraform-plugin-docs tool, and the fields that should be under the "Read Only" section appear under "Optional" instead, which doesn't really make sense for properties that are meant to only be read.

Semantically, a non-optional computed is the equivalent to a required readonly supported by OpenAPI v3, which is for properties you are guaranteed to see on a response.

Checklist (for admin only)

Don't forget to go through the checklist to make sure the issue is created properly:

  • I have added a corresponding label (feature request) to the issue (right side menu)
  • I have added this issue to the 'API Terraform Provider' GitHub project (right side menu)
@arjunrajshekhar arjunrajshekhar changed the title readOnly becomes optional computed instead of computed Support for computed only properties Jan 28, 2022
@arjunrajshekhar arjunrajshekhar changed the title Support for computed only properties Support for computed-only properties Jan 28, 2022
@arjunrajshekhar arjunrajshekhar changed the title Support for computed-only properties Support for computed non-optional properties Jan 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant