Skip to content

Commit

Permalink
Add useless modifyplan for simulating a computed alert params config
Browse files Browse the repository at this point in the history
  • Loading branch information
cjgajard committed May 10, 2024
1 parent c6b98fc commit 3bc9c9e
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions pagerdutyplugin/resource_pagerduty_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,22 @@ func (r *resourceService) ValidateConfig(ctx context.Context, req resource.Valid
}
}

func (r *resourceService) ModifyPlan(ctx context.Context, req resource.ModifyPlanRequest, resp *resource.ModifyPlanResponse) {
// Set alert_grouping_parameters as Computed then "intelligent" type
var pType types.String
var config types.List
resp.Diagnostics.Append(req.Config.GetAttribute(ctx, alertGroupingParametersPath.AtName("type"), &pType)...)
resp.Diagnostics.Append(req.Config.GetAttribute(ctx, alertGroupingParametersPath.AtName("config"), &config)...)
if resp.Diagnostics.HasError() {
return
}
if pType.ValueString() == "intelligent" && config.IsNull() {
resp.Diagnostics.Append(
resp.Plan.SetAttribute(ctx, alertGroupingParametersPath.AtName("config"), types.ListUnknown(alertGroupingParametersConfigObjectType))...,
)
}
}

func (r *resourceService) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) {
var config resourceServiceModel
var model resourceServiceModel
Expand Down

0 comments on commit 3bc9c9e

Please sign in to comment.