Skip to content

Commit

Permalink
Fix: Trigger update instead of replace when changing scope resources (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
lootag authored Jan 15, 2025
1 parent c7519cf commit f17e6a8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -745,3 +745,11 @@ Breaking Changes:

Revamped the structure of alerts in general. Please consult the guide v1-v2-migration-guide on how to migrate.

# Release 2.0.1
### resource/coralogix_slo
* Various SLO fixes


# Release 2.0.2
### resource/coralogix_scope
* Update scopes in place instead of creating new ones on update
5 changes: 4 additions & 1 deletion coralogix/resource_coralogix_scope.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"fmt"
"log"
"regexp"
"strconv"
"strings"
"terraform-provider-coralogix/coralogix/clientset"

Expand Down Expand Up @@ -105,7 +106,7 @@ func (r *ScopeResource) Schema(ctx context.Context, req resource.SchemaRequest,
MarkdownDescription: "Associated team.",
Computed: true,
PlanModifiers: []planmodifier.String{
stringplanmodifier.RequiresReplace(),
stringplanmodifier.UseStateForUnknown(),
},
},
"filters": schema.ListNestedAttribute{
Expand Down Expand Up @@ -232,6 +233,7 @@ func flattenScope(resp *cxsdk.GetScopesResponse) []ScopeResourceModel {
DisplayName: types.StringValue(scope.GetDisplayName()),
Description: description,
DefaultExpression: types.StringValue(scope.GetDefaultExpression()),
TeamId: types.StringValue(strconv.Itoa(int(scope.GetTeamId()))),
Filters: flattenScopeFilters(scope.GetFilters()),
})
}
Expand Down Expand Up @@ -284,6 +286,7 @@ func (r *ScopeResource) Read(ctx context.Context, req resource.ReadRequest, resp
log.Printf("[INFO] Received Scope: %s", protojson.Format(getScopeResp))

state := flattenScope(getScopeResp)[0]

// Set state to fully populated data
diags = resp.State.Set(ctx, state)
resp.Diagnostics.Append(diags...)
Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ provider "coralogix" {
- `api_key` (String, Sensitive) A key for using coralogix APIs (Auto Generated), appropriate for the defined environment. environment variable 'CORALOGIX_API_KEY' can be defined instead.
- `domain` (String) The Coralogix domain. Conflict With 'env'. environment variable 'CORALOGIX_DOMAIN' can be defined instead.
- `env` (String) The Coralogix API environment. can be one of ["USA1" "APAC1" "US2" "AP1" "APAC2" "AP3" "EUROPE1" "EU1" "EU2" "US1" "AP2" "APAC3" "EUROPE2" "USA2"]. environment variable 'CORALOGIX_ENV' can be defined instead.# Getting Started
- `env` (String) The Coralogix API environment. can be one of ["EUROPE1" "APAC1" "AP2" "APAC3" "EU1" "EUROPE2" "USA1" "US2" "AP1" "APAC2" "AP3" "EU2" "US1" "USA2"]. environment variable 'CORALOGIX_ENV' can be defined instead.# Getting Started
Check out our examples for how to configure the various resources offered by the provider. If you already have Coralogix set up and want to import any existing resources, check out our migration script: [https://github.com/coralogix/coralogix-management-sdk/tree/master/tools/terraform-importer]().
Expand Down

0 comments on commit f17e6a8

Please sign in to comment.