Skip to content

Commit

Permalink
Merge pull request #125 from megaport/fix/remove-vxc-replaceif
Browse files Browse the repository at this point in the history
fix: removes planmodifier for requested_product_uid temporarily
  • Loading branch information
MegaportPhilipBrowne authored Jul 26, 2024
2 parents 56c19a6 + ae80a7d commit 82841ae
Showing 1 changed file with 24 additions and 21 deletions.
45 changes: 24 additions & 21 deletions internal/provider/vxc_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -960,16 +960,18 @@ func (r *vxcResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *
"requested_product_uid": schema.StringAttribute{
Description: "The Product UID requested by the user for the A-End configuration.",
Required: true,
PlanModifiers: []planmodifier.String{
stringplanmodifier.RequiresReplaceIf(
func(ctx context.Context, sr planmodifier.StringRequest, rrifr *stringplanmodifier.RequiresReplaceIfFuncResponse) {
if sr.PlanValue.IsUnknown() {
rrifr.RequiresReplace = true
}
},
"This modifier will replace the VXC if the new `requested_product_uid` is unknown. This allows the provider to better handle situations when the connected product (Port, MVE, MCR) is being replaced. To avoid replacement, make sure the new `requested_product_uid` is a known value (i.e. an existing product in the state).",
""),
},
// PlanModifiers: []planmodifier.String{
// stringplanmodifier.RequiresReplaceIf(
// func(ctx context.Context, sr planmodifier.StringRequest, rrifr *stringplanmodifier.RequiresReplaceIfFuncResponse) {
// if sr.PlanValue.IsUnknown() {
// rrifr.RequiresReplace = true
// }
// },
// "This modifier will replace the VXC if the new `requested_product_uid` is unknown. This allows the provider to better handle situations when the connected product (Port, MVE, MCR) is being replaced. To avoid replacement, make sure the new `requested_product_uid` is a known value (i.e. an existing product in the state).",
// "This modifier will replace the VXC if the new `requested_product_uid` is unknown. This allows the provider to better handle situations when the connected product (Port, MVE, MCR) is being replaced. To avoid replacement, make sure the new `requested_product_uid` is a known value (i.e. an existing product in the state).",
// ),
// stringplanmodifier.UseStateForUnknown(),
// },
},
"current_product_uid": schema.StringAttribute{
Description: "The current product UID of the A-End configuration. The Megaport API may change a Partner Port from the Requested Port to a different Port in the same location and diversity zone.",
Expand Down Expand Up @@ -1042,17 +1044,18 @@ func (r *vxcResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *
Description: "The Product UID requested by the user for the B-End configuration.",
Optional: true,
Computed: true,
PlanModifiers: []planmodifier.String{
stringplanmodifier.RequiresReplaceIf(
func(ctx context.Context, sr planmodifier.StringRequest, rrifr *stringplanmodifier.RequiresReplaceIfFuncResponse) {
if sr.PlanValue.IsUnknown() {
rrifr.RequiresReplace = true
}
},
"This modifier will replace the VXC if the new `requested_product_uid` is unknown. This allows the provider to better handle situations when the connected product (Port, MVE, MCR) is being replaced. To avoid replacement, make sure the new `requested_product_uid` is a known value (i.e. an existing product in the state).",
"This modifier will replace the VXC if the new `requested_product_uid` is unknown. This allows the provider to better handle situations when the connected product (Port, MVE, MCR) is being replaced. To avoid replacement, make sure the new `requested_product_uid` is a known value (i.e. an existing product in the state).",
),
},
// PlanModifiers: []planmodifier.String{
// stringplanmodifier.RequiresReplaceIf(
// func(ctx context.Context, sr planmodifier.StringRequest, rrifr *stringplanmodifier.RequiresReplaceIfFuncResponse) {
// if sr.PlanValue.IsUnknown() {
// rrifr.RequiresReplace = true
// }
// },
// "This modifier will replace the VXC if the new `requested_product_uid` is unknown. This allows the provider to better handle situations when the connected product (Port, MVE, MCR) is being replaced. To avoid replacement, make sure the new `requested_product_uid` is a known value (i.e. an existing product in the state).",
// "This modifier will replace the VXC if the new `requested_product_uid` is unknown. This allows the provider to better handle situations when the connected product (Port, MVE, MCR) is being replaced. To avoid replacement, make sure the new `requested_product_uid` is a known value (i.e. an existing product in the state).",
// ),
// stringplanmodifier.UseStateForUnknown(),
// },
},
"current_product_uid": schema.StringAttribute{
Description: "The current product UID of the B-End configuration. The Megaport API may change a Partner Port on the end configuration from the Requested Port UID to a different Port in the same location and diversity zone.",
Expand Down

0 comments on commit 82841ae

Please sign in to comment.