Skip to content

Commit

Permalink
[Internal] Generate models with correctly computed annotations (#4316)
Browse files Browse the repository at this point in the history
## Changes
<!-- Summary of your changes that are easy to understand -->
In this PR, we've tackled an issue with our plugin framework models.
Previously, fields that were meant to be computed were mistakenly
generated with "computed,optional" annotations instead of just
"computed."
Also, if any fields were indicated as having effective values, the
effective fields also ended up with the wrong "computed,optional" tag
rather than the correct "computed." We've regenerated the models to
correct these annotations.

## Tests
<!-- 
How is this tested? Please see the checklist below and also describe any
other relevant tests
-->

- [ ] `make test` run locally
- [ ] relevant change in `docs/` folder
- [ ] covered with integration tests in `internal/acceptance`
- [ ] relevant acceptance tests are passing
- [ ] using Go SDK

---------

Co-authored-by: Omer Lachish <rauchy@users.noreply.github.com>
  • Loading branch information
rauchy and rauchy authored Dec 16, 2024
1 parent 3318833 commit f716018
Show file tree
Hide file tree
Showing 9 changed files with 109 additions and 127 deletions.
18 changes: 0 additions & 18 deletions internal/providers/pluginfw/products/app/resource_app.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,24 +37,6 @@ func (a resourceApp) Metadata(ctx context.Context, req resource.MetadataRequest,
func (a resourceApp) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) {
resp.Schema = tfschema.ResourceStructToSchema(ctx, apps_tf.App{}, func(cs tfschema.CustomizableSchema) tfschema.CustomizableSchema {
cs.AddPlanModifier(stringplanmodifier.RequiresReplace(), "name")
// Computed fields
for _, p := range []string{
"active_deployment",
"app_status",
"compute_status",
"create_time",
"creator",
"default_source_code_path",
"pending_deployment",
"service_principal_client_id",
"service_principal_id",
"service_principal_name",
"update_time",
"updater",
"url",
} {
cs.SetReadOnly(p)
}
exclusiveFields := []string{"job", "secret", "serving_endpoint", "sql_warehouse"}
paths := path.Expressions{}
for _, field := range exclusiveFields[1:] {
Expand Down
48 changes: 24 additions & 24 deletions internal/service/apps_tf/model.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions internal/service/catalog_tf/model.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 18 additions & 18 deletions internal/service/cleanrooms_tf/model.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit f716018

Please sign in to comment.