I have a Firewall Rule Resource. Every Rule has a Priority. However the Attrubite can be Optional and Computed. The User can specify the Priority if they wish, if not the API will give the rule a Priority (the nth + 1 Priority). However, if I create a Firewall Rule with an existing Priority (e.g there is a conflict) as there exists a Firewall Rule with Priority of 1 and Terraform creates a Rule with the Priority of 1. The framework will panic. What would be the best way to handle this problem?
type FirewallRuleModel struct {
ID types.String `tfsdk:"id"`
Description types.String `tfsdk:"description"`
Type types.String `tfsdk:"type"`
Conditions []CustomConditionModel `tfsdk:"condition"`
Priority types.Int64 `tfsdk:"priority"`
}
"priority": schema.Int64Attribute{
Optional: true, // Optional and Computed can both be true
Computed: true,
Description: "The priority of the Firewall Rule.",
Validators: []validator.Int64{
int64validator.Between(1, 1000),
},
},