Skip to content

Commit

Permalink
define RecipientsSlackChannels outside the cycle so it is updated whe…
Browse files Browse the repository at this point in the history
…n is empty
  • Loading branch information
dianibar committed May 10, 2024
1 parent bf4d1dd commit 69dc4a8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions internal/provider/budget_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ type budgetResourceModel struct {
}

type ExternalBudgetAlertModel struct {
Percentage types.Float64 `tfsdk:"percentage"`
Percentage types.Float64 `tfsdk:"percentage"`
}

type CollaboratorModel struct {
Expand Down Expand Up @@ -332,8 +332,8 @@ func budgetModelToBudget(budgetModel *budgetResourceModel, ctx context.Context)
}
budget.Recipients = recipients

var slackChannels []SlackChannel
if budgetModel.RecipientsSlackChannels != nil {
var slackChannels []SlackChannel
for _, slackChannel := range budgetModel.RecipientsSlackChannels {
customerId := slackChannel.CustomerId.ValueString()
id := slackChannel.Id.ValueString()
Expand Down Expand Up @@ -447,8 +447,8 @@ func budgetToBudgetResourceModel(budget *Budget, budgetModel *budgetResourceMode
for _, recipient := range budget.Recipients {
budgetModel.Recipients = append(budgetModel.Recipients, types.StringValue(recipient))
}
budgetModel.RecipientsSlackChannels = []SlackChannelModel{}
if budget.RecipientsSlackChannels != nil {
budgetModel.RecipientsSlackChannels = []SlackChannelModel{}
for _, recipient := range budget.RecipientsSlackChannels {
budgetModel.RecipientsSlackChannels = append(budgetModel.RecipientsSlackChannels, SlackChannelModel{
CustomerId: types.StringValue(recipient.CustomerId),
Expand Down

0 comments on commit 69dc4a8

Please sign in to comment.