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

no use UseStateForUnknown in PlanModifiers #76

Merged
merged 1 commit into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ This resource requires the ` + strings.Join([]string{
Attributes: map[string]schema.Attribute{
"id": schema.StringAttribute{
Computed: true,
PlanModifiers: []planmodifier.String{stringplanmodifier.UseStateForUnknown()},
MarkdownDescription: "Auto receptionist ID. The unique identifier of the auto receptionist.",
},
"cost_center": schema.StringAttribute{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ import (
"github.com/hashicorp/terraform-plugin-framework/resource"
"github.com/hashicorp/terraform-plugin-framework/resource/schema"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/objectdefault"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringdefault"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
"github.com/hashicorp/terraform-plugin-framework/types"
"github.com/hashicorp/terraform-plugin-log/tflog"
Expand Down Expand Up @@ -93,7 +91,6 @@ This resource requires the ` + strings.Join([]string{
"name": schema.StringAttribute{
Computed: true,
MarkdownDescription: "The audio prompt file name.",
PlanModifiers: []planmodifier.String{stringplanmodifier.UseStateForUnknown()},
},
},
Default: objectdefault.StaticValue(
Expand Down Expand Up @@ -143,17 +140,14 @@ This resource requires the ` + strings.Join([]string{
"display_name": schema.StringAttribute{
Computed: true,
MarkdownDescription: "The display name.",
PlanModifiers: []planmodifier.String{stringplanmodifier.UseStateForUnknown()},
},
"extension_number": schema.StringAttribute{
Computed: true,
MarkdownDescription: "The extension number.",
PlanModifiers: []planmodifier.String{stringplanmodifier.UseStateForUnknown()},
},
"id": schema.StringAttribute{
Computed: true,
MarkdownDescription: "The user, common area, Zoom Room, Cisco/Polycom room, auto receptionist, call queue, or shared line group ID.",
PlanModifiers: []planmodifier.String{stringplanmodifier.UseStateForUnknown()},
},
},
},
Expand Down Expand Up @@ -212,17 +206,14 @@ This resource requires the ` + strings.Join([]string{
"display_name": schema.StringAttribute{
Computed: true,
MarkdownDescription: "The display name.",
PlanModifiers: []planmodifier.String{stringplanmodifier.UseStateForUnknown()},
},
"extension_number": schema.StringAttribute{
Computed: true,
MarkdownDescription: "The extension number.",
PlanModifiers: []planmodifier.String{stringplanmodifier.UseStateForUnknown()},
},
"id": schema.StringAttribute{
Computed: true,
MarkdownDescription: "The user, common area, Zoom Room, Cisco/Polycom room, auto receptionist, call queue, or shared line group ID.",
PlanModifiers: []planmodifier.String{stringplanmodifier.UseStateForUnknown()},
},
},
},
Expand All @@ -237,7 +228,6 @@ This resource requires the ` + strings.Join([]string{
"name": schema.StringAttribute{
Computed: true,
MarkdownDescription: "The voicemail greeting file name.",
PlanModifiers: []planmodifier.String{stringplanmodifier.UseStateForUnknown()},
},
},
},
Expand Down
2 changes: 0 additions & 2 deletions internal/services/phone/blockedlist/blocked_list_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ This resource requires the ` + strings.Join([]string{
"id": schema.StringAttribute{
Computed: true,
MarkdownDescription: "Unique identifier of the blocked list.",
PlanModifiers: []planmodifier.String{stringplanmodifier.UseStateForUnknown()},
},
"block_type": schema.StringAttribute{
Required: true,
Expand Down Expand Up @@ -118,7 +117,6 @@ This resource requires the ` + strings.Join([]string{
Default: stringdefault.StaticString("active"),
// PATCH blocked_list hasn't be provided yet, so we just do delete/create on update.
PlanModifiers: []planmodifier.String{
stringplanmodifier.UseStateForUnknown(),
stringplanmodifier.RequiresReplace(),
},
Validators: []validator.String{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -408,9 +408,6 @@ This resource requires the ` + strings.Join([]string{
"id": schema.StringAttribute{
Computed: true,
MarkdownDescription: "The call forwarding's ID.",
PlanModifiers: []planmodifier.String{
stringplanmodifier.UseStateForUnknown(),
},
},
"description": schema.StringAttribute{
Optional: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,9 +255,6 @@ This resource requires the ` + strings.Join([]string{
"id": schema.StringAttribute{
Computed: true,
MarkdownDescription: "The call forwarding's ID.",
PlanModifiers: []planmodifier.String{
stringplanmodifier.UseStateForUnknown(),
},
},
"description": schema.StringAttribute{
Optional: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ This resource requires the ` + strings.Join([]string{
"holiday_id": schema.StringAttribute{
Computed: true,
MarkdownDescription: "The holiday's ID. It's required for the `holiday` sub-setting.",
PlanModifiers: []planmodifier.String{stringplanmodifier.UseStateForUnknown()},
},
"holiday": schema.SingleNestedAttribute{
Required: true,
Expand Down
6 changes: 0 additions & 6 deletions internal/services/phone/callqueue/call_queue_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@ import (
"github.com/hashicorp/terraform-plugin-framework/path"
"github.com/hashicorp/terraform-plugin-framework/resource"
"github.com/hashicorp/terraform-plugin-framework/resource/schema"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/int64planmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringdefault"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
"github.com/hashicorp/terraform-plugin-framework/types"
"github.com/hashicorp/terraform-plugin-log/tflog"
Expand Down Expand Up @@ -67,7 +64,6 @@ This resource requires the ` + strings.Join([]string{
Attributes: map[string]schema.Attribute{
"id": schema.StringAttribute{
Computed: true,
PlanModifiers: []planmodifier.String{stringplanmodifier.UseStateForUnknown()},
MarkdownDescription: "Unique identifier of the Call Queue.",
},
"cost_center": schema.StringAttribute{
Expand All @@ -81,11 +77,9 @@ This resource requires the ` + strings.Join([]string{
"extension_id": schema.StringAttribute{
Computed: true,
MarkdownDescription: "Extension ID.",
PlanModifiers: []planmodifier.String{stringplanmodifier.UseStateForUnknown()},
},
"extension_number": schema.Int64Attribute{
Required: true,
PlanModifiers: []planmodifier.Int64{int64planmodifier.UseStateForUnknown()},
MarkdownDescription: "Extension number of the call queue.",
},
"name": schema.StringAttribute{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,17 @@ package externalcontact
import (
"context"
"fmt"
"strings"

"github.com/hashicorp/terraform-plugin-framework-validators/setvalidator"
"github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/booldefault"
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
"strings"

"github.com/folio-sec/terraform-provider-zoom/internal/provider/shared"
"github.com/hashicorp/terraform-plugin-framework/path"
"github.com/hashicorp/terraform-plugin-framework/resource"
"github.com/hashicorp/terraform-plugin-framework/resource/schema"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
"github.com/hashicorp/terraform-plugin-framework/types"
"github.com/hashicorp/terraform-plugin-log/tflog"
)
Expand Down Expand Up @@ -69,7 +68,6 @@ This resource requires the ` + strings.Join([]string{
Optional: true,
Computed: true,
MarkdownDescription: "The customer-configured external contact ID. It is recommended that you use a primary key from the original phone system. If you do not use this parameter, the API automatically generates an `external_contact_id`.",
PlanModifiers: []planmodifier.String{stringplanmodifier.UseStateForUnknown()},
},
"name": schema.StringAttribute{
Required: true,
Expand Down Expand Up @@ -110,13 +108,11 @@ This resource requires the ` + strings.Join([]string{
"external_contact_id": schema.StringAttribute{
Computed: true,
MarkdownDescription: "The Zoom-generated external contact ID.",
PlanModifiers: []planmodifier.String{stringplanmodifier.UseStateForUnknown()},
},
"routing_path": schema.StringAttribute{
Optional: true,
Computed: true,
MarkdownDescription: "The external contact's SIP group, to define the call routing path. This is for customers that use SIP trunking.",
PlanModifiers: []planmodifier.String{stringplanmodifier.UseStateForUnknown()},
},
},
}
Expand Down
33 changes: 7 additions & 26 deletions internal/services/phone/user/user_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
"github.com/hashicorp/terraform-plugin-framework/path"
"github.com/hashicorp/terraform-plugin-framework/resource"
"github.com/hashicorp/terraform-plugin-framework/resource/schema"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/int64planmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
Expand Down Expand Up @@ -91,25 +90,16 @@ This resource requires the ` + strings.Join([]string{
MarkdownDescription: "The ID of the Zoom user.",
},
"cost_center": schema.StringAttribute{
Computed: true,
PlanModifiers: []planmodifier.String{
stringplanmodifier.UseStateForUnknown(),
},
Computed: true,
MarkdownDescription: "The cost center name.",
},
"emergency_address_id": schema.StringAttribute{
Optional: true,
Computed: true,
PlanModifiers: []planmodifier.String{
stringplanmodifier.UseStateForUnknown(),
},
Optional: true,
Computed: true,
MarkdownDescription: "The emergency address ID.",
},
"extension_id": schema.StringAttribute{
Computed: true,
PlanModifiers: []planmodifier.String{
stringplanmodifier.UseStateForUnknown(),
},
Computed: true,
MarkdownDescription: "The extension ID.",
},
"extension_number": schema.Int64Attribute{
Expand All @@ -118,24 +108,15 @@ This resource requires the ` + strings.Join([]string{
Validators: []validator.Int64{
customvalidator.Int64GreaterThan(99),
},
PlanModifiers: []planmodifier.Int64{
int64planmodifier.UseStateForUnknown(),
},
MarkdownDescription: "The extension ID. Allowed more than 3 digits. Normally, the number of digits is limited to 6, but you might be increased by contacting support.",
},
"phone_user_id": schema.StringAttribute{
Computed: true,
PlanModifiers: []planmodifier.String{
stringplanmodifier.UseStateForUnknown(),
},
Computed: true,
MarkdownDescription: "The ID of the Phone user.",
},
"site_id": schema.StringAttribute{
Optional: true,
Computed: true,
PlanModifiers: []planmodifier.String{
stringplanmodifier.UseStateForUnknown(),
},
Optional: true,
Computed: true,
MarkdownDescription: "The unique identifier of the [site](https://support.zoom.us/hc/en-us/articles/360020809672z) where the user should be moved or assigned.",
},
"template_id": schema.StringAttribute{
Expand Down
Loading