Skip to content

Commit

Permalink
no use UseStateForUnknown in PlanModifiers (#76)
Browse files Browse the repository at this point in the history
Signed-off-by: Tadayuki Onishi <[email protected]>
Co-authored-by: Tadayuki Onishi <[email protected]>
  • Loading branch information
kenchan0130 and Tadayuki Onishi authored Dec 23, 2024
1 parent 0d74e89 commit 5ea5719
Show file tree
Hide file tree
Showing 9 changed files with 7 additions and 57 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,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 @@ -94,7 +92,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 @@ -144,17 +141,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 @@ -213,17 +207,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 @@ -238,7 +229,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 @@ -70,7 +70,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 @@ -119,7 +118,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 @@ -409,9 +409,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 @@ -256,9 +256,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 @@ -75,7 +75,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 @@ -68,7 +65,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 @@ -82,11 +78,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 @@ -14,8 +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/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 @@ -71,7 +69,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 @@ -112,13 +109,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 @@ -90,25 +89,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 @@ -117,24 +107,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

0 comments on commit 5ea5719

Please sign in to comment.